From 81b5ae2bcd74c65b18c6cb2f28732d39e53f0420 Mon Sep 17 00:00:00 2001 From: Erwan Beauvois Date: Thu, 5 May 2022 11:02:42 +0200 Subject: [PATCH 001/274] Fix BalancerPool2Lens pfei accounting --- contracts/pcv/balancer/BalancerPool2Lens.sol | 1 + 1 file changed, 1 insertion(+) diff --git a/contracts/pcv/balancer/BalancerPool2Lens.sol b/contracts/pcv/balancer/BalancerPool2Lens.sol index ec9d45f4a..64a356451 100644 --- a/contracts/pcv/balancer/BalancerPool2Lens.sol +++ b/contracts/pcv/balancer/BalancerPool2Lens.sol @@ -119,6 +119,7 @@ contract BalancerPool2Lens is IPCVDepositBalances { } if (feiInPair) { uint256 otherReserves = _getIdealReserves(balances, prices, weights, j); + otherReserves = (otherReserves * bptsOwned) / totalSupply; return (reserves, otherReserves); } return (reserves, 0); From 41af6de97f87c81cb320f6dc7d9a23982838447b Mon Sep 17 00:00:00 2001 From: Erwan Beauvois Date: Thu, 5 May 2022 11:04:42 +0200 Subject: [PATCH 002/274] add oa_cr_fix proposal --- proposals/dao/oa_cr_fix.ts | 200 +++++++++++++++++++++++++++ proposals/description/oa_cr_fix.ts | 34 +++++ test/integration/proposals_config.ts | 63 +-------- 3 files changed, 240 insertions(+), 57 deletions(-) create mode 100644 proposals/dao/oa_cr_fix.ts create mode 100644 proposals/description/oa_cr_fix.ts diff --git a/proposals/dao/oa_cr_fix.ts b/proposals/dao/oa_cr_fix.ts new file mode 100644 index 000000000..ad29cc75c --- /dev/null +++ b/proposals/dao/oa_cr_fix.ts @@ -0,0 +1,200 @@ +import hre, { ethers, artifacts } from 'hardhat'; +import { expect } from 'chai'; +import { + DeployUpgradeFunc, + NamedAddresses, + SetupUpgradeFunc, + TeardownUpgradeFunc, + ValidateUpgradeFunc +} from '@custom-types/types'; +import { ZERO_ADDRESS, overwriteChainlinkAggregator } from '@test/helpers'; + +const fipNumber = 'oa_cr_fix'; +let pcvStatsBefore; + +// Do any deployments +// This should exclusively include new contract deployments +const deploy: DeployUpgradeFunc = async (deployAddress: string, addresses: NamedAddresses, logging: boolean) => { + // Deploy lens to report B-30FEI-70WETH as WETH and protocol-owned FEI + // (The new contract contains a fix) + const balancerPool2LensFactory = await ethers.getContractFactory('BalancerPool2Lens'); + const balancerLensBpt30Fei70WethFixed = await balancerPool2LensFactory.deploy( + addresses.gaugeLensBpt30Fei70WethGauge, // address _depositAddress + addresses.wethERC20, // address _token + '0x90291319f1d4ea3ad4db0dd8fe9e12baf749e845', // IWeightedPool _pool + addresses.chainlinkEthUsdOracleWrapper, // IOracle _reportedOracle + addresses.oneConstantOracle, // IOracle _otherOracle + false, // bool _feiIsReportedIn + true // bool _feiIsOther + ); + await balancerLensBpt30Fei70WethFixed.deployTransaction.wait(); + logging && console.log('balancerLensBpt30Fei70WethFixed: ', balancerLensBpt30Fei70WethFixed.address); + + return { + balancerLensBpt30Fei70WethFixed + }; +}; + +// Do any setup necessary for running the test. +// This could include setting up Hardhat to impersonate accounts, +// ensuring contracts have a specific state, etc. +const setup: SetupUpgradeFunc = async (addresses, oldContracts, contracts, logging) => { + console.log(`Setup of ${fipNumber} : reading CR oracle...`); + pcvStatsBefore = await contracts.collateralizationOracle.pcvStats(); + + // make sure oracle of B.AMM is fresh + // set Chainlink ETHUSD to a fixed 3,000$ value + await overwriteChainlinkAggregator(addresses.chainlinkEthUsdOracle, '300000000000', '8'); +}; + +// Tears down any changes made in setup() that need to be +// cleaned up before doing any validation checks. +const teardown: TeardownUpgradeFunc = async (addresses, oldContracts, contracts, logging) => { + console.log(`No actions to complete in teardown for fip${fipNumber}`); +}; + +// Run any validations required on the fip using mocha or console logging +// IE check balances, check state of contracts, etc. +const validate: ValidateUpgradeFunc = async (addresses, oldContracts, contracts, logging) => { + // Check the removed PCV Deposits + expect(await contracts.collateralizationOracle.depositToToken(addresses.rariPool8FeiPCVDepositWrapper)).to.be.equal( + ZERO_ADDRESS + ); + expect(await contracts.collateralizationOracle.depositToToken(addresses.rariPool8DaiPCVDeposit)).to.be.equal( + ZERO_ADDRESS + ); + expect(await contracts.collateralizationOracle.depositToToken(addresses.rariPool8LusdPCVDeposit)).to.be.equal( + ZERO_ADDRESS + ); + expect(await contracts.collateralizationOracle.depositToToken(addresses.rariPool18FeiPCVDepositWrapper)).to.be.equal( + ZERO_ADDRESS + ); + expect(await contracts.collateralizationOracle.depositToToken(addresses.rariPool27FeiPCVDepositWrapper)).to.be.equal( + ZERO_ADDRESS + ); + expect(await contracts.collateralizationOracle.depositToToken(addresses.rariPool146EthPCVDeposit)).to.be.equal( + ZERO_ADDRESS + ); + expect(await contracts.collateralizationOracle.depositToToken(addresses.convexPoolPCVDepositWrapper)).to.be.equal( + ZERO_ADDRESS + ); + + // Check the lens swap + expect(await contracts.collateralizationOracle.depositToToken(addresses.balancerLensBpt30Fei70Weth)).to.be.equal( + ZERO_ADDRESS + ); + expect(await contracts.collateralizationOracle.depositToToken(addresses.balancerLensBpt30Fei70WethFixed)).to.be.equal( + addresses.weth + ); + + // Check the new lens returned values + const balance = (await contracts.balancerLensBpt30Fei70WethFixed.balance()) / 1e18; + const resistantBalanceAndFei = await contracts.balancerLensBpt30Fei70WethFixed.resistantBalanceAndFei(); + const resistantBalance = resistantBalanceAndFei[0] / 1e18; + const resistantFei = resistantBalanceAndFei[1] / 1e18; + expect(balance).to.be.at.least(14000); + expect(balance).to.be.at.most(16000); + expect(resistantBalance).to.be.at.least(14000); + expect(resistantBalance).to.be.at.most(16000); + expect(resistantFei).to.be.at.least(17e6); + expect(resistantFei).to.be.at.most(20e6); + + // Check pcvStats + console.log('----------------------------------------------------'); + console.log('pcvStatsBefore.protocolControlledValue [M]e18 ', pcvStatsBefore.protocolControlledValue / 1e24); + console.log('pcvStatsBefore.userCirculatingFei [M]e18 ', pcvStatsBefore.userCirculatingFei / 1e24); + console.log('pcvStatsBefore.protocolEquity [M]e18 ', pcvStatsBefore.protocolEquity / 1e24); + const pcvStatsAfter = await contracts.collateralizationOracle.pcvStats(); + console.log('----------------------------------------------------'); + console.log('pcvStatsAfter.protocolControlledValue [M]e18 ', pcvStatsAfter.protocolControlledValue / 1e24); + console.log('pcvStatsAfter.userCirculatingFei [M]e18 ', pcvStatsAfter.userCirculatingFei / 1e24); + console.log('pcvStatsAfter.protocolEquity [M]e18 ', pcvStatsAfter.protocolEquity / 1e24); + console.log('----------------------------------------------------'); + console.log( + 'PCV diff [M]e18 ', + pcvStatsAfter.protocolControlledValue.sub(pcvStatsBefore.protocolControlledValue) / 1e24 + ); + console.log('Circ FEI diff [M]e18 ', pcvStatsAfter.userCirculatingFei.sub(pcvStatsBefore.userCirculatingFei) / 1e24); + console.log('Equity diff [M]e18 ', pcvStatsAfter.protocolEquity.sub(pcvStatsBefore.protocolEquity) / 1e24); + console.log('----------------------------------------------------'); + console.log('Removed PCV Deposit resistant balance :'); + console.log( + 'rariPool8FeiPCVDepositWrapper [M]e18 ', + (await contracts.rariPool8FeiPCVDepositWrapper.resistantBalanceAndFei())[0] / 1e24 + ); + console.log( + 'rariPool8DaiPCVDeposit [M]e18 ', + (await contracts.rariPool8DaiPCVDeposit.resistantBalanceAndFei())[0] / 1e24 + ); + console.log( + 'rariPool8LusdPCVDeposit [M]e18 ', + (await contracts.rariPool8LusdPCVDeposit.resistantBalanceAndFei())[0] / 1e24 + ); + console.log( + 'rariPool18FeiPCVDepositWrapper [M]e18 ', + (await contracts.rariPool18FeiPCVDepositWrapper.resistantBalanceAndFei())[0] / 1e24 + ); + console.log( + 'rariPool27FeiPCVDepositWrapper [M]e18 ', + (await contracts.rariPool27FeiPCVDepositWrapper.resistantBalanceAndFei())[0] / 1e24 + ); + console.log( + 'rariPool146EthPCVDeposit [M]e18 ', + ((await contracts.rariPool146EthPCVDeposit.resistantBalanceAndFei())[0] * 3000) / 1e24 + ); + console.log( + 'convexPoolPCVDepositWrapper [M]e18 ', + (await contracts.convexPoolPCVDepositWrapper.resistantBalanceAndFei())[0] / 1e24 + ); + console.log('----------------------------------------------------'); + console.log('Removed PCV Deposit resistant fei :'); + console.log( + 'rariPool8FeiPCVDepositWrapper [M]e18 ', + (await contracts.rariPool8FeiPCVDepositWrapper.resistantBalanceAndFei())[1] / 1e24 + ); + console.log( + 'rariPool8DaiPCVDeposit [M]e18 ', + (await contracts.rariPool8DaiPCVDeposit.resistantBalanceAndFei())[1] / 1e24 + ); + console.log( + 'rariPool8LusdPCVDeposit [M]e18 ', + (await contracts.rariPool8LusdPCVDeposit.resistantBalanceAndFei())[1] / 1e24 + ); + console.log( + 'rariPool18FeiPCVDepositWrapper [M]e18 ', + (await contracts.rariPool18FeiPCVDepositWrapper.resistantBalanceAndFei())[1] / 1e24 + ); + console.log( + 'rariPool27FeiPCVDepositWrapper [M]e18 ', + (await contracts.rariPool27FeiPCVDepositWrapper.resistantBalanceAndFei())[1] / 1e24 + ); + console.log( + 'rariPool146EthPCVDeposit [M]e18 ', + (await contracts.rariPool146EthPCVDeposit.resistantBalanceAndFei())[1] / 1e24 + ); + console.log( + 'convexPoolPCVDepositWrapper [M]e18 ', + (await contracts.convexPoolPCVDepositWrapper.resistantBalanceAndFei())[1] / 1e24 + ); + console.log('----------------------------------------------------'); + console.log( + 'old lens balance [M]e18 ', + ((await contracts.balancerLensBpt30Fei70Weth.resistantBalanceAndFei())[0] * 3000) / 1e24 + ); + console.log( + 'old lens fei [M]e18 ', + (await contracts.balancerLensBpt30Fei70Weth.resistantBalanceAndFei())[1] / 1e24 + ); + console.log( + 'new lens balance [M]e18 ', + ((await contracts.balancerLensBpt30Fei70WethFixed.resistantBalanceAndFei())[0] * 3000) / 1e24 + ); + console.log( + 'new lens fei [M]e18 ', + (await contracts.balancerLensBpt30Fei70WethFixed.resistantBalanceAndFei())[1] / 1e24 + ); + + // Check the lens swap +}; + +export { deploy, setup, teardown, validate }; diff --git a/proposals/description/oa_cr_fix.ts b/proposals/description/oa_cr_fix.ts new file mode 100644 index 000000000..2b45fea25 --- /dev/null +++ b/proposals/description/oa_cr_fix.ts @@ -0,0 +1,34 @@ +import { ProposalDescription } from '@custom-types/types'; + +const fip_x: ProposalDescription = { + title: 'OA CR Fixes', + commands: [ + { + target: 'collateralizationOracle', + values: '0', + method: 'swapDeposit(address,address)', + arguments: ['{balancerLensBpt30Fei70Weth}', '{balancerLensBpt30Fei70WethFixed}'], + description: 'Update B-70WETH-30FEI Lens' + }, + { + target: 'collateralizationOracle', + values: '0', + method: 'removeDeposits(address[])', + arguments: [ + [ + '{rariPool8FeiPCVDepositWrapper}', // Fuse Pool 8 FEI + '{rariPool8DaiPCVDeposit}', // Fuse Pool 8 DAI + '{rariPool8LusdPCVDeposit}', // Fuse Pool 8 LUSD + '{rariPool18FeiPCVDepositWrapper}', // Fuse Pool 18 FEI + '{rariPool27FeiPCVDepositWrapper}', // Fuse Pool 27 FEI + '{rariPool146EthPCVDeposit}', // Fuse Pool 146 ETH + '{convexPoolPCVDepositWrapper}' // Fuse Pool 156 FEI + ] + ], + description: 'Remove PCV Deposits with bad debt' + } + ], + description: 'Fix Collateralization Oracle config after the Fuse May 2022 hack.' +}; + +export default fip_x; diff --git a/test/integration/proposals_config.ts b/test/integration/proposals_config.ts index 4f0f1de8e..b8674d65c 100644 --- a/test/integration/proposals_config.ts +++ b/test/integration/proposals_config.ts @@ -1,8 +1,6 @@ import { ProposalCategory, ProposalsConfigMap } from '@custom-types/types'; -import fip_82 from '@proposals/description/fip_82'; -import fip_98 from '@proposals/description/fip_98'; -import fip_99 from '@proposals/description/fip_99'; +import oa_cr_fix from '@proposals/description/oa_cr_fix'; // import fip_xx_proposal from '@proposals/description/fip_xx'; @@ -18,63 +16,14 @@ const proposals: ProposalsConfigMap = { category: ProposalCategory.DAO } */ - fip_82: { - deploy: false, // deploy flag for whether to run deploy action during e2e tests or use mainnet state + oa_cr_fix: { + deploy: true, // deploy flag for whether to run deploy action during e2e tests or use mainnet state totalValue: 0, // amount of ETH to send to DAO execution - proposal: fip_82, // full proposal file, imported from '@proposals/description/fip_xx.ts' + proposal: oa_cr_fix, // full proposal file, imported from '@proposals/description/fip_xx.ts' proposalId: '', - affectedContractSignoff: [ - 'roleBastion', - 'podFactory', - 'podExecutor', - 'nopeDAO', - 'governanceMetadataRegistry', - 'core', - 'tribe', - 'feiDAOTimelock', - 'tribalCouncilTimelock', - 'tribalCouncilSafe', - 'podAdminGateway' - ], + affectedContractSignoff: [], deprecatedContractSignoff: [], - category: ProposalCategory.DAO - }, - fip_98: { - deploy: false, - proposalId: '47738997083165992958921925097327638388915944734650384828020246684763693471048', - affectedContractSignoff: [ - 'fei', - 'feiDAOTimelock', - 'voltFeiSwapContract', - 'collateralizationOracle', - 'volt', - 'voltOracle', - 'voltDepositWrapper', - 'pcvGuardian', - 'turboFusePCVDeposit' - ], - deprecatedContractSignoff: [], - category: ProposalCategory.DAO, - totalValue: 0, - proposal: fip_98 - }, - fip_99: { - deploy: false, - proposalId: null, - affectedContractSignoff: [ - 'collateralizationOracle', - 'ratioPCVControllerV2', - 'rariPool9RaiPCVDeposit', - 'aaveRaiPCVDeposit', - 'raiPCVDripController', - 'raiPriceBoundPSM', - 'pcvGuardian', - 'core' - ], - deprecatedContractSignoff: [], - category: ProposalCategory.DAO, - totalValue: 0, - proposal: fip_99 + category: ProposalCategory.OA } }; From 87031b0787a3ee240daa0f48ec7e1b4e3eafb065 Mon Sep 17 00:00:00 2001 From: Erwan Beauvois Date: Fri, 6 May 2022 10:30:25 +0200 Subject: [PATCH 003/274] Deploy lens & fix console logs/oracle mock --- package.json | 2 +- proposals/dao/oa_cr_fix.ts | 106 +++--------------- .../collateralizationOracle.ts | 2 +- protocol-configuration/mainnetAddresses.ts | 5 + test/integration/proposals_config.ts | 2 +- 5 files changed, 23 insertions(+), 94 deletions(-) diff --git a/package.json b/package.json index 180360149..db4beee2d 100644 --- a/package.json +++ b/package.json @@ -14,7 +14,7 @@ "console:ropsten": "npx hardhat console --network ropsten", "clean": "forge clean && rm -rf artifacts", "test": "forge test --no-match-contract IntegrationTest", - "test:integration": "FORK_BLOCK=14516592; forge test --fork-url https://eth-mainnet.alchemyapi.io/v2/$MAINNET_ALCHEMY_API_KEY --fork-block-number $FORK_BLOCK --match-contract IntegrationTest", + "test:integration": "FORK_BLOCK=14722484; forge test --fork-url https://eth-mainnet.alchemyapi.io/v2/$MAINNET_ALCHEMY_API_KEY --fork-block-number $FORK_BLOCK --match-contract IntegrationTest", "test:integration:latest": "forge test --fork-url https://eth-mainnet.alchemyapi.io/v2/$MAINNET_ALCHEMY_API_KEY --match-contract IntegrationTest", "test:hardhat": "npx hardhat test", "test:hardhat:dependencies": "LOGGING=true NO_RESET=true npx hardhat test test/integration/tests/dependencies.ts", diff --git a/proposals/dao/oa_cr_fix.ts b/proposals/dao/oa_cr_fix.ts index ad29cc75c..7410d4592 100644 --- a/proposals/dao/oa_cr_fix.ts +++ b/proposals/dao/oa_cr_fix.ts @@ -42,9 +42,11 @@ const setup: SetupUpgradeFunc = async (addresses, oldContracts, contracts, loggi console.log(`Setup of ${fipNumber} : reading CR oracle...`); pcvStatsBefore = await contracts.collateralizationOracle.pcvStats(); + const ethPrice = (await contracts.chainlinkEthUsdOracleWrapper.read())[0].toString() / 1e10; + // make sure oracle of B.AMM is fresh // set Chainlink ETHUSD to a fixed 3,000$ value - await overwriteChainlinkAggregator(addresses.chainlinkEthUsdOracle, '300000000000', '8'); + await overwriteChainlinkAggregator(addresses.chainlinkEthUsdOracle, Math.round(ethPrice), '8'); }; // Tears down any changes made in setup() that need to be @@ -101,100 +103,22 @@ const validate: ValidateUpgradeFunc = async (addresses, oldContracts, contracts, // Check pcvStats console.log('----------------------------------------------------'); - console.log('pcvStatsBefore.protocolControlledValue [M]e18 ', pcvStatsBefore.protocolControlledValue / 1e24); - console.log('pcvStatsBefore.userCirculatingFei [M]e18 ', pcvStatsBefore.userCirculatingFei / 1e24); - console.log('pcvStatsBefore.protocolEquity [M]e18 ', pcvStatsBefore.protocolEquity / 1e24); + console.log(' pcvStatsBefore.protocolControlledValue [M]e18 ', pcvStatsBefore.protocolControlledValue / 1e24); + console.log(' pcvStatsBefore.userCirculatingFei [M]e18 ', pcvStatsBefore.userCirculatingFei / 1e24); + console.log(' pcvStatsBefore.protocolEquity [M]e18 ', pcvStatsBefore.protocolEquity / 1e24); const pcvStatsAfter = await contracts.collateralizationOracle.pcvStats(); console.log('----------------------------------------------------'); - console.log('pcvStatsAfter.protocolControlledValue [M]e18 ', pcvStatsAfter.protocolControlledValue / 1e24); - console.log('pcvStatsAfter.userCirculatingFei [M]e18 ', pcvStatsAfter.userCirculatingFei / 1e24); - console.log('pcvStatsAfter.protocolEquity [M]e18 ', pcvStatsAfter.protocolEquity / 1e24); - console.log('----------------------------------------------------'); - console.log( - 'PCV diff [M]e18 ', - pcvStatsAfter.protocolControlledValue.sub(pcvStatsBefore.protocolControlledValue) / 1e24 - ); - console.log('Circ FEI diff [M]e18 ', pcvStatsAfter.userCirculatingFei.sub(pcvStatsBefore.userCirculatingFei) / 1e24); - console.log('Equity diff [M]e18 ', pcvStatsAfter.protocolEquity.sub(pcvStatsBefore.protocolEquity) / 1e24); - console.log('----------------------------------------------------'); - console.log('Removed PCV Deposit resistant balance :'); - console.log( - 'rariPool8FeiPCVDepositWrapper [M]e18 ', - (await contracts.rariPool8FeiPCVDepositWrapper.resistantBalanceAndFei())[0] / 1e24 - ); - console.log( - 'rariPool8DaiPCVDeposit [M]e18 ', - (await contracts.rariPool8DaiPCVDeposit.resistantBalanceAndFei())[0] / 1e24 - ); - console.log( - 'rariPool8LusdPCVDeposit [M]e18 ', - (await contracts.rariPool8LusdPCVDeposit.resistantBalanceAndFei())[0] / 1e24 - ); - console.log( - 'rariPool18FeiPCVDepositWrapper [M]e18 ', - (await contracts.rariPool18FeiPCVDepositWrapper.resistantBalanceAndFei())[0] / 1e24 - ); - console.log( - 'rariPool27FeiPCVDepositWrapper [M]e18 ', - (await contracts.rariPool27FeiPCVDepositWrapper.resistantBalanceAndFei())[0] / 1e24 - ); - console.log( - 'rariPool146EthPCVDeposit [M]e18 ', - ((await contracts.rariPool146EthPCVDeposit.resistantBalanceAndFei())[0] * 3000) / 1e24 - ); - console.log( - 'convexPoolPCVDepositWrapper [M]e18 ', - (await contracts.convexPoolPCVDepositWrapper.resistantBalanceAndFei())[0] / 1e24 - ); + console.log(' pcvStatsAfter.protocolControlledValue [M]e18 ', pcvStatsAfter.protocolControlledValue / 1e24); + console.log(' pcvStatsAfter.userCirculatingFei [M]e18 ', pcvStatsAfter.userCirculatingFei / 1e24); + console.log(' pcvStatsAfter.protocolEquity [M]e18 ', pcvStatsAfter.protocolEquity / 1e24); console.log('----------------------------------------------------'); - console.log('Removed PCV Deposit resistant fei :'); - console.log( - 'rariPool8FeiPCVDepositWrapper [M]e18 ', - (await contracts.rariPool8FeiPCVDepositWrapper.resistantBalanceAndFei())[1] / 1e24 - ); - console.log( - 'rariPool8DaiPCVDeposit [M]e18 ', - (await contracts.rariPool8DaiPCVDeposit.resistantBalanceAndFei())[1] / 1e24 - ); - console.log( - 'rariPool8LusdPCVDeposit [M]e18 ', - (await contracts.rariPool8LusdPCVDeposit.resistantBalanceAndFei())[1] / 1e24 - ); - console.log( - 'rariPool18FeiPCVDepositWrapper [M]e18 ', - (await contracts.rariPool18FeiPCVDepositWrapper.resistantBalanceAndFei())[1] / 1e24 - ); - console.log( - 'rariPool27FeiPCVDepositWrapper [M]e18 ', - (await contracts.rariPool27FeiPCVDepositWrapper.resistantBalanceAndFei())[1] / 1e24 - ); - console.log( - 'rariPool146EthPCVDeposit [M]e18 ', - (await contracts.rariPool146EthPCVDeposit.resistantBalanceAndFei())[1] / 1e24 - ); - console.log( - 'convexPoolPCVDepositWrapper [M]e18 ', - (await contracts.convexPoolPCVDepositWrapper.resistantBalanceAndFei())[1] / 1e24 - ); + const pcvDiff = pcvStatsAfter.protocolControlledValue.sub(pcvStatsBefore.protocolControlledValue); + const cFeiDiff = pcvStatsAfter.userCirculatingFei.sub(pcvStatsBefore.userCirculatingFei); + const eqDiff = pcvStatsAfter.protocolEquity.sub(pcvStatsBefore.protocolEquity); + console.log(' PCV diff [M]e18 ', pcvDiff / 1e24); + console.log(' Circ FEI diff [M]e18 ', cFeiDiff / 1e24); + console.log(' Equity diff [M]e18 ', eqDiff / 1e24); console.log('----------------------------------------------------'); - console.log( - 'old lens balance [M]e18 ', - ((await contracts.balancerLensBpt30Fei70Weth.resistantBalanceAndFei())[0] * 3000) / 1e24 - ); - console.log( - 'old lens fei [M]e18 ', - (await contracts.balancerLensBpt30Fei70Weth.resistantBalanceAndFei())[1] / 1e24 - ); - console.log( - 'new lens balance [M]e18 ', - ((await contracts.balancerLensBpt30Fei70WethFixed.resistantBalanceAndFei())[0] * 3000) / 1e24 - ); - console.log( - 'new lens fei [M]e18 ', - (await contracts.balancerLensBpt30Fei70WethFixed.resistantBalanceAndFei())[1] / 1e24 - ); - - // Check the lens swap }; export { deploy, setup, teardown, validate }; diff --git a/protocol-configuration/collateralizationOracle.ts b/protocol-configuration/collateralizationOracle.ts index 94dc4861a..04a1eef3f 100644 --- a/protocol-configuration/collateralizationOracle.ts +++ b/protocol-configuration/collateralizationOracle.ts @@ -41,7 +41,7 @@ const collateralizationAddresses = { 'rariPool146EthPCVDeposit', 'wethDepositWrapper', 'balancerDepositFeiWeth', - 'balancerLensBpt30Fei70Weth', + 'balancerLensBpt30Fei70WethFixed', 'balancerLensVeBalWeth' ], dpi: ['rariPool19DpiPCVDepositWrapper', 'dpiDepositWrapper'], diff --git a/protocol-configuration/mainnetAddresses.ts b/protocol-configuration/mainnetAddresses.ts index f4f6076cb..1f9b803a7 100644 --- a/protocol-configuration/mainnetAddresses.ts +++ b/protocol-configuration/mainnetAddresses.ts @@ -394,6 +394,11 @@ const MainnetAddresses: MainnetAddresses = { balancerLensBpt30Fei70Weth: { artifactName: 'BalancerPool2Lens', address: '0xb31F75550e97A2C4c7AC8d4355032B8AE8b9584D', + category: AddressCategory.Deprecated + }, + balancerLensBpt30Fei70WethFixed: { + artifactName: 'BalancerPool2Lens', + address: '0x673f7DFA863b611dE657759aEDE629b260F4E682', category: AddressCategory.PCV }, balancerLensVeBalBal: { diff --git a/test/integration/proposals_config.ts b/test/integration/proposals_config.ts index b8674d65c..8f04f34f3 100644 --- a/test/integration/proposals_config.ts +++ b/test/integration/proposals_config.ts @@ -17,7 +17,7 @@ const proposals: ProposalsConfigMap = { } */ oa_cr_fix: { - deploy: true, // deploy flag for whether to run deploy action during e2e tests or use mainnet state + deploy: false, // deploy flag for whether to run deploy action during e2e tests or use mainnet state totalValue: 0, // amount of ETH to send to DAO execution proposal: oa_cr_fix, // full proposal file, imported from '@proposals/description/fip_xx.ts' proposalId: '', From 7bc539a46064fc2319757ef5a6a0e6ed04ceb77d Mon Sep 17 00:00:00 2001 From: Erwan Beauvois Date: Fri, 6 May 2022 14:43:25 +0200 Subject: [PATCH 004/274] update fork block --- hardhat.config.ts | 2 +- proposals/dao/oa_cr_fix.ts | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/hardhat.config.ts b/hardhat.config.ts index 65d68c995..ef418e371 100644 --- a/hardhat.config.ts +++ b/hardhat.config.ts @@ -57,7 +57,7 @@ export default { forking: enableMainnetForking ? { url: `https://eth-mainnet.alchemyapi.io/v2/${mainnetAlchemyApiKey}`, - blockNumber: 14714028 // Thursday, May 5th + blockNumber: 14722484 // Friday, May 6th } : undefined }, diff --git a/proposals/dao/oa_cr_fix.ts b/proposals/dao/oa_cr_fix.ts index 7410d4592..48ac334cc 100644 --- a/proposals/dao/oa_cr_fix.ts +++ b/proposals/dao/oa_cr_fix.ts @@ -40,13 +40,13 @@ const deploy: DeployUpgradeFunc = async (deployAddress: string, addresses: Named // ensuring contracts have a specific state, etc. const setup: SetupUpgradeFunc = async (addresses, oldContracts, contracts, logging) => { console.log(`Setup of ${fipNumber} : reading CR oracle...`); - pcvStatsBefore = await contracts.collateralizationOracle.pcvStats(); - - const ethPrice = (await contracts.chainlinkEthUsdOracleWrapper.read())[0].toString() / 1e10; // make sure oracle of B.AMM is fresh // set Chainlink ETHUSD to a fixed 3,000$ value + const ethPrice = (await contracts.chainlinkEthUsdOracleWrapper.read())[0].toString() / 1e10; await overwriteChainlinkAggregator(addresses.chainlinkEthUsdOracle, Math.round(ethPrice), '8'); + + pcvStatsBefore = await contracts.collateralizationOracle.pcvStats(); }; // Tears down any changes made in setup() that need to be From 62fdc24ea1fee9987080e6cb7c31e2a2c63e5997 Mon Sep 17 00:00:00 2001 From: Erwan Beauvois Date: Fri, 6 May 2022 17:46:11 +0200 Subject: [PATCH 005/274] update dependencies file --- proposals/dao/oa_cr_fix.ts | 7 ++-- .../collateralizationOracle.ts | 15 +------ protocol-configuration/dependencies.ts | 41 +++++-------------- protocol-configuration/mainnetAddresses.ts | 18 ++++---- test/integration/proposals_config.ts | 13 +++++- test/integration/tests/dependencies.ts | 5 ++- 6 files changed, 41 insertions(+), 58 deletions(-) diff --git a/proposals/dao/oa_cr_fix.ts b/proposals/dao/oa_cr_fix.ts index 48ac334cc..cf8a64958 100644 --- a/proposals/dao/oa_cr_fix.ts +++ b/proposals/dao/oa_cr_fix.ts @@ -41,11 +41,12 @@ const deploy: DeployUpgradeFunc = async (deployAddress: string, addresses: Named const setup: SetupUpgradeFunc = async (addresses, oldContracts, contracts, logging) => { console.log(`Setup of ${fipNumber} : reading CR oracle...`); - // make sure oracle of B.AMM is fresh - // set Chainlink ETHUSD to a fixed 3,000$ value + // make sure ETH oracle is fresh (for B.AMM not to revert, etc) + // Read Chainlink ETHUSD price & override chainlink storage to make it a fresh value const ethPrice = (await contracts.chainlinkEthUsdOracleWrapper.read())[0].toString() / 1e10; await overwriteChainlinkAggregator(addresses.chainlinkEthUsdOracle, Math.round(ethPrice), '8'); + // read pcvStats pcvStatsBefore = await contracts.collateralizationOracle.pcvStats(); }; @@ -101,7 +102,7 @@ const validate: ValidateUpgradeFunc = async (addresses, oldContracts, contracts, expect(resistantFei).to.be.at.least(17e6); expect(resistantFei).to.be.at.most(20e6); - // Check pcvStats + // display pcvStats console.log('----------------------------------------------------'); console.log(' pcvStatsBefore.protocolControlledValue [M]e18 ', pcvStatsBefore.protocolControlledValue / 1e24); console.log(' pcvStatsBefore.userCirculatingFei [M]e18 ', pcvStatsBefore.userCirculatingFei / 1e24); diff --git a/protocol-configuration/collateralizationOracle.ts b/protocol-configuration/collateralizationOracle.ts index 04a1eef3f..b1f93bb8a 100644 --- a/protocol-configuration/collateralizationOracle.ts +++ b/protocol-configuration/collateralizationOracle.ts @@ -1,13 +1,10 @@ const collateralizationAddresses = { fei: [ 'feiOATimelockWrapper', - 'rariPool8FeiPCVDepositWrapper', 'rariPool6FeiPCVDepositWrapper', 'rariPool19FeiPCVDepositWrapper', 'rariPool24FeiPCVDepositWrapper', 'rariPool25FeiPCVDepositWrapper', - 'rariPool27FeiPCVDepositWrapper', - 'rariPool18FeiPCVDepositWrapper', 'rariPool90FeiPCVDepositWrapper', 'aaveFeiPCVDepositWrapper', 'rariPool79FeiPCVDepositWrapper', @@ -16,18 +13,11 @@ const collateralizationAddresses = { 'rariPool128FeiPCVDepositWrapper', 'rariPool22FeiPCVDepositWrapper', 'feiBuybackLensNoFee', - 'convexPoolPCVDepositWrapper', 'compoundPCVDepositWrapper', 'turboFusePCVDeposit' ], - lusd: [ - 'liquityFusePoolLusdPCVDeposit', - 'rariPool7LusdPCVDeposit', - 'bammDeposit', - 'lusdPSM', - 'rariPool8LusdPCVDeposit' - ], - dai: ['compoundDaiPCVDepositWrapper', 'daiFixedPricePSM', 'rariPool8DaiPCVDeposit'], + lusd: ['liquityFusePoolLusdPCVDeposit', 'rariPool7LusdPCVDeposit', 'bammDeposit', 'lusdPSM'], + dai: ['compoundDaiPCVDepositWrapper', 'daiFixedPricePSM'], usd: ['namedStaticPCVDepositWrapper', 'd3poolCurvePCVDeposit', 'd3poolConvexPCVDeposit'], bal: ['balancerDepositBalWeth', 'balancerLensVeBalBal'], cream: ['creamDepositWrapper'], @@ -38,7 +28,6 @@ const collateralizationAddresses = { 'uniswapPCVDeposit', 'ethTokemakPCVDeposit', 'ethPSM', - 'rariPool146EthPCVDeposit', 'wethDepositWrapper', 'balancerDepositFeiWeth', 'balancerLensBpt30Fei70WethFixed', diff --git a/protocol-configuration/dependencies.ts b/protocol-configuration/dependencies.ts index 95e70277b..3b8ff9669 100644 --- a/protocol-configuration/dependencies.ts +++ b/protocol-configuration/dependencies.ts @@ -73,7 +73,6 @@ const dependencies: DependencyMap = { 'liquityFusePoolLusdPCVDeposit', 'poolPartyFeiPCVDeposit', 'rariTimelock', - 'rariPool146EthPCVDeposit', 'rariPool18FeiPCVDeposit', 'rariPool19DpiPCVDeposit', 'rariPool19FeiPCVDeposit', @@ -405,9 +404,6 @@ const dependencies: DependencyMap = { poolPartyFeiPCVDeposit: { contractDependencies: ['core', 'fei'] }, - rariPool146EthPCVDeposit: { - contractDependencies: ['core', 'rariPool146Eth'] - }, rariPool146Comptroller: { contractDependencies: ['rariPool146FuseAdmin', 'rariPool146Eth'] }, @@ -415,7 +411,7 @@ const dependencies: DependencyMap = { contractDependencies: ['rariPool146Comptroller'] }, rariPool146Eth: { - contractDependencies: ['rariPool146Comptroller', 'rariPool146EthPCVDeposit'] + contractDependencies: ['rariPool146Comptroller'] }, rariPool18FeiPCVDeposit: { contractDependencies: ['core', 'fei'] @@ -523,23 +519,18 @@ const dependencies: DependencyMap = { 'feiBuybackLens', 'feiLusdLens', 'feiOATimelockWrapper', - 'rariPool18FeiPCVDepositWrapper', 'rariPool19DpiPCVDepositWrapper', 'rariPool19FeiPCVDepositWrapper', 'rariPool24FeiPCVDepositWrapper', 'rariPool25FeiPCVDepositWrapper', - 'rariPool27FeiPCVDepositWrapper', 'rariPool31FeiPCVDepositWrapper', 'rariPool6FeiPCVDepositWrapper', - 'rariPool8FeiPCVDepositWrapper', 'rariPool9RaiPCVDepositWrapper', 'rariPool90FeiPCVDepositWrapper', 'rariPool79FeiPCVDepositWrapper', 'rariPool72FeiPCVDepositWrapper', 'rariPool128FeiPCVDepositWrapper', 'rariPool22FeiPCVDepositWrapper', - 'rariPool8LusdPCVDeposit', - 'rariPool8DaiPCVDeposit', 'voltFusePCVDeposit', 'voltOracle', 'turboFusePCVDeposit', @@ -594,9 +585,6 @@ const dependencies: DependencyMap = { feiOATimelockWrapper: { contractDependencies: ['collateralizationOracle'] }, - rariPool18FeiPCVDepositWrapper: { - contractDependencies: ['collateralizationOracle'] - }, rariPool19DpiPCVDepositWrapper: { contractDependencies: ['collateralizationOracle'] }, @@ -609,9 +597,6 @@ const dependencies: DependencyMap = { rariPool25FeiPCVDepositWrapper: { contractDependencies: ['collateralizationOracle'] }, - rariPool27FeiPCVDepositWrapper: { - contractDependencies: ['collateralizationOracle'] - }, rariPool31FeiPCVDepositWrapper: { contractDependencies: ['collateralizationOracle', 'rariPool31FeiPCVDeposit'] }, @@ -636,9 +621,6 @@ const dependencies: DependencyMap = { rariPool22FeiPCVDepositWrapper: { contractDependencies: ['collateralizationOracle', 'rariPool22FeiPCVDeposit'] }, - rariPool8FeiPCVDepositWrapper: { - contractDependencies: ['collateralizationOracle'] - }, rariPool9RaiPCVDepositWrapper: { contractDependencies: ['collateralizationOracle'] }, @@ -684,7 +666,7 @@ const dependencies: DependencyMap = { 'uniswapPCVDeposit', 'balancerDepositBalWeth', 'balancerDepositFeiWeth', - 'balancerLensBpt30Fei70Weth', + 'balancerLensBpt30Fei70WethFixed', 'balancerLensVeBalBal', 'balancerLensVeBalWeth' ] @@ -725,7 +707,12 @@ const dependencies: DependencyMap = { contractDependencies: ['core', 'chainlinkEthUsdOracleWrapper', 'chainlinkCREAMEthOracle', 'collateralizationOracle'] }, oneConstantOracle: { - contractDependencies: ['core', 'collateralizationOracle', 'balancerDepositFeiWeth', 'balancerLensBpt30Fei70Weth'] + contractDependencies: [ + 'core', + 'collateralizationOracle', + 'balancerDepositFeiWeth', + 'balancerLensBpt30Fei70WethFixed' + ] }, tribeUsdCompositeOracle: { contractDependencies: [ @@ -928,7 +915,7 @@ const dependencies: DependencyMap = { contractDependencies: ['rariPool8MasterOracle'] }, rariPool8Dai: { - contractDependencies: ['rariPool8Comptroller', 'rariPool8DaiIrm', 'rariPool8DaiPCVDeposit'] + contractDependencies: ['rariPool8Comptroller', 'rariPool8DaiIrm'] }, rariPool8DaiIrm: { contractDependencies: ['rariPool8Dai'] @@ -1008,14 +995,8 @@ const dependencies: DependencyMap = { delayedPCVMoverWethUniToBal: { contractDependencies: ['core', 'ratioPCVControllerV2'] }, - rariPool8DaiPCVDeposit: { - contractDependencies: ['rariPool8Dai', 'collateralizationOracle'] - }, - rariPool8LusdPCVDeposit: { - contractDependencies: ['rariPool8Lusd', 'collateralizationOracle'] - }, rariPool8Lusd: { - contractDependencies: ['rariPool8LusdPCVDeposit', 'rariPool8Comptroller'] + contractDependencies: ['rariPool8Comptroller'] }, timelock: { contractDependencies: ['feiDAOTimelock'] @@ -1068,7 +1049,7 @@ const dependencies: DependencyMap = { balancerLensVeBalWeth: { contractDependencies: ['balUsdCompositeOracle', 'chainlinkEthUsdOracleWrapper'] }, - balancerLensBpt30Fei70Weth: { + balancerLensBpt30Fei70WethFixed: { contractDependencies: ['oneConstantOracle', 'chainlinkEthUsdOracleWrapper'] }, pcvGuardian: { diff --git a/protocol-configuration/mainnetAddresses.ts b/protocol-configuration/mainnetAddresses.ts index d0962effb..aa1d575f8 100644 --- a/protocol-configuration/mainnetAddresses.ts +++ b/protocol-configuration/mainnetAddresses.ts @@ -224,7 +224,7 @@ const MainnetAddresses: MainnetAddresses = { rariPool18FeiPCVDeposit: { artifactName: 'ERC20CompoundPCVDeposit', address: '0x5A8CB4556e5D5935Af06beab8292905f48131479', - category: AddressCategory.PCV_V1 + category: AddressCategory.Deprecated }, rariPool22FeiPCVDeposit: { artifactName: 'ERC20CompoundPCVDeposit', @@ -249,7 +249,7 @@ const MainnetAddresses: MainnetAddresses = { rariPool27FeiPCVDeposit: { artifactName: 'ERC20CompoundPCVDeposit', address: '0x91f50E3183a8CC30D2A981C3aFA85A2Bf6691c67', - category: AddressCategory.PCV_V1 + category: AddressCategory.Deprecated }, rariPool128FeiPCVDeposit: { artifactName: 'ERC20CompoundPCVDeposit', @@ -504,22 +504,22 @@ const MainnetAddresses: MainnetAddresses = { rariPool146EthPCVDeposit: { artifactName: 'EthCompoundPCVDeposit', address: '0xC68412B72e68c30D4E6c0854b439CBBe957146e4', - category: AddressCategory.PCV + category: AddressCategory.Deprecated }, rariPool8DaiPCVDeposit: { artifactName: 'ERC20CompoundPCVDeposit', address: '0x9CC46aB5A714f7cd24C59f33C5769039B5872491', - category: AddressCategory.PCV + category: AddressCategory.Deprecated }, rariPool8LusdPCVDeposit: { artifactName: 'ERC20CompoundPCVDeposit', address: '0xF846eE6E8EE9A6fbf51c7c65105CAbc041c048ad', - category: AddressCategory.PCV + category: AddressCategory.Deprecated }, rariPool18FeiPCVDepositWrapper: { artifactName: 'PCVDepositWrapper', address: '0x07F2DD7E6A78D96c08D0a8212f4097dCC129d629', - category: AddressCategory.PCV + category: AddressCategory.Deprecated }, rariPool19DpiPCVDepositWrapper: { artifactName: 'PCVDepositWrapper', @@ -549,7 +549,7 @@ const MainnetAddresses: MainnetAddresses = { rariPool27FeiPCVDepositWrapper: { artifactName: 'PCVDepositWrapper', address: '0xe2e35097638F0Ff2EeCA2EF70F352Be37431945f', - category: AddressCategory.PCV + category: AddressCategory.Deprecated }, rariPool6FeiPCVDepositWrapper: { artifactName: 'PCVDepositWrapper', @@ -564,7 +564,7 @@ const MainnetAddresses: MainnetAddresses = { rariPool8FeiPCVDepositWrapper: { artifactName: 'PCVDepositWrapper', address: '0xD6598a23418c7FEf7c0Dc863265515B623B720F9', - category: AddressCategory.PCV + category: AddressCategory.Deprecated }, rariPool9FeiPCVDepositWrapper: { artifactName: 'PCVDepositWrapper', @@ -1979,7 +1979,7 @@ const MainnetAddresses: MainnetAddresses = { convexPoolPCVDepositWrapper: { artifactName: 'PCVDepositWrapper', address: '0x1370CA8655C255948d6c6110066d78680601B7c2', - category: AddressCategory.PCV + category: AddressCategory.Deprecated }, compoundPCVDepositWrapper: { artifactName: 'PCVDepositWrapper', diff --git a/test/integration/proposals_config.ts b/test/integration/proposals_config.ts index 2c6b81452..e3988c24e 100644 --- a/test/integration/proposals_config.ts +++ b/test/integration/proposals_config.ts @@ -52,8 +52,17 @@ const proposals: ProposalsConfigMap = { totalValue: 0, // amount of ETH to send to DAO execution proposal: oa_cr_fix, // full proposal file, imported from '@proposals/description/fip_xx.ts' proposalId: '', - affectedContractSignoff: [], - deprecatedContractSignoff: [], + affectedContractSignoff: ['collateralizationOracle', 'balancerLensBpt30Fei70WethFixed'], + deprecatedContractSignoff: [ + 'balancerLensBpt30Fei70Weth', + 'rariPool8FeiPCVDepositWrapper', + 'rariPool8DaiPCVDeposit', + 'rariPool8LusdPCVDeposit', + 'rariPool18FeiPCVDepositWrapper', + 'rariPool27FeiPCVDepositWrapper', + 'rariPool146EthPCVDeposit', + 'convexPoolPCVDepositWrapper' + ], category: ProposalCategory.OA } }; diff --git a/test/integration/tests/dependencies.ts b/test/integration/tests/dependencies.ts index bfced5e5a..ce25a9cd3 100644 --- a/test/integration/tests/dependencies.ts +++ b/test/integration/tests/dependencies.ts @@ -112,7 +112,10 @@ describe('e2e-dependencies', function () { // addresses[deposit] may be undefined if a deposit is added to the // dependencies and permissions/collateralizationOracle files, but // is not yet deployed on the mainnet (i.e. in mainnetAddresses.ts). - expect(addresses[deposit].category).to.not.be.equal('Deprecated'); + expect(addresses[deposit].category).to.not.be.equal( + 'Deprecated', + 'Deposit [' + deposit + '] is in collateralizationoracle.ts and has AddressCategory.Deprecated' + ); } } } From 3985c2ff031f3b4224c9837ffa9ab88455cf3c22 Mon Sep 17 00:00:00 2001 From: thomas-waite Date: Sat, 7 May 2022 01:41:27 +0100 Subject: [PATCH 006/274] test: validate tribal council timelock can operate --- test/integration/tests/podOperation.ts | 54 ++++++++++++++++++++++++-- 1 file changed, 50 insertions(+), 4 deletions(-) diff --git a/test/integration/tests/podOperation.ts b/test/integration/tests/podOperation.ts index 2343038c5..2f310c785 100644 --- a/test/integration/tests/podOperation.ts +++ b/test/integration/tests/podOperation.ts @@ -5,13 +5,14 @@ import CBN from 'chai-bn'; import { solidity } from 'ethereum-waffle'; import { ethers } from 'hardhat'; import { NamedAddresses, NamedContracts } from '@custom-types/types'; -import { getImpersonatedSigner, resetFork, time, initialiseGnosisSDK } from '@test/helpers'; +import { getImpersonatedSigner, time, initialiseGnosisSDK } from '@test/helpers'; import proposals from '@test/integration/proposals_config'; import { forceEth } from '@test/integration/setup/utils'; import { TestEndtoEndCoordinator } from '../setup'; import { BigNumberish, Contract } from 'ethers'; import { abi as timelockABI } from '../../../artifacts/@openzeppelin/contracts/governance/TimelockController.sol/TimelockController.json'; -import { MIN_TIMELOCK_DELAY } from '@protocol/optimisticGovernance'; +import { MIN_TIMELOCK_DELAY, tribeCouncilPodConfig } from '@protocol/optimisticGovernance'; +import Safe from '@gnosis.pm/safe-core-sdk'; function createSafeTxArgs(timelock: Contract, functionSig: string, args: any[]) { return { @@ -33,8 +34,7 @@ describe('Pod operation and veto', function () { let timelockAddress: string; let podTimelock: Contract; let registryTxData: string; - let registryTxData2: string; - let safeSDK: any; + let safeSDK: Safe; const proposalId = '1234'; const proposalMetadata = 'FIP_XX: This tests that the governance upgrade flow works'; @@ -224,4 +224,50 @@ describe('Pod operation and veto', function () { const readyTimestamp = await podTimelock.getTimestamp(timelockProposalId); expect(readyTimestamp).to.equal(0); }); + + it('should allow TribalCouncil to operate on the protocol', async () => { + // 1. Get Gnosis SDK connections for each TC member + const tribalCouncilTimelock = contracts.tribalCouncilTimelock; + const tribalCouncilSafeSigner = await getImpersonatedSigner(contractAddresses.tribalCouncilSafe); + await forceEth(tribalCouncilTimelock.address); + await forceEth(contractAddresses.tribalCouncilSafe); + + const tribalCouncilMinDelay = await tribalCouncilTimelock.getMinDelay(); + expect(tribalCouncilMinDelay).to.be.equal(tribeCouncilPodConfig.minDelay); + + // 2. Prepare a proposal which requires a TribeRole. TribalCouncil timelock should have been granted + // ROLE_ADMIN and be able to call into RoleBastion to create a role + const dummyRole = ethers.utils.id('DUMMY_ROLE'); + const registryTCData = contracts.roleBastion.interface.encodeFunctionData('createRole', [dummyRole]); + await tribalCouncilTimelock + .connect(tribalCouncilSafeSigner) + .schedule( + contractAddresses.roleBastion, + 0, + registryTCData, + '0x0000000000000000000000000000000000000000000000000000000000000000', + '0x0000000000000000000000000000000000000000000000000000000000000001', + tribeCouncilPodConfig.minDelay + ); + + // 5. Execute timelocked transaction - need to call via the podExecutor + // Fast forward time on timelock + await time.increase(tribeCouncilPodConfig.minDelay); + + const podExecutor = contracts.podExecutor; + const executeTx = await podExecutor.execute( + tribalCouncilTimelock.address, + contractAddresses.roleBastion, + 0, + registryTCData, + '0x0000000000000000000000000000000000000000000000000000000000000000', + '0x0000000000000000000000000000000000000000000000000000000000000001' + ); + await executeTx.wait(); + console.log('pod executor has executed'); + + // 6.0 Validate that the expected role was created in core, should have a ROLE_ADMIN admin + const dummyRoleAdmin = await contracts.core.getRoleAdmin(dummyRole); + expect(dummyRoleAdmin).to.be.equal(ethers.utils.id('ROLE_ADMIN')); + }); }); From d0ae2bfa4508784f6ec23ecb8e9daf2c0ed50d0e Mon Sep 17 00:00:00 2001 From: thomas-waite Date: Sat, 7 May 2022 02:23:05 +0100 Subject: [PATCH 007/274] test: break out pod operation solidity tests --- .../integration/governance/PodFactory.t.sol | 57 +-------- .../integration/governance/PodOperation.t.sol | 110 ++++++++++++++++++ .../test/unit/governance/PodExecutor.t.sol | 2 +- package.json | 2 +- test/integration/tests/podOperation.ts | 1 - 5 files changed, 113 insertions(+), 59 deletions(-) create mode 100644 contracts/test/integration/governance/PodOperation.t.sol diff --git a/contracts/test/integration/governance/PodFactory.t.sol b/contracts/test/integration/governance/PodFactory.t.sol index d4fced083..3d83f70d8 100644 --- a/contracts/test/integration/governance/PodFactory.t.sol +++ b/contracts/test/integration/governance/PodFactory.t.sol @@ -18,8 +18,7 @@ import {DummyStorage} from "../../utils/Fixtures.sol"; import {Vm} from "../../utils/Vm.sol"; import {MainnetAddresses} from "../fixtures/MainnetAddresses.sol"; -/// @notice Validate PodFactory critical functionality such as creating pods -/// @dev PodAdmin can not also be a pod member +/// @notice Validate PodFactory functionality, such as creating pods contract PodFactoryIntegrationTest is DSTest { Vm public constant vm = Vm(HEVM_ADDRESS); @@ -276,60 +275,6 @@ contract PodFactoryIntegrationTest is DSTest { assertEq(podBAdmin, podAdmin); } - /// @notice Validate that can create a transaction in the pod and that it progresses to the timelock - function testCreateTxInOptimisticPod() public { - vm.warp(1); - vm.roll(1); - - // 1. Deploy Dummy contract to perform a transaction on - DummyStorage dummyContract = new DummyStorage(); - assertEq(dummyContract.getVariable(), 5); - - // 2. Deploy pod - IPodFactory.PodConfig memory podConfig = getPodParamsWithTimelock(podAdmin); - vm.prank(feiDAOTimelock); - (, address podTimelock, address safe) = factory.createOptimisticPod(podConfig); - - TimelockController timelockContract = TimelockController(payable(podTimelock)); - - // 3. Schedle a transaction from the Pod's safe address to timelock. Transaction sets a variable on a dummy contract - uint256 newDummyContractVar = 10; - bytes memory timelockExecutionTxData = abi.encodePacked( - bytes4(keccak256(bytes("setVariable(uint256)"))), - newDummyContractVar - ); - - vm.prank(safe); - timelockContract.schedule( - address(dummyContract), - 0, - timelockExecutionTxData, - bytes32(0), - bytes32("1"), - podConfig.minDelay - ); - - // 4. Validate that transaction is in timelock - bytes32 txHash = timelockContract.hashOperation( - address(dummyContract), - 0, - timelockExecutionTxData, - bytes32(0), - bytes32("1") - ); - assertTrue(timelockContract.isOperationPending(txHash)); - - // 5. Fast forward to execution time in timelock - vm.warp(podConfig.minDelay + 10); - vm.roll(podConfig.minDelay + 10); - - // 6. Execute transaction and validate state is updated - podExecutor.execute(podTimelock, address(dummyContract), 0, timelockExecutionTxData, bytes32(0), bytes32("1")); - - assertTrue(timelockContract.isOperationDone(txHash)); - assertEq(dummyContract.getVariable(), newDummyContractVar); - } - /// @notice Validate that the default pod controller can be updated function testUpdateDefaultPodController() public { address newDefaultPodController = address(0x123); diff --git a/contracts/test/integration/governance/PodOperation.t.sol b/contracts/test/integration/governance/PodOperation.t.sol new file mode 100644 index 000000000..52bad4d3e --- /dev/null +++ b/contracts/test/integration/governance/PodOperation.t.sol @@ -0,0 +1,110 @@ +// SPDX-License-Identifier: GPL-3.0-or-later +pragma solidity ^0.8.0; + +import {TimelockController} from "@openzeppelin/contracts/governance/TimelockController.sol"; +import {ControllerV1} from "@orcaprotocol/contracts/contracts/ControllerV1.sol"; +import {MemberToken} from "@orcaprotocol/contracts/contracts/MemberToken.sol"; +import {IGnosisSafe} from "../../../pods/interfaces/IGnosisSafe.sol"; +import {PodFactory} from "../../../pods/PodFactory.sol"; +import {PodExecutor} from "../../../pods/PodExecutor.sol"; +import {IPodFactory} from "../../../pods/interfaces/IPodFactory.sol"; +import {Core} from "../../../core/Core.sol"; +import {TribeRoles} from "../../../core/TribeRoles.sol"; +import {PodAdminGateway} from "../../../pods/PodAdminGateway.sol"; + +import {DSTest} from "../../utils/DSTest.sol"; +import {mintOrcaTokens, getPodParamsWithTimelock, getCouncilPodParams, getPodParamsWithNoTimelock} from "../fixtures/Orca.sol"; +import {DummyStorage} from "../../utils/Fixtures.sol"; +import {Vm} from "../../utils/Vm.sol"; +import {MainnetAddresses} from "../fixtures/MainnetAddresses.sol"; + +/// @notice Validate full pod operation including scheduling a transaction in the timelock and having the +/// podExecutor execute it +contract PodOperationIntegrationTest is DSTest { + Vm public constant vm = Vm(HEVM_ADDRESS); + + DummyStorage dummyContract; + TimelockController timelockContract; + IPodFactory.PodConfig podConfig; + PodExecutor podExecutor; + + address feiDAOTimelock = MainnetAddresses.FEI_DAO_TIMELOCK; + address core = MainnetAddresses.CORE; + address memberToken = MainnetAddresses.MEMBER_TOKEN; + address podController = MainnetAddresses.ORCA_POD_CONTROLLER_V1_2; + + address podAdmin; + address safe; + address podTimelock; + + function setUp() public { + vm.warp(1); + vm.roll(1); + + // 1. Deploy Dummy contract to perform a transaction on + dummyContract = new DummyStorage(); + assertEq(dummyContract.getVariable(), 5); + + // 2. Deploy podExecutor + podExecutor = new PodExecutor(core); + + // 3. Deploy factory + PodFactory factory = new PodFactory(core, memberToken, podController, address(podExecutor)); + PodAdminGateway podAdminGateway = new PodAdminGateway(core, memberToken, address(factory)); + podAdmin = address(podAdminGateway); + + mintOrcaTokens(address(factory), 2, vm); + + // Grant factory the PodAdmin role, to by default disable pod membership transfers + vm.startPrank(feiDAOTimelock); + Core(core).createRole(TribeRoles.POD_ADMIN, TribeRoles.GOVERNOR); + Core(core).grantRole(TribeRoles.POD_ADMIN, address(factory)); + vm.stopPrank(); + + podConfig = getPodParamsWithTimelock(podAdmin); + vm.prank(feiDAOTimelock); + (, podTimelock, safe) = factory.createOptimisticPod(podConfig); + + timelockContract = TimelockController(payable(podTimelock)); + } + + /// @notice Validate that can create a transaction in the pod and that it progresses to the timelock + function testCreateAndExecutePodTransaction() public { + // Schedule a transaction from the Pod's safe address to timelock. Transaction sets a variable on a dummy contract + uint256 newDummyContractVar = 10; + bytes memory timelockExecutionTxData = abi.encodePacked( + bytes4(keccak256(bytes("setVariable(uint256)"))), + newDummyContractVar + ); + + vm.prank(safe); + timelockContract.schedule( + address(dummyContract), + 0, + timelockExecutionTxData, + bytes32(0), + bytes32("1"), + podConfig.minDelay + ); + + // 4. Validate that transaction is in timelock + bytes32 txHash = timelockContract.hashOperation( + address(dummyContract), + 0, + timelockExecutionTxData, + bytes32(0), + bytes32("1") + ); + assertTrue(timelockContract.isOperationPending(txHash)); + + // 5. Fast forward to execution time in timelock + vm.warp(podConfig.minDelay + 10); + vm.roll(podConfig.minDelay + 10); + + // 6. Execute transaction and validate state is updated + podExecutor.execute(podTimelock, address(dummyContract), 0, timelockExecutionTxData, bytes32(0), bytes32("1")); + + assertTrue(timelockContract.isOperationDone(txHash)); + assertEq(dummyContract.getVariable(), newDummyContractVar); + } +} diff --git a/contracts/test/unit/governance/PodExecutor.t.sol b/contracts/test/unit/governance/PodExecutor.t.sol index 0205cb0c5..7b37050c4 100644 --- a/contracts/test/unit/governance/PodExecutor.t.sol +++ b/contracts/test/unit/governance/PodExecutor.t.sol @@ -26,7 +26,7 @@ contract PodExecutorTest is DSTest { vm.stopPrank(); } - /// @notice Validate initial state of roleCreator + /// @notice Validate can pause execution function testCanPause() public { vm.prank(addresses.governorAddress); podExecutor.pause(); diff --git a/package.json b/package.json index 076b4170c..10bb33c02 100644 --- a/package.json +++ b/package.json @@ -14,7 +14,7 @@ "console:ropsten": "npx hardhat console --network ropsten", "clean": "forge clean && rm -rf artifacts", "test": "forge test --no-match-contract IntegrationTest", - "test:integration": "FORK_BLOCK=14516592; forge test --fork-url https://eth-mainnet.alchemyapi.io/v2/$MAINNET_ALCHEMY_API_KEY --fork-block-number $FORK_BLOCK --match-contract IntegrationTest", + "test:integration": "FORK_BLOCK=14726759; forge test --fork-url https://eth-mainnet.alchemyapi.io/v2/$MAINNET_ALCHEMY_API_KEY --fork-block-number $FORK_BLOCK --match-contract IntegrationTest", "test:integration:latest": "forge test --fork-url https://eth-mainnet.alchemyapi.io/v2/$MAINNET_ALCHEMY_API_KEY --match-contract IntegrationTest", "test:hardhat": "npx hardhat test", "test:hardhat:dependencies": "LOGGING=true NO_RESET=true npx hardhat test test/integration/tests/dependencies.ts", diff --git a/test/integration/tests/podOperation.ts b/test/integration/tests/podOperation.ts index 2f310c785..7e1be4d43 100644 --- a/test/integration/tests/podOperation.ts +++ b/test/integration/tests/podOperation.ts @@ -264,7 +264,6 @@ describe('Pod operation and veto', function () { '0x0000000000000000000000000000000000000000000000000000000000000001' ); await executeTx.wait(); - console.log('pod executor has executed'); // 6.0 Validate that the expected role was created in core, should have a ROLE_ADMIN admin const dummyRoleAdmin = await contracts.core.getRoleAdmin(dummyRole); From 3c289b864a28626cbb0eb191c60ccca62c70f739 Mon Sep 17 00:00:00 2001 From: thomas-waite Date: Sat, 7 May 2022 02:24:18 +0100 Subject: [PATCH 008/274] test: add batch execute pod test --- .../integration/governance/PodOperation.t.sol | 92 +++++++++++++++++++ 1 file changed, 92 insertions(+) diff --git a/contracts/test/integration/governance/PodOperation.t.sol b/contracts/test/integration/governance/PodOperation.t.sol index 52bad4d3e..524c77a9d 100644 --- a/contracts/test/integration/governance/PodOperation.t.sol +++ b/contracts/test/integration/governance/PodOperation.t.sol @@ -107,4 +107,96 @@ contract PodOperationIntegrationTest is DSTest { assertTrue(timelockContract.isOperationDone(txHash)); assertEq(dummyContract.getVariable(), newDummyContractVar); } + + /// @notice Validate that can batch execute transactions from a pod + function testBatchExecutePodTransactions() public { + // Schedule a transaction from the Pod's safe address to timelock. Transaction sets a variable on a dummy contract + uint256 newDummyContractVarA = 10; + bytes memory timelockExecutionTxDataA = abi.encodePacked( + bytes4(keccak256(bytes("setVariable(uint256)"))), + newDummyContractVarA + ); + + vm.prank(safe); + timelockContract.schedule( + address(dummyContract), + 0, + timelockExecutionTxDataA, + bytes32(0), + bytes32("1"), + podConfig.minDelay + ); + + uint256 newDummyContractVarB = 20; + bytes memory timelockExecutionTxDataB = abi.encodePacked( + bytes4(keccak256(bytes("setVariable(uint256)"))), + newDummyContractVarB + ); + + vm.prank(safe); + timelockContract.schedule( + address(dummyContract), + 0, + timelockExecutionTxDataB, + bytes32(0), + bytes32("1"), + podConfig.minDelay + ); + + // 4. Validate that transaction is in timelock + bytes32 txHashA = timelockContract.hashOperation( + address(dummyContract), + 0, + timelockExecutionTxDataA, + bytes32(0), + bytes32("1") + ); + assertTrue(timelockContract.isOperationPending(txHashA)); + + bytes32 txHashB = timelockContract.hashOperation( + address(dummyContract), + 0, + timelockExecutionTxDataB, + bytes32(0), + bytes32("1") + ); + assertTrue(timelockContract.isOperationPending(txHashB)); + + // 5. Fast forward to execution time in timelock + vm.warp(podConfig.minDelay + 10); + vm.roll(podConfig.minDelay + 10); + + // 6. Execute transaction and validate state is updated + address[] memory timelocks = new address[](2); + timelocks[0] = podTimelock; + timelocks[1] = podTimelock; + + address[] memory targets = new address[](2); + targets[0] = address(dummyContract); + targets[1] = address(dummyContract); + + uint256[] memory values = new uint256[](2); + values[0] = 0; + values[1] = 0; + + bytes[] memory txDatas = new bytes[](2); + txDatas[0] = timelockExecutionTxDataA; + txDatas[1] = timelockExecutionTxDataB; + + bytes32[] memory predecessors = new bytes32[](2); + predecessors[0] = bytes32(0); + predecessors[1] = bytes32(0); + + bytes32[] memory salts = new bytes32[](2); + salts[0] = bytes32("1"); + salts[1] = bytes32("1"); + + podExecutor.executeBatch(timelocks, targets, values, txDatas, predecessors, salts); + + assertTrue(timelockContract.isOperationDone(txHashA)); + assertTrue(timelockContract.isOperationDone(txHashB)); + + // Final updated value should be dummy value B + assertEq(dummyContract.getVariable(), newDummyContractVarB); + } } From 6541ad120fb1c4ef15c6bd36746d3f3f4fa1f564 Mon Sep 17 00:00:00 2001 From: thomas-waite Date: Mon, 9 May 2022 11:37:11 +0100 Subject: [PATCH 009/274] deps: deprecate old PCVGuardian --- protocol-configuration/mainnetAddresses.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/protocol-configuration/mainnetAddresses.ts b/protocol-configuration/mainnetAddresses.ts index fafa309eb..89b4d82f1 100644 --- a/protocol-configuration/mainnetAddresses.ts +++ b/protocol-configuration/mainnetAddresses.ts @@ -34,7 +34,7 @@ const MainnetAddresses: MainnetAddresses = { pcvGuardian: { artifactName: 'PCVGuardian', address: '0x2D1b1b509B6432A73e3d798572f0648f6453a5D9', - category: AddressCategory.Core + category: AddressCategory.Deprecated }, pcvGuardianNew: { artifactName: 'PCVGuardian', From 42a546fe5e74dcdbb04230420e8668ac8fbb8fda Mon Sep 17 00:00:00 2001 From: thomas-waite Date: Mon, 9 May 2022 12:09:48 +0100 Subject: [PATCH 010/274] refactor: remove pcvGuardian from deps --- protocol-configuration/dependencies.ts | 3 --- test/integration/proposals_config.ts | 32 -------------------------- 2 files changed, 35 deletions(-) diff --git a/protocol-configuration/dependencies.ts b/protocol-configuration/dependencies.ts index 95e70277b..b1ce07647 100644 --- a/protocol-configuration/dependencies.ts +++ b/protocol-configuration/dependencies.ts @@ -1070,9 +1070,6 @@ const dependencies: DependencyMap = { }, balancerLensBpt30Fei70Weth: { contractDependencies: ['oneConstantOracle', 'chainlinkEthUsdOracleWrapper'] - }, - pcvGuardian: { - contractDependencies: [] } }; diff --git a/test/integration/proposals_config.ts b/test/integration/proposals_config.ts index b20940e54..e825c3957 100644 --- a/test/integration/proposals_config.ts +++ b/test/integration/proposals_config.ts @@ -1,7 +1,5 @@ import { ProposalCategory, ProposalsConfigMap } from '@custom-types/types'; -import fip_82b from '@proposals/description/fip_82b'; - // import fip_xx_proposal from '@proposals/description/fip_xx'; const proposals: ProposalsConfigMap = { @@ -16,36 +14,6 @@ const proposals: ProposalsConfigMap = { category: ProposalCategory.DAO } */ - fip_82b: { - deploy: false, // deploy flag for whether to run deploy action during e2e tests or use mainnet state - totalValue: 0, // amount of ETH to send to DAO execution - proposal: fip_82b, - proposalId: '100114570810112501972314307970004446869175784368342294400079771147860837319881', - affectedContractSignoff: [ - 'core', - 'fuseGuardian', - 'optimisticMinter', - 'pcvEquityMinter', - 'indexDelegator', - 'ethTokemakPCVDeposit', - 'uniswapPCVDeposit', - 'lusdPSMFeiSkimmer', - 'ethPSMFeiSkimmer', - 'aaveEthPCVDripController', - 'daiPCVDripController', - 'lusdPCVDripController', - 'tribalCouncilTimelock', - 'feiDAOTimelock', - 'roleBastion', - 'pcvGuardianNew', - 'pcvGuardian', - 'opsOptimisticTimelock', - 'optimisticTimelock', - 'tribalChiefSyncV2' - ], - deprecatedContractSignoff: [], - category: ProposalCategory.DAO - } }; export default proposals; From 27a4c7a0a81217546072e2b6e6a7464a518fb9f0 Mon Sep 17 00:00:00 2001 From: thomas-waite Date: Mon, 9 May 2022 12:30:04 +0100 Subject: [PATCH 011/274] feat: add TribalCouncil proposal simulation tool --- ...roposal.ts => simulateTimelockProposal.ts} | 28 ++++++++++++++-- test/integration/setup/index.ts | 33 ++++++++++++------- types/types.ts | 6 +++- 3 files changed, 52 insertions(+), 15 deletions(-) rename scripts/utils/{simulateOAProposal.ts => simulateTimelockProposal.ts} (72%) diff --git a/scripts/utils/simulateOAProposal.ts b/scripts/utils/simulateTimelockProposal.ts similarity index 72% rename from scripts/utils/simulateOAProposal.ts rename to scripts/utils/simulateTimelockProposal.ts index b4c92abac..aa20d11be 100644 --- a/scripts/utils/simulateOAProposal.ts +++ b/scripts/utils/simulateTimelockProposal.ts @@ -5,15 +5,37 @@ import { OptimisticTimelock } from '@custom-types/contracts'; import { getImpersonatedSigner, time } from '@test/helpers'; import { Contract } from '@ethersproject/contracts'; -export default async function simulateOAProposal( +export async function simulateOAProposal( proposalInfo: ProposalDescription, contracts: MainnetContracts, contractAddresses: NamedAddresses, logging = false ) { - const timelock: OptimisticTimelock = contracts.optimisticTimelock as OptimisticTimelock; - const signer = await getImpersonatedSigner(contractAddresses.optimisticMultisig); + const timelockOA = contracts.optimisticTimelock as OptimisticTimelock; + const multisigAddressOA = contractAddresses.optimisticMultisig as string; + await simulateTimelockProposal(timelockOA, multisigAddressOA, proposalInfo, contracts, contractAddresses, logging); +} +export async function simulateTCProposal( + proposalInfo: ProposalDescription, + contracts: MainnetContracts, + contractAddresses: NamedAddresses, + logging = false +) { + const timelockTC = contracts.tribalCouncilTimelock as OptimisticTimelock; + const multisigAddressTC = contractAddresses.tribalCouncilSafe as string; + await simulateTimelockProposal(timelockTC, multisigAddressTC, proposalInfo, contracts, contractAddresses, logging); +} + +export async function simulateTimelockProposal( + timelock: OptimisticTimelock, + multisigAddress: string, + proposalInfo: ProposalDescription, + contracts: MainnetContracts, + contractAddresses: NamedAddresses, + logging = false +) { + const signer = await getImpersonatedSigner(multisigAddress); logging && console.log(`Constructing proposal ${proposalInfo.title}`); const salt = ethers.utils.id(proposalInfo.title); diff --git a/test/integration/setup/index.ts b/test/integration/setup/index.ts index ee1e8bb31..e3d7efcb5 100644 --- a/test/integration/setup/index.ts +++ b/test/integration/setup/index.ts @@ -21,7 +21,8 @@ import { sudo } from '@scripts/utils/sudo'; import constructProposal from '@scripts/utils/constructProposal'; import '@nomiclabs/hardhat-ethers'; import { resetFork } from '@test/helpers'; -import simulateOAProposal from '@scripts/utils/simulateOAProposal'; +import { simulateOAProposal } from '@scripts/utils/simulateTimelockProposal'; +import { simulateTCProposal } from '@scripts/utils/simulateTimelockProposal'; import { forceEth } from '@test/integration/setup/utils'; import { getImpersonatedSigner } from '@test/helpers'; @@ -159,6 +160,26 @@ export class TestEndtoEndCoordinator implements TestCoordinator { await proposal.simulate(); } + if (config.category === ProposalCategory.TC) { + this.config.logging && console.log(`Simulating Tribal Council proposal...`); + await simulateTCProposal( + config.proposal, + contracts as unknown as MainnetContracts, + contractAddresses, + this.config.logging + ); + } + + if (config.category === ProposalCategory.OA) { + this.config.logging && console.log(`Simulating OA proposal...`); + await simulateOAProposal( + config.proposal, + contracts as unknown as MainnetContracts, + contractAddresses, + this.config.logging + ); + } + if (config.category === ProposalCategory.DEBUG) { console.log('Simulating DAO proposal in DEBUG mode (step by step)...'); console.log(' Title: ', config.proposal.title); @@ -206,16 +227,6 @@ export class TestEndtoEndCoordinator implements TestCoordinator { console.log(' Done. Used', totalGasUsed, 'gas in total.'); } - if (config.category === ProposalCategory.OA) { - this.config.logging && console.log(`Simulating OA proposal...`); - await simulateOAProposal( - config.proposal, - contracts as unknown as MainnetContracts, - contractAddresses, - this.config.logging - ); - } - // teardown the DAO proposal this.config.logging && console.log(`Running proposal teardown...`); const teardownTyped = teardown as TeardownUpgradeFunc; diff --git a/types/types.ts b/types/types.ts index f0021d668..6d4b9d002 100644 --- a/types/types.ts +++ b/types/types.ts @@ -1,4 +1,4 @@ -import { Contract, ethers } from 'ethers'; +import { ethers } from 'ethers'; import { AavePCVDeposit, AutoRewardsDistributor, @@ -29,6 +29,7 @@ import { RewardsDistributorAdmin, StakingTokenWrapper, Timelock, + TimelockController, TribalChief, Tribe, TribeReserveStabilizer, @@ -64,6 +65,7 @@ export enum ProposalCategory { DAO, DEBUG, OA, + TC, // Tribal Council None } @@ -236,6 +238,7 @@ export interface MainnetContracts { autoRewardsDistributor: AutoRewardsDistributor; rewardsDistributorAdmin: RewardsDistributorAdmin; restrictedPermissions: RestrictedPermissions; + tribalCouncilTimelock: TimelockController; } export interface MainnetContractAddresses { @@ -270,6 +273,7 @@ export interface MainnetContractAddresses { stakingTokenWrapperRari: string; rariRewardsDistributorDelegator: string; restrictedPermissions: string; + tribalCouncilTimelock: string; } export type ContractAccessRights = { From 46781ad1d905e8d245ab3eecb885e6e8ad4364e7 Mon Sep 17 00:00:00 2001 From: thomas-waite Date: Mon, 9 May 2022 12:35:11 +0100 Subject: [PATCH 012/274] deps: update forking block number --- hardhat.config.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hardhat.config.ts b/hardhat.config.ts index 1831a6987..d746cc7d1 100644 --- a/hardhat.config.ts +++ b/hardhat.config.ts @@ -57,7 +57,7 @@ export default { forking: enableMainnetForking ? { url: `https://eth-mainnet.alchemyapi.io/v2/${mainnetAlchemyApiKey}`, - blockNumber: 14723389 // Friday, May 6th + blockNumber: 14742151 // Monday, May 9th } : undefined }, From c5478984c9bfc20697943ee41bb6b18489a7f5d4 Mon Sep 17 00:00:00 2001 From: thomas-waite Date: Mon, 9 May 2022 15:00:06 +0100 Subject: [PATCH 013/274] test: send more eth to timelock --- test/integration/tests/podOperation.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/test/integration/tests/podOperation.ts b/test/integration/tests/podOperation.ts index 7e1be4d43..97b2a02b6 100644 --- a/test/integration/tests/podOperation.ts +++ b/test/integration/tests/podOperation.ts @@ -68,6 +68,8 @@ describe('Pod operation and veto', function () { const podAdminGateway = contracts.podAdminGateway as PodAdminGateway; tribalCouncilTimelockSigner = await getImpersonatedSigner(contractAddresses.tribalCouncilTimelock); + await forceEth(contractAddresses.tribalCouncilTimelock); + await forceEth(contractAddresses.feiDAOTimelock); await forceEth(contractAddresses.tribalCouncilTimelock); await forceEth(contractAddresses.feiDAOTimelock); From 73ba60d3254a73c2c56ef56069bdb24862ec0687 Mon Sep 17 00:00:00 2001 From: Erwan Beauvois Date: Mon, 9 May 2022 17:16:20 +0200 Subject: [PATCH 014/274] use addresses.balancerFeiWethPool instead of hardcoded addr --- proposals/dao/oa_cr_fix.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/proposals/dao/oa_cr_fix.ts b/proposals/dao/oa_cr_fix.ts index cf8a64958..926c70597 100644 --- a/proposals/dao/oa_cr_fix.ts +++ b/proposals/dao/oa_cr_fix.ts @@ -21,7 +21,7 @@ const deploy: DeployUpgradeFunc = async (deployAddress: string, addresses: Named const balancerLensBpt30Fei70WethFixed = await balancerPool2LensFactory.deploy( addresses.gaugeLensBpt30Fei70WethGauge, // address _depositAddress addresses.wethERC20, // address _token - '0x90291319f1d4ea3ad4db0dd8fe9e12baf749e845', // IWeightedPool _pool + addresses.balancerFeiWethPool, // IWeightedPool _pool addresses.chainlinkEthUsdOracleWrapper, // IOracle _reportedOracle addresses.oneConstantOracle, // IOracle _otherOracle false, // bool _feiIsReportedIn From 8e95be4ed62ecbe6eede91ed5e1dc1c53047aad6 Mon Sep 17 00:00:00 2001 From: Erwan Beauvois Date: Mon, 9 May 2022 17:18:36 +0200 Subject: [PATCH 015/274] Add BalancerPool2Lens unit tests --- .../pcv/balancer/BalancerPool2Lens.test.ts | 115 ++++++++++++++++++ 1 file changed, 115 insertions(+) create mode 100644 test/unit/pcv/balancer/BalancerPool2Lens.test.ts diff --git a/test/unit/pcv/balancer/BalancerPool2Lens.test.ts b/test/unit/pcv/balancer/BalancerPool2Lens.test.ts new file mode 100644 index 000000000..b65261f4c --- /dev/null +++ b/test/unit/pcv/balancer/BalancerPool2Lens.test.ts @@ -0,0 +1,115 @@ +import { getAddresses, getImpersonatedSigner, getCore, expectApproxAbs } from '@test/helpers'; +import chai, { expect } from 'chai'; +import CBN from 'chai-bn'; +import { ethers } from 'hardhat'; +import { Signer } from 'ethers'; +import { + BalancerPool2Lens, + MockERC20, + MockOracle, + MockVault, + MockPCVDepositV2, + MockWeightedPool +} from '@custom-types/contracts'; + +before(async () => { + chai.use(CBN(ethers.BigNumber)); +}); + +const toBN = ethers.BigNumber.from; + +describe('BalancerPool2Lens', function () { + let userAddress: string; + let pool: MockWeightedPool; + let vault: MockVault; + let token: MockERC20; + let oracle1: MockOracle; + let oracle2: MockOracle; + let deposit: MockPCVDepositV2; + let lens: BalancerPool2Lens; + + const impersonatedSigners: { [key: string]: Signer } = {}; + + before(async () => { + const addresses = await getAddresses(); + + // add any addresses you want to impersonate here + const impersonatedAddresses = [addresses.userAddress]; + + for (const address of impersonatedAddresses) { + impersonatedSigners[address] = await getImpersonatedSigner(address); + } + }); + + beforeEach(async function () { + ({ userAddress } = await getAddresses()); + + token = await (await ethers.getContractFactory('MockERC20')).deploy(); + const tokenB = await (await ethers.getContractFactory('MockERC20')).deploy(); + + vault = await (await ethers.getContractFactory('MockVault')).deploy([token.address, tokenB.address], userAddress); + + await vault.setBalances([ethers.constants.WeiPerEther.mul(20), ethers.constants.WeiPerEther.mul(30000)]); + + pool = await ethers.getContractAt('MockWeightedPool', await vault._pool()); + + const core = await getCore(); + deposit = await ( + await ethers.getContractFactory('MockPCVDepositV2') + ).deploy( + core.address, + pool.address, + 10000, // deposit reports 10000 LP tokens + 0 + ); + + await pool.mint(pool.address, 89999); + await pool.mint(deposit.address, 10000); + + // set weights to 70%, 30% + await pool.updateWeightsGradually(0, 0, [ + ethers.constants.WeiPerEther.div(100).mul(70), + ethers.constants.WeiPerEther.div(100).mul(30) + ]); + await pool.mockSetNormalizedWeights([ + ethers.constants.WeiPerEther.div(100).mul(70), + ethers.constants.WeiPerEther.div(100).mul(30) + ]); + + oracle1 = await (await ethers.getContractFactory('MockOracle')).deploy('3500'); + oracle2 = await (await ethers.getContractFactory('MockOracle')).deploy('1'); + + lens = await ( + await ethers.getContractFactory('BalancerPool2Lens') + ).deploy(deposit.address, token.address, pool.address, oracle1.address, oracle2.address, false, true); + }); + + // pool contains 20 tokenA, 30,000 tokenB + // tokenA price 3,500 $, tokenB price 1 $ + // -> pool contains 70,000$, 30,000$ + // pool weight 70% tokenA, 30% tokenB (currently balanced) + // userAddress owns 10% of the pool (10,000 / 100,000) + + it('initial state', async function () { + expect(await lens.balanceReportedIn()).to.be.equal(token.address); + expect(await lens.pool()).to.be.equal(pool.address); + expect(await lens.balancerVault()).to.be.equal(vault.address); + expect(await lens.feiInPair()).to.be.true; + expect(await lens.feiIsReportedIn()).to.be.false; + expect(await lens.reportedOracle()).to.be.equal(oracle1.address); + expect(await lens.otherOracle()).to.be.equal(oracle2.address); + + expect(await pool.balanceOf(pool.address)).to.be.equal('90000'); + expect(await pool.balanceOf(deposit.address)).to.be.equal('10000'); + }); + + it('balance', async function () { + expectApproxAbs(await lens.balance(), ethers.constants.WeiPerEther.mul('2'), '1'); + }); + + it('resistantBalanceAndFei', async function () { + const balances = await lens.resistantBalanceAndFei(); + expectApproxAbs(balances[0], ethers.constants.WeiPerEther.mul('2'), '1'); + expectApproxAbs(balances[1], ethers.constants.WeiPerEther.mul('3000'), '1'); + }); +}); From 22b4c11edebd290e919ea11119af60a3ef71de42 Mon Sep 17 00:00:00 2001 From: thomas-waite Date: Mon, 9 May 2022 16:26:33 +0100 Subject: [PATCH 016/274] test: add nopeDAO and timelock signer sad path test --- test/integration/tests/podOperation.ts | 91 +++++++++++++++++++++++++- 1 file changed, 89 insertions(+), 2 deletions(-) diff --git a/test/integration/tests/podOperation.ts b/test/integration/tests/podOperation.ts index 97b2a02b6..3afc3862e 100644 --- a/test/integration/tests/podOperation.ts +++ b/test/integration/tests/podOperation.ts @@ -11,7 +11,7 @@ import { forceEth } from '@test/integration/setup/utils'; import { TestEndtoEndCoordinator } from '../setup'; import { BigNumberish, Contract } from 'ethers'; import { abi as timelockABI } from '../../../artifacts/@openzeppelin/contracts/governance/TimelockController.sol/TimelockController.json'; -import { MIN_TIMELOCK_DELAY, tribeCouncilPodConfig } from '@protocol/optimisticGovernance'; +import { MIN_TIMELOCK_DELAY, tribeCouncilPodConfig, TRIBAL_COUNCIL_POD_ID } from '@protocol/optimisticGovernance'; import Safe from '@gnosis.pm/safe-core-sdk'; function createSafeTxArgs(timelock: Contract, functionSig: string, args: any[]) { @@ -239,7 +239,7 @@ describe('Pod operation and veto', function () { // 2. Prepare a proposal which requires a TribeRole. TribalCouncil timelock should have been granted // ROLE_ADMIN and be able to call into RoleBastion to create a role - const dummyRole = ethers.utils.id('DUMMY_ROLE'); + const dummyRole = ethers.utils.id('DUMMY_2_ROLE'); const registryTCData = contracts.roleBastion.interface.encodeFunctionData('createRole', [dummyRole]); await tribalCouncilTimelock .connect(tribalCouncilSafeSigner) @@ -271,4 +271,91 @@ describe('Pod operation and veto', function () { const dummyRoleAdmin = await contracts.core.getRoleAdmin(dummyRole); expect(dummyRoleAdmin).to.be.equal(ethers.utils.id('ROLE_ADMIN')); }); + + it('should allow deployed NopeDAO to veto a TribalCouncil proposal', async () => { + // 1. Get Gnosis SDK connections for each TC member + const tribalCouncilTimelock = contracts.tribalCouncilTimelock; + const tribalCouncilSafeSigner = await getImpersonatedSigner(contractAddresses.tribalCouncilSafe); + await forceEth(tribalCouncilTimelock.address); + await forceEth(contractAddresses.tribalCouncilSafe); + + const tribalCouncilMinDelay = await tribalCouncilTimelock.getMinDelay(); + expect(tribalCouncilMinDelay).to.be.equal(tribeCouncilPodConfig.minDelay); + + // 2. Prepare a proposal which requires a TribeRole. TribalCouncil timelock should have been granted + // ROLE_ADMIN and be able to call into RoleBastion to create a role + const dummyRole = ethers.utils.id('DUMMY_ROLE'); + const roleCreationData = contracts.roleBastion.interface.encodeFunctionData('createRole', [dummyRole]); + await tribalCouncilTimelock + .connect(tribalCouncilSafeSigner) + .schedule( + contractAddresses.roleBastion, + 0, + roleCreationData, + '0x0000000000000000000000000000000000000000000000000000000000000000', + '0x0000000000000000000000000000000000000000000000000000000000000001', + tribeCouncilPodConfig.minDelay + ); + + // 3. Create NopeDAO proposal to veto the timelocked transaction + const userWithTribe = await getImpersonatedSigner(contractAddresses.multisig); + const timelockProposalId = await tribalCouncilTimelock.hashOperation( + contractAddresses.roleBastion, + 0, + roleCreationData, + '0x0000000000000000000000000000000000000000000000000000000000000000', + '0x0000000000000000000000000000000000000000000000000000000000000001' + ); + + // User proposes on NopeDAO + const nopeDAO = contracts.nopeDAO; + const description = 'Veto proposal'; + const calldatas = [ + contracts.podAdminGateway.interface.encodeFunctionData('veto', [TRIBAL_COUNCIL_POD_ID, timelockProposalId]) + ]; + const targets = [contractAddresses.podAdminGateway]; + const values = [0]; + + const proposeTx = await nopeDAO.propose(targets, values, calldatas, description); + const { args } = (await proposeTx.wait()).events.find((elem) => elem.event === 'ProposalCreated'); + const nopeDAOProposalId = args.proposalId; + + // Use the proposalID to vote for this proposal on the nopeDAO + await nopeDAO.connect(userWithTribe).castVote(nopeDAOProposalId, 1); + + const descriptionHash = ethers.utils.id(description); + await nopeDAO.execute(targets, values, calldatas, descriptionHash); + + // Validate proposal was nope'd + const readyTimestamp = await tribalCouncilTimelock.getTimestamp(timelockProposalId); + expect(readyTimestamp).to.equal(0); + }); + + it('should not allow non-Safe to queue on TribalCouncil timelock', async () => { + const attackerAddress = '0xFBbbedc28217550fa63ACA29e85b87c2646e11d4'; + const attackerSigner = await getImpersonatedSigner(attackerAddress); + + const tribalCouncilTimelock = contracts.tribalCouncilTimelock; + await forceEth(tribalCouncilTimelock.address); + await forceEth(attackerAddress); + + // 2. Prepare a proposal which requires a TribeRole. TribalCouncil timelock should have been granted + // ROLE_ADMIN and be able to call into RoleBastion to create a role + const dummyRole = ethers.utils.id('DUMMY_3_ROLE'); + const roleCreationData = contracts.roleBastion.interface.encodeFunctionData('createRole', [dummyRole]); + await expect( + tribalCouncilTimelock + .connect(attackerSigner) + .schedule( + contractAddresses.roleBastion, + 0, + roleCreationData, + '0x0000000000000000000000000000000000000000000000000000000000000000', + '0x0000000000000000000000000000000000000000000000000000000000000001', + tribeCouncilPodConfig.minDelay + ) + ).to.be.revertedWith( + 'AccessControl: account 0xfbbbedc28217550fa63aca29e85b87c2646e11d4 is missing role 0xb09aa5aeb3702cfd50b6b62bc4532604938f21248a27a1d5ca736082b6819cc1' + ); + }); }); From b76d1821755464ff3734a47d95efdb87e0f03e64 Mon Sep 17 00:00:00 2001 From: thomas-waite Date: Mon, 9 May 2022 23:26:43 +0100 Subject: [PATCH 017/274] feat: make use of block.txt for block number --- block.txt | 1 + hardhat.config.ts | 3 ++- package.json | 4 ++-- 3 files changed, 5 insertions(+), 3 deletions(-) create mode 100644 block.txt diff --git a/block.txt b/block.txt new file mode 100644 index 000000000..ff8768fe4 --- /dev/null +++ b/block.txt @@ -0,0 +1 @@ +14742151 \ No newline at end of file diff --git a/hardhat.config.ts b/hardhat.config.ts index d746cc7d1..6a68d2c71 100644 --- a/hardhat.config.ts +++ b/hardhat.config.ts @@ -22,6 +22,7 @@ const mainnetAlchemyApiKey = process.env.MAINNET_ALCHEMY_API_KEY; const runAllTests = process.env.RUN_ALL_TESTS; const useJSONTestReporter = process.env.REPORT_TEST_RESULTS_AS_JSON; const etherscanKey = process.env.ETHERSCAN_API_KEY; +const forkBlock = process.env.FORK_BLOCK; if (!(process.env.NODE_OPTIONS && process.env.NODE_OPTIONS.includes('max-old-space-size'))) { throw new Error( @@ -57,7 +58,7 @@ export default { forking: enableMainnetForking ? { url: `https://eth-mainnet.alchemyapi.io/v2/${mainnetAlchemyApiKey}`, - blockNumber: 14742151 // Monday, May 9th + blockNumber: parseInt(forkBlock) } : undefined }, diff --git a/package.json b/package.json index 10bb33c02..88614510a 100644 --- a/package.json +++ b/package.json @@ -14,11 +14,11 @@ "console:ropsten": "npx hardhat console --network ropsten", "clean": "forge clean && rm -rf artifacts", "test": "forge test --no-match-contract IntegrationTest", - "test:integration": "FORK_BLOCK=14726759; forge test --fork-url https://eth-mainnet.alchemyapi.io/v2/$MAINNET_ALCHEMY_API_KEY --fork-block-number $FORK_BLOCK --match-contract IntegrationTest", + "test:integration": "FORK_BLOCK=`cat block.txt` forge test --fork-url https://eth-mainnet.alchemyapi.io/v2/$MAINNET_ALCHEMY_API_KEY --fork-block-number $FORK_BLOCK --match-contract IntegrationTest", "test:integration:latest": "forge test --fork-url https://eth-mainnet.alchemyapi.io/v2/$MAINNET_ALCHEMY_API_KEY --match-contract IntegrationTest", "test:hardhat": "npx hardhat test", "test:hardhat:dependencies": "LOGGING=true NO_RESET=true npx hardhat test test/integration/tests/dependencies.ts", - "test:e2e": "ENABLE_MAINNET_FORKING=true RUN_E2E_TESTS=true npx hardhat test", + "test:e2e": "FORK_BLOCK=`cat block.txt` ENABLE_MAINNET_FORKING=true RUN_E2E_TESTS=true npx hardhat test", "test:gas": "REPORT_GAS=true npx hardhat test", "test:all": "RUN_ALL_TESTS=true npx hardhat test", "lint": "npm run lint:ts && npm run lint:sol", From 370b99a73f330e4d40839e45bb84f0c736bda861 Mon Sep 17 00:00:00 2001 From: Joey Santoro Date: Mon, 9 May 2022 16:47:43 -0700 Subject: [PATCH 018/274] contract admin cleanup --- contracts/fuse/FuseGuardian.sol | 2 +- contracts/pcv/convex/VotiumBriber.sol | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/contracts/fuse/FuseGuardian.sol b/contracts/fuse/FuseGuardian.sol index 9f0603109..5a6204f5d 100644 --- a/contracts/fuse/FuseGuardian.sol +++ b/contracts/fuse/FuseGuardian.sol @@ -15,7 +15,7 @@ contract FuseGuardian is CoreRef { comptroller = _comptroller; /// @notice The reason we are reusing the tribal chief admin role is it consolidates control in the OA, /// and means we don't have to do another governance action to create this role in core - _setContractAdminRole(keccak256("TRIBAL_CHIEF_ADMIN_ROLE")); + _setContractAdminRole(keccak256("FUSE_ADMIN")); } // ************ BORROW GUARDIAN FUNCTIONS ************ diff --git a/contracts/pcv/convex/VotiumBriber.sol b/contracts/pcv/convex/VotiumBriber.sol index a58b74d99..44972cb9e 100644 --- a/contracts/pcv/convex/VotiumBriber.sol +++ b/contracts/pcv/convex/VotiumBriber.sol @@ -5,6 +5,8 @@ import "./IVotiumBribe.sol"; import "../../refs/CoreRef.sol"; import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; +import {TribeRoles} from "../../core/TribeRoles.sol"; + /// @title VotiumBriber: implementation for a contract that can use /// tokens to bribe on Votium. /// @author Fei Protocol @@ -32,8 +34,6 @@ contract VotiumBriber is CoreRef { ) CoreRef(_core) { token = _token; votiumBribe = _votiumBribe; - - _setContractAdminRole(keccak256("TRIBAL_CHIEF_ADMIN_ROLE")); } /// @notice Spend tokens on Votium to bribe for a given pool. @@ -43,7 +43,7 @@ contract VotiumBriber is CoreRef { /// the _proposal ID, if _choiceIndex is out of range, or of block.timestamp /// is after the deadline for bribing (usually 6 hours before Convex snapshot /// vote ends). - function bribe(bytes32 _proposal, uint256 _choiceIndex) public onlyGovernorOrAdmin whenNotPaused { + function bribe(bytes32 _proposal, uint256 _choiceIndex) public onlyTribeRole(TribeRoles.VOTIUM_ROLE) whenNotPaused { // fetch the current number of TRIBE uint256 tokenAmount = token.balanceOf(address(this)); require(tokenAmount > 0, "VotiumBriber: no tokens to bribe"); From 7a522b62782cb3471a4226f64b5c4ae5b99dd76b Mon Sep 17 00:00:00 2001 From: Joey Santoro Date: Mon, 9 May 2022 19:50:56 -0700 Subject: [PATCH 019/274] votium admin rename --- contracts/core/TribeRoles.sol | 2 +- contracts/pcv/convex/VotiumBriber.sol | 6 +++++- proposals/description/fip_82b.ts | 4 ++-- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/contracts/core/TribeRoles.sol b/contracts/core/TribeRoles.sol index 7992ef0a3..154420aca 100644 --- a/contracts/core/TribeRoles.sol +++ b/contracts/core/TribeRoles.sol @@ -90,7 +90,7 @@ library TribeRoles { bytes32 internal constant POD_METADATA_REGISTER_ROLE = keccak256("POD_METADATA_REGISTER_ROLE"); /// @notice capable of engaging with Votium for voting incentives. - bytes32 internal constant VOTIUM_ROLE = keccak256("VOTIUM_ADMIN_ROLE"); + bytes32 internal constant VOTIUM_ADMIN_ROLE = keccak256("VOTIUM_ADMIN_ROLE"); /// @notice capable of adding an address to multi rate limited bytes32 internal constant ADD_MINTER_ROLE = keccak256("ADD_MINTER_ROLE"); diff --git a/contracts/pcv/convex/VotiumBriber.sol b/contracts/pcv/convex/VotiumBriber.sol index 44972cb9e..5822ac4ef 100644 --- a/contracts/pcv/convex/VotiumBriber.sol +++ b/contracts/pcv/convex/VotiumBriber.sol @@ -43,7 +43,11 @@ contract VotiumBriber is CoreRef { /// the _proposal ID, if _choiceIndex is out of range, or of block.timestamp /// is after the deadline for bribing (usually 6 hours before Convex snapshot /// vote ends). - function bribe(bytes32 _proposal, uint256 _choiceIndex) public onlyTribeRole(TribeRoles.VOTIUM_ROLE) whenNotPaused { + function bribe(bytes32 _proposal, uint256 _choiceIndex) + public + onlyTribeRole(TribeRoles.VOTIUM_ADMIN_ROLE) + whenNotPaused + { // fetch the current number of TRIBE uint256 tokenAmount = token.balanceOf(address(this)); require(tokenAmount > 0, "VotiumBriber: no tokens to bribe"); diff --git a/proposals/description/fip_82b.ts b/proposals/description/fip_82b.ts index d118b4a3b..bedf13d76 100644 --- a/proposals/description/fip_82b.ts +++ b/proposals/description/fip_82b.ts @@ -109,10 +109,10 @@ const fip_82b: ProposalDescription = { values: '0', method: 'createRole(bytes32,bytes32)', arguments: [ - '0x2d46c62aa6fbc9b550f22e00476aebb90f4ea69cd492a68db4d444217763330d', // VOTIUM_ROLE + '0x2d46c62aa6fbc9b550f22e00476aebb90f4ea69cd492a68db4d444217763330d', // VOTIUM_ADMIN_ROLE '0x2172861495e7b85edac73e3cd5fbb42dd675baadf627720e687bcfdaca025096' // ROLE_ADMIN ], - description: 'Transfer VOTIUM_ROLE role admin from GOVERNOR to ROLE_ADMIN' + description: 'Transfer VOTIUM_ADMIN_ROLE role admin from GOVERNOR to ROLE_ADMIN' }, //////// Create new roles for the Tribal Council to manage ///////// { From 1beb25c2fddeb7bff2989acb6f051752a14f2377 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 10 May 2022 07:23:42 +0000 Subject: [PATCH 020/274] Bump husky from 7.0.4 to 8.0.1 Bumps [husky](https://github.com/typicode/husky) from 7.0.4 to 8.0.1. - [Release notes](https://github.com/typicode/husky/releases) - [Commits](https://github.com/typicode/husky/compare/v7.0.4...v8.0.1) --- updated-dependencies: - dependency-name: husky dependency-type: direct:development update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] --- package-lock.json | 16 ++++++++-------- package.json | 2 +- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/package-lock.json b/package-lock.json index 6f9040ba1..9749d24fe 100644 --- a/package-lock.json +++ b/package-lock.json @@ -50,7 +50,7 @@ "eslint-plugin-prettier": "^4.0.0", "ethereum-waffle": "^3.4.4", "ethers": "^5.6.5", - "husky": "^7.0.4", + "husky": "^8.0.1", "lint-staged": "^12.4.1", "mocha": "^10.0.0", "mocha-junit-reporter": "^2.0.2", @@ -19398,15 +19398,15 @@ } }, "node_modules/husky": { - "version": "7.0.4", - "resolved": "https://registry.npmjs.org/husky/-/husky-7.0.4.tgz", - "integrity": "sha512-vbaCKN2QLtP/vD4yvs6iz6hBEo6wkSzs8HpRah1Z6aGmF2KW5PdYuAd7uX5a+OyBZHBhd+TFLqgjUgytQr4RvQ==", + "version": "8.0.1", + "resolved": "https://registry.npmjs.org/husky/-/husky-8.0.1.tgz", + "integrity": "sha512-xs7/chUH/CKdOCs7Zy0Aev9e/dKOMZf3K1Az1nar3tzlv0jfqnYtu235bstsWTmXOR0EfINrPa97yy4Lz6RiKw==", "dev": true, "bin": { "husky": "lib/bin.js" }, "engines": { - "node": ">=12" + "node": ">=14" }, "funding": { "url": "https://github.com/sponsors/typicode" @@ -43771,9 +43771,9 @@ "dev": true }, "husky": { - "version": "7.0.4", - "resolved": "https://registry.npmjs.org/husky/-/husky-7.0.4.tgz", - "integrity": "sha512-vbaCKN2QLtP/vD4yvs6iz6hBEo6wkSzs8HpRah1Z6aGmF2KW5PdYuAd7uX5a+OyBZHBhd+TFLqgjUgytQr4RvQ==", + "version": "8.0.1", + "resolved": "https://registry.npmjs.org/husky/-/husky-8.0.1.tgz", + "integrity": "sha512-xs7/chUH/CKdOCs7Zy0Aev9e/dKOMZf3K1Az1nar3tzlv0jfqnYtu235bstsWTmXOR0EfINrPa97yy4Lz6RiKw==", "dev": true }, "iconv-lite": { diff --git a/package.json b/package.json index 076b4170c..1d20104f2 100644 --- a/package.json +++ b/package.json @@ -90,7 +90,7 @@ "eslint-plugin-prettier": "^4.0.0", "ethereum-waffle": "^3.4.4", "ethers": "^5.6.5", - "husky": "^7.0.4", + "husky": "^8.0.1", "lint-staged": "^12.4.1", "mocha": "^10.0.0", "mocha-junit-reporter": "^2.0.2", From c6a7e5e228ef1c0f7a92f4d41f4297e45dc37172 Mon Sep 17 00:00:00 2001 From: Erwan Beauvois Date: Tue, 10 May 2022 10:20:59 +0200 Subject: [PATCH 021/274] Remove pool 90 FEI (float protocol) from accounting --- proposals/dao/oa_cr_fix.ts | 3 +++ proposals/description/oa_cr_fix.ts | 1 + protocol-configuration/collateralizationOracle.ts | 1 - protocol-configuration/dependencies.ts | 9 --------- protocol-configuration/mainnetAddresses.ts | 4 ++-- 5 files changed, 6 insertions(+), 12 deletions(-) diff --git a/proposals/dao/oa_cr_fix.ts b/proposals/dao/oa_cr_fix.ts index 926c70597..588660dc7 100644 --- a/proposals/dao/oa_cr_fix.ts +++ b/proposals/dao/oa_cr_fix.ts @@ -75,6 +75,9 @@ const validate: ValidateUpgradeFunc = async (addresses, oldContracts, contracts, expect(await contracts.collateralizationOracle.depositToToken(addresses.rariPool27FeiPCVDepositWrapper)).to.be.equal( ZERO_ADDRESS ); + expect(await contracts.collateralizationOracle.depositToToken(addresses.rariPool90FeiPCVDepositWrapper)).to.be.equal( + ZERO_ADDRESS + ); expect(await contracts.collateralizationOracle.depositToToken(addresses.rariPool146EthPCVDeposit)).to.be.equal( ZERO_ADDRESS ); diff --git a/proposals/description/oa_cr_fix.ts b/proposals/description/oa_cr_fix.ts index 2b45fea25..afce4dbd9 100644 --- a/proposals/description/oa_cr_fix.ts +++ b/proposals/description/oa_cr_fix.ts @@ -21,6 +21,7 @@ const fip_x: ProposalDescription = { '{rariPool8LusdPCVDeposit}', // Fuse Pool 8 LUSD '{rariPool18FeiPCVDepositWrapper}', // Fuse Pool 18 FEI '{rariPool27FeiPCVDepositWrapper}', // Fuse Pool 27 FEI + '{rariPool90FeiPCVDepositWrapper}', // Fuse Pool 90 FEI '{rariPool146EthPCVDeposit}', // Fuse Pool 146 ETH '{convexPoolPCVDepositWrapper}' // Fuse Pool 156 FEI ] diff --git a/protocol-configuration/collateralizationOracle.ts b/protocol-configuration/collateralizationOracle.ts index b1f93bb8a..cf204906f 100644 --- a/protocol-configuration/collateralizationOracle.ts +++ b/protocol-configuration/collateralizationOracle.ts @@ -5,7 +5,6 @@ const collateralizationAddresses = { 'rariPool19FeiPCVDepositWrapper', 'rariPool24FeiPCVDepositWrapper', 'rariPool25FeiPCVDepositWrapper', - 'rariPool90FeiPCVDepositWrapper', 'aaveFeiPCVDepositWrapper', 'rariPool79FeiPCVDepositWrapper', 'rariPool31FeiPCVDepositWrapper', diff --git a/protocol-configuration/dependencies.ts b/protocol-configuration/dependencies.ts index 3b8ff9669..f4f8bb13f 100644 --- a/protocol-configuration/dependencies.ts +++ b/protocol-configuration/dependencies.ts @@ -89,7 +89,6 @@ const dependencies: DependencyMap = { 'rariPool7FeiPCVDeposit', 'rariPool7LusdPCVDeposit', 'rariPool8FeiPCVDeposit', - 'rariPool90FeiPCVDeposit', 'rariPool91FeiPCVDeposit', 'rariPool9FeiPCVDeposit', 'rariPool9RaiPCVDeposit', @@ -168,7 +167,6 @@ const dependencies: DependencyMap = { 'rariPool79FeiPCVDeposit', 'rariPool7FeiPCVDeposit', 'rariPool8FeiPCVDeposit', - 'rariPool90FeiPCVDeposit', 'rariPool91FeiPCVDeposit', 'rariPool9FeiPCVDeposit', 'restrictedPermissions', @@ -461,9 +459,6 @@ const dependencies: DependencyMap = { rariPool8FeiPCVDeposit: { contractDependencies: ['core', 'rariPool8Fei', 'fei'] }, - rariPool90FeiPCVDeposit: { - contractDependencies: ['core', 'fei', 'rariPool90FeiPCVDepositWrapper'] - }, rariPool91FeiPCVDeposit: { contractDependencies: ['core', 'fei'] }, @@ -526,7 +521,6 @@ const dependencies: DependencyMap = { 'rariPool31FeiPCVDepositWrapper', 'rariPool6FeiPCVDepositWrapper', 'rariPool9RaiPCVDepositWrapper', - 'rariPool90FeiPCVDepositWrapper', 'rariPool79FeiPCVDepositWrapper', 'rariPool72FeiPCVDepositWrapper', 'rariPool128FeiPCVDepositWrapper', @@ -603,9 +597,6 @@ const dependencies: DependencyMap = { rariPool6FeiPCVDepositWrapper: { contractDependencies: ['collateralizationOracle'] }, - rariPool90FeiPCVDepositWrapper: { - contractDependencies: ['collateralizationOracle', 'rariPool90FeiPCVDeposit'] - }, rariPool79FeiPCVDepositWrapper: { contractDependencies: ['collateralizationOracle', 'rariPool79FeiPCVDeposit'] }, diff --git a/protocol-configuration/mainnetAddresses.ts b/protocol-configuration/mainnetAddresses.ts index aa1d575f8..cbd6b5bb4 100644 --- a/protocol-configuration/mainnetAddresses.ts +++ b/protocol-configuration/mainnetAddresses.ts @@ -314,7 +314,7 @@ const MainnetAddresses: MainnetAddresses = { rariPool90FeiPCVDeposit: { artifactName: 'ERC20CompoundPCVDeposit', address: '0x61d26126D2F8A44b41c1D8E1B1F276551DC8EEc6', - category: AddressCategory.PCV_V1 + category: AddressCategory.Deprecated }, rariPool91FeiPCVDeposit: { artifactName: 'ERC20CompoundPCVDeposit', @@ -584,7 +584,7 @@ const MainnetAddresses: MainnetAddresses = { rariPool90FeiPCVDepositWrapper: { artifactName: 'PCVDepositWrapper', address: '0xec54148CbC47bFF8FCc5e04e5E8083aDb8aF9aD9', - category: AddressCategory.PCV + category: AddressCategory.Deprecated }, rariPool91FeiPCVDepositWrapper: { artifactName: 'PCVDepositWrapper', From e34eed9d3b6ba0c8c5f007a4667d31cd9cef18a5 Mon Sep 17 00:00:00 2001 From: Erwan Beauvois Date: Tue, 10 May 2022 12:07:06 +0200 Subject: [PATCH 022/274] Rename fixed contract --- proposals/dao/oa_cr_fix.ts | 16 ++++++++-------- .../collateralizationOracle.ts | 2 +- protocol-configuration/dependencies.ts | 11 +++-------- protocol-configuration/mainnetAddresses.ts | 4 ++-- 4 files changed, 14 insertions(+), 19 deletions(-) diff --git a/proposals/dao/oa_cr_fix.ts b/proposals/dao/oa_cr_fix.ts index 588660dc7..2b610682d 100644 --- a/proposals/dao/oa_cr_fix.ts +++ b/proposals/dao/oa_cr_fix.ts @@ -18,7 +18,7 @@ const deploy: DeployUpgradeFunc = async (deployAddress: string, addresses: Named // Deploy lens to report B-30FEI-70WETH as WETH and protocol-owned FEI // (The new contract contains a fix) const balancerPool2LensFactory = await ethers.getContractFactory('BalancerPool2Lens'); - const balancerLensBpt30Fei70WethFixed = await balancerPool2LensFactory.deploy( + const balancerLensBpt30Fei70Weth = await balancerPool2LensFactory.deploy( addresses.gaugeLensBpt30Fei70WethGauge, // address _depositAddress addresses.wethERC20, // address _token addresses.balancerFeiWethPool, // IWeightedPool _pool @@ -27,11 +27,11 @@ const deploy: DeployUpgradeFunc = async (deployAddress: string, addresses: Named false, // bool _feiIsReportedIn true // bool _feiIsOther ); - await balancerLensBpt30Fei70WethFixed.deployTransaction.wait(); - logging && console.log('balancerLensBpt30Fei70WethFixed: ', balancerLensBpt30Fei70WethFixed.address); + await balancerLensBpt30Fei70Weth.deployTransaction.wait(); + logging && console.log('balancerLensBpt30Fei70Weth: ', balancerLensBpt30Fei70Weth.address); return { - balancerLensBpt30Fei70WethFixed + balancerLensBpt30Fei70Weth }; }; @@ -86,16 +86,16 @@ const validate: ValidateUpgradeFunc = async (addresses, oldContracts, contracts, ); // Check the lens swap - expect(await contracts.collateralizationOracle.depositToToken(addresses.balancerLensBpt30Fei70Weth)).to.be.equal( + expect(await contracts.collateralizationOracle.depositToToken(addresses.balancerLensBpt30Fei70WethOld)).to.be.equal( ZERO_ADDRESS ); - expect(await contracts.collateralizationOracle.depositToToken(addresses.balancerLensBpt30Fei70WethFixed)).to.be.equal( + expect(await contracts.collateralizationOracle.depositToToken(addresses.balancerLensBpt30Fei70Weth)).to.be.equal( addresses.weth ); // Check the new lens returned values - const balance = (await contracts.balancerLensBpt30Fei70WethFixed.balance()) / 1e18; - const resistantBalanceAndFei = await contracts.balancerLensBpt30Fei70WethFixed.resistantBalanceAndFei(); + const balance = (await contracts.balancerLensBpt30Fei70Weth.balance()) / 1e18; + const resistantBalanceAndFei = await contracts.balancerLensBpt30Fei70Weth.resistantBalanceAndFei(); const resistantBalance = resistantBalanceAndFei[0] / 1e18; const resistantFei = resistantBalanceAndFei[1] / 1e18; expect(balance).to.be.at.least(14000); diff --git a/protocol-configuration/collateralizationOracle.ts b/protocol-configuration/collateralizationOracle.ts index cf204906f..4aee61f78 100644 --- a/protocol-configuration/collateralizationOracle.ts +++ b/protocol-configuration/collateralizationOracle.ts @@ -29,7 +29,7 @@ const collateralizationAddresses = { 'ethPSM', 'wethDepositWrapper', 'balancerDepositFeiWeth', - 'balancerLensBpt30Fei70WethFixed', + 'balancerLensBpt30Fei70Weth', 'balancerLensVeBalWeth' ], dpi: ['rariPool19DpiPCVDepositWrapper', 'dpiDepositWrapper'], diff --git a/protocol-configuration/dependencies.ts b/protocol-configuration/dependencies.ts index f4f8bb13f..ae915e100 100644 --- a/protocol-configuration/dependencies.ts +++ b/protocol-configuration/dependencies.ts @@ -657,7 +657,7 @@ const dependencies: DependencyMap = { 'uniswapPCVDeposit', 'balancerDepositBalWeth', 'balancerDepositFeiWeth', - 'balancerLensBpt30Fei70WethFixed', + 'balancerLensBpt30Fei70Weth', 'balancerLensVeBalBal', 'balancerLensVeBalWeth' ] @@ -698,12 +698,7 @@ const dependencies: DependencyMap = { contractDependencies: ['core', 'chainlinkEthUsdOracleWrapper', 'chainlinkCREAMEthOracle', 'collateralizationOracle'] }, oneConstantOracle: { - contractDependencies: [ - 'core', - 'collateralizationOracle', - 'balancerDepositFeiWeth', - 'balancerLensBpt30Fei70WethFixed' - ] + contractDependencies: ['core', 'collateralizationOracle', 'balancerDepositFeiWeth', 'balancerLensBpt30Fei70Weth'] }, tribeUsdCompositeOracle: { contractDependencies: [ @@ -1040,7 +1035,7 @@ const dependencies: DependencyMap = { balancerLensVeBalWeth: { contractDependencies: ['balUsdCompositeOracle', 'chainlinkEthUsdOracleWrapper'] }, - balancerLensBpt30Fei70WethFixed: { + balancerLensBpt30Fei70Weth: { contractDependencies: ['oneConstantOracle', 'chainlinkEthUsdOracleWrapper'] }, pcvGuardian: { diff --git a/protocol-configuration/mainnetAddresses.ts b/protocol-configuration/mainnetAddresses.ts index cbd6b5bb4..c34a0562e 100644 --- a/protocol-configuration/mainnetAddresses.ts +++ b/protocol-configuration/mainnetAddresses.ts @@ -396,12 +396,12 @@ const MainnetAddresses: MainnetAddresses = { address: '0xa8E388a1f19f2b33Be8bf2cCeC43641C10b4D1e5', category: AddressCategory.External // not really External, but not PCV }, - balancerLensBpt30Fei70Weth: { + balancerLensBpt30Fei70WethOld: { artifactName: 'BalancerPool2Lens', address: '0xb31F75550e97A2C4c7AC8d4355032B8AE8b9584D', category: AddressCategory.Deprecated }, - balancerLensBpt30Fei70WethFixed: { + balancerLensBpt30Fei70Weth: { artifactName: 'BalancerPool2Lens', address: '0x673f7DFA863b611dE657759aEDE629b260F4E682', category: AddressCategory.PCV From 8e51078bd72f1bb5018b7f765e62880d5f56f986 Mon Sep 17 00:00:00 2001 From: Erwan Beauvois Date: Tue, 10 May 2022 12:18:40 +0200 Subject: [PATCH 023/274] Rename old deposit in proposal --- proposals/description/oa_cr_fix.ts | 2 +- test/integration/proposals_config.ts | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/proposals/description/oa_cr_fix.ts b/proposals/description/oa_cr_fix.ts index afce4dbd9..302941f97 100644 --- a/proposals/description/oa_cr_fix.ts +++ b/proposals/description/oa_cr_fix.ts @@ -7,7 +7,7 @@ const fip_x: ProposalDescription = { target: 'collateralizationOracle', values: '0', method: 'swapDeposit(address,address)', - arguments: ['{balancerLensBpt30Fei70Weth}', '{balancerLensBpt30Fei70WethFixed}'], + arguments: ['{balancerLensBpt30Fei70WethOld}', '{balancerLensBpt30Fei70Weth}'], description: 'Update B-70WETH-30FEI Lens' }, { diff --git a/test/integration/proposals_config.ts b/test/integration/proposals_config.ts index 14289335b..98de8c380 100644 --- a/test/integration/proposals_config.ts +++ b/test/integration/proposals_config.ts @@ -52,9 +52,9 @@ const proposals: ProposalsConfigMap = { totalValue: 0, // amount of ETH to send to DAO execution proposal: oa_cr_fix, // full proposal file, imported from '@proposals/description/fip_xx.ts' proposalId: '', - affectedContractSignoff: ['collateralizationOracle', 'balancerLensBpt30Fei70WethFixed'], + affectedContractSignoff: ['collateralizationOracle', 'balancerLensBpt30Fei70Weth'], deprecatedContractSignoff: [ - 'balancerLensBpt30Fei70Weth', + 'balancerLensBpt30Fei70WethOld', 'rariPool8FeiPCVDepositWrapper', 'rariPool8DaiPCVDeposit', 'rariPool8LusdPCVDeposit', From ad9e18d41b147c2dd4a8dc2f2320ff4c8cd05496 Mon Sep 17 00:00:00 2001 From: Erwan Beauvois Date: Tue, 10 May 2022 14:23:08 +0200 Subject: [PATCH 024/274] update boundaries for lens check --- proposals/dao/oa_cr_fix.ts | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/proposals/dao/oa_cr_fix.ts b/proposals/dao/oa_cr_fix.ts index 2b610682d..f86f04563 100644 --- a/proposals/dao/oa_cr_fix.ts +++ b/proposals/dao/oa_cr_fix.ts @@ -98,12 +98,13 @@ const validate: ValidateUpgradeFunc = async (addresses, oldContracts, contracts, const resistantBalanceAndFei = await contracts.balancerLensBpt30Fei70Weth.resistantBalanceAndFei(); const resistantBalance = resistantBalanceAndFei[0] / 1e18; const resistantFei = resistantBalanceAndFei[1] / 1e18; + // 15.86k ETH, 16.3M FEI on 2022-05-10 expect(balance).to.be.at.least(14000); - expect(balance).to.be.at.most(16000); + expect(balance).to.be.at.most(18000); expect(resistantBalance).to.be.at.least(14000); - expect(resistantBalance).to.be.at.most(16000); - expect(resistantFei).to.be.at.least(17e6); - expect(resistantFei).to.be.at.most(20e6); + expect(resistantBalance).to.be.at.most(18000); + expect(resistantFei).to.be.at.least(10e6); + expect(resistantFei).to.be.at.most(25e6); // display pcvStats console.log('----------------------------------------------------'); From 603436797c9022e5f45489b79ec43b8d33056c6f Mon Sep 17 00:00:00 2001 From: thomas-waite Date: Tue, 10 May 2022 14:17:19 +0100 Subject: [PATCH 025/274] feat: deploy daiPSM skimmer --- proposals/dao/withdrawD3Pool.ts | 64 ++++++++++++++++++++++ protocol-configuration/mainnetAddresses.ts | 5 ++ protocol-configuration/permissions.ts | 3 +- test/integration/proposals_config.ts | 22 ++++---- 4 files changed, 81 insertions(+), 13 deletions(-) create mode 100644 proposals/dao/withdrawD3Pool.ts diff --git a/proposals/dao/withdrawD3Pool.ts b/proposals/dao/withdrawD3Pool.ts new file mode 100644 index 000000000..c0069ba4f --- /dev/null +++ b/proposals/dao/withdrawD3Pool.ts @@ -0,0 +1,64 @@ +import hre, { ethers, artifacts } from 'hardhat'; +import { expect } from 'chai'; +import { + DeployUpgradeFunc, + NamedAddresses, + SetupUpgradeFunc, + TeardownUpgradeFunc, + ValidateUpgradeFunc +} from '@custom-types/types'; + +/* + +*/ + +const fipNumber = 'withdraw_from_d3Pool'; + +// Do any deployments +// This should exclusively include new contract deployments +const deploy: DeployUpgradeFunc = async (deployAddress: string, addresses: NamedAddresses, logging: boolean) => { + const skimThreshold = ethers.constants.WeiPerEther.mul(10_000_000); + // 1. Deploy a Fei Skimmer for the DAI PSM + const daiPSMFeiSkimmerFactory = await ethers.getContractFactory('FeiSkimmer'); + const daiPSMFeiSkimmer = await daiPSMFeiSkimmerFactory.deploy( + addresses.core, + addresses.daiFixedPricePSM, + skimThreshold + ); + await daiPSMFeiSkimmer.deployed(); + logging && console.log('DAI PSM Fei Skimmer deployed at', daiPSMFeiSkimmer.address); + return { + daiPSMFeiSkimmer + }; +}; + +// Do any setup necessary for running the test. +// This could include setting up Hardhat to impersonate accounts, +// ensuring contracts have a specific state, etc. +const setup: SetupUpgradeFunc = async (addresses, oldContracts, contracts, logging) => { + console.log(`No actions to complete in setup for fip${fipNumber}`); +}; + +// Tears down any changes made in setup() that need to be +// cleaned up before doing any validation checks. +const teardown: TeardownUpgradeFunc = async (addresses, oldContracts, contracts, logging) => { + console.log(`No actions to complete in teardown for fip${fipNumber}`); +}; + +// Run any validations required on the fip using mocha or console logging +// IE check balances, check state of contracts, etc. +const validate: ValidateUpgradeFunc = async (addresses, oldContracts, contracts, logging) => { + // 1. Validate DAI PSM FEI skimmer + const daiPSMFeiSkimmer = contracts.daiPSMFeiSkimmer; + const core = contracts.core; + + expect(await daiPSMFeiSkimmer.threshold()).to.be.equal(ethers.constants.WeiPerEther.mul(10_000_000)); + expect(await daiPSMFeiSkimmer.source()).to.be.equal(addresses.daiFixedPricePSM); + expect(await core.hasRole(ethers.utils.id('PCV_CONTROLLER_ROLE'), daiPSMFeiSkimmer.address)).to.be.true; + + // 2. Validate withdraw convexPCVDeposit + + // 3. Validate withdraw of Fei from D3 Pool +}; + +export { deploy, setup, teardown, validate }; diff --git a/protocol-configuration/mainnetAddresses.ts b/protocol-configuration/mainnetAddresses.ts index 89b4d82f1..7d4b49d54 100644 --- a/protocol-configuration/mainnetAddresses.ts +++ b/protocol-configuration/mainnetAddresses.ts @@ -1676,6 +1676,11 @@ const MainnetAddresses: MainnetAddresses = { address: '0xFf419Bc27483edb94b7Ad5c97b7FaB5DB323c7E0', category: AddressCategory.Deprecated }, + daiFixedPriceFeiSkimmer: { + artifactName: 'FeiSkimmer', + address: '', + category: AddressCategory.PCV + }, daiPSMFeiSkimmer: { artifactName: 'FeiSkimmer', address: '0xf8Ca6c10a794C867497541F5b7A7f96ca2bCd1E8', diff --git a/protocol-configuration/permissions.ts b/protocol-configuration/permissions.ts index ca1aaae8c..8f3765a9f 100644 --- a/protocol-configuration/permissions.ts +++ b/protocol-configuration/permissions.ts @@ -22,7 +22,8 @@ export const permissions = { 'lusdPCVDripController', 'ethPSMFeiSkimmer', 'lusdPSMFeiSkimmer', - 'raiPCVDripController' + 'raiPCVDripController', + 'daiFixedPriceFeiSkimmer' ], GUARDIAN_ROLE: ['multisig', 'pcvGuardianNew', 'pcvSentinel'], ORACLE_ADMIN_ROLE: [ diff --git a/test/integration/proposals_config.ts b/test/integration/proposals_config.ts index e825c3957..5e189ffae 100644 --- a/test/integration/proposals_config.ts +++ b/test/integration/proposals_config.ts @@ -1,19 +1,17 @@ import { ProposalCategory, ProposalsConfigMap } from '@custom-types/types'; -// import fip_xx_proposal from '@proposals/description/fip_xx'; +import withdrawD3Pool from '@proposals/description/withdrawD3Pool'; const proposals: ProposalsConfigMap = { - /* - fip_xx: { - deploy: true, // deploy flag for whether to run deploy action during e2e tests or use mainnet state - totalValue: 0, // amount of ETH to send to DAO execution - proposal: fip_xx, // full proposal file, imported from '@proposals/description/fip_xx.ts' - proposalId: '', - affectedContractSignoff: [''], - deprecatedContractSignoff: [''], - category: ProposalCategory.DAO - } - */ + withdraw_d3_pool: { + deploy: false, // deploy flag for whether to run deploy action during e2e tests or use mainnet state + totalValue: 0, // amount of ETH to send to DAO execution + proposal: withdrawD3Pool, // full proposal file, imported from '@proposals/description/fip_xx.ts' + proposalId: '', + affectedContractSignoff: [''], + deprecatedContractSignoff: [''], + category: ProposalCategory.TC + } }; export default proposals; From 427e5a17649bef32578e7087bc3a3a8f3e425e9f Mon Sep 17 00:00:00 2001 From: thomas-waite Date: Tue, 10 May 2022 14:56:01 +0100 Subject: [PATCH 026/274] feat: add withdraw proposal --- proposals/description/withdrawD3Pool.ts | 51 +++++++++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 proposals/description/withdrawD3Pool.ts diff --git a/proposals/description/withdrawD3Pool.ts b/proposals/description/withdrawD3Pool.ts new file mode 100644 index 000000000..b64be29cc --- /dev/null +++ b/proposals/description/withdrawD3Pool.ts @@ -0,0 +1,51 @@ +import { ProposalDescription } from '@custom-types/types'; + +const fip_x: ProposalDescription = { + // Curve/Convex reports balance in USD + title: 'Withdraw from the D3Pool', + commands: [ + { + target: 'core', + values: '0', + method: 'grantPCVController(address)', + arguments: ['{daiFixedPriceFeiSkimmer}'], + description: 'Grant PCV Controller to daiFixedPriceFeiSkimmer' + }, + { + target: 'pcvGuardianNew', + values: '0', + method: 'withdrawToSafeAddress(address,address,uint256,bool,bool)', + arguments: [ + '{d3poolConvexPCVDeposit}', + '{d3poolCurvePCVDeposit}', + '30000000000000000000000000', + 'false', + 'false' + ], + description: 'Withdraw 30M USD worth of LP tokens to the d3PoolCurvePCVDeposit' + }, + { + target: 'pcvGuardianNew', + values: '0', + method: 'withdrawToSafeAddress(address,address,uint256,bool,bool)', + arguments: ['{d3poolCurvePCVDeposit}', '{daiFixedPricePSM}', '10000000000000000000000000', 'false', 'false'], + description: 'Withdraw 10M worth of Fei from the Curve D3 pool to the DAI PSM' + }, + { + target: 'daiPSMSkimmer', + values: '0', + method: 'skim()', + arguments: [], + description: 'Skim all the Fei on the DAI PSM - burn it' + } + ], + description: ` + Withdraw 30M USD worth of LP tokens from the d3 pool on Curve. + + Send the LP tokens to the d3PoolCurvePCVDeposit and then withdraw 10M FEI from the pool to the DAI PSM. + + Then skim all the FEI on the DAI PSM and burn it. + ` +}; + +export default fip_x; From f6061c49f4eb929d8373cf337c5d8a4b290db917 Mon Sep 17 00:00:00 2001 From: thomas-waite Date: Tue, 10 May 2022 15:04:44 +0100 Subject: [PATCH 027/274] test: add validation script for movements --- proposals/dao/withdrawD3Pool.ts | 45 +++++++++++++++++++++++++-------- 1 file changed, 35 insertions(+), 10 deletions(-) diff --git a/proposals/dao/withdrawD3Pool.ts b/proposals/dao/withdrawD3Pool.ts index c0069ba4f..3332c21c1 100644 --- a/proposals/dao/withdrawD3Pool.ts +++ b/proposals/dao/withdrawD3Pool.ts @@ -1,4 +1,4 @@ -import hre, { ethers, artifacts } from 'hardhat'; +import { ethers } from 'hardhat'; import { expect } from 'chai'; import { DeployUpgradeFunc, @@ -8,12 +8,14 @@ import { ValidateUpgradeFunc } from '@custom-types/types'; -/* - -*/ - const fipNumber = 'withdraw_from_d3Pool'; +let convexResistantBalanceBefore: ethers.BigNumber; +let convexFeiBalanceBefore: ethers.BigNumber; +let curveResistantBalanceBefore: ethers.BigNumber; +let curveFeiBalanceBefore: ethers.BigNumber; +let daiInitialPSMFeiBalance: ethers.BigNumber; + // Do any deployments // This should exclusively include new contract deployments const deploy: DeployUpgradeFunc = async (deployAddress: string, addresses: NamedAddresses, logging: boolean) => { @@ -36,7 +38,14 @@ const deploy: DeployUpgradeFunc = async (deployAddress: string, addresses: Named // This could include setting up Hardhat to impersonate accounts, // ensuring contracts have a specific state, etc. const setup: SetupUpgradeFunc = async (addresses, oldContracts, contracts, logging) => { - console.log(`No actions to complete in setup for fip${fipNumber}`); + const convexPCVDeposit = contracts.d3poolConvexPCVDeposit; + const curvePCVdeposit = contracts.d3poolCurvePCVDeposit; + const daiFixedPricePSM = contracts.daiFixedPricePSM; + + [convexResistantBalanceBefore, convexFeiBalanceBefore] = await convexPCVDeposit.resistantBalanceAndFei(); + [curveResistantBalanceBefore, curveFeiBalanceBefore] = await curvePCVdeposit.resistantBalanceAndFei(); + + daiInitialPSMFeiBalance = await daiFixedPricePSM.feiBalance(); }; // Tears down any changes made in setup() that need to be @@ -48,17 +57,33 @@ const teardown: TeardownUpgradeFunc = async (addresses, oldContracts, contracts, // Run any validations required on the fip using mocha or console logging // IE check balances, check state of contracts, etc. const validate: ValidateUpgradeFunc = async (addresses, oldContracts, contracts, logging) => { - // 1. Validate DAI PSM FEI skimmer - const daiPSMFeiSkimmer = contracts.daiPSMFeiSkimmer; + const convexPCVDeposit = contracts.d3poolConvexPCVDeposit; + const curvePCVDeposit = contracts.d3poolCurvePCVDeposit; const core = contracts.core; + const daiPSMFeiSkimmer = contracts.daiPSMFeiSkimmer; + + const feiWithdrawAmount = ethers.constants.WeiPerEther.mul(10_000_000); - expect(await daiPSMFeiSkimmer.threshold()).to.be.equal(ethers.constants.WeiPerEther.mul(10_000_000)); + // 1. Validate DAI PSM FEI skimmer + expect(await daiPSMFeiSkimmer.threshold()).to.be.equal(feiWithdrawAmount); expect(await daiPSMFeiSkimmer.source()).to.be.equal(addresses.daiFixedPricePSM); - expect(await core.hasRole(ethers.utils.id('PCV_CONTROLLER_ROLE'), daiPSMFeiSkimmer.address)).to.be.true; + // TODO: Need DAO vote to give out PCV_CONTROLLER role + // expect(await core.hasRole(ethers.utils.id('PCV_CONTROLLER_ROLE'), daiPSMFeiSkimmer.address)).to.be.true; // 2. Validate withdraw convexPCVDeposit + const [convexResistantBalanceAfter, convexFeiBalanceAfter] = await convexPCVDeposit.resistantBalanceAndFei(); + const [curveResistantBalanceAfter, curveFeiBalanceAfter] = await curvePCVDeposit.resistantBalanceAndFei(); + + console.log( + convexResistantBalanceBefore.toString(), + convexResistantBalanceAfter.toString(), + convexFeiBalanceBefore.toString(), + convexFeiBalanceAfter.toString() + ); // 3. Validate withdraw of Fei from D3 Pool + const daiPSMFeiBalance = await daiPSMFeiSkimmer.feiBalance(); + expect(daiPSMFeiBalance).to.be.equal(daiInitialPSMFeiBalance.add(feiWithdrawAmount)); }; export { deploy, setup, teardown, validate }; From 840ad085678c15ada8a6c5e3a3e8c084698c0294 Mon Sep 17 00:00:00 2001 From: thomas-waite Date: Tue, 10 May 2022 16:27:53 +0100 Subject: [PATCH 028/274] feat: break out pcv skimmer into seperate fip --- proposals/dao/fip_105.ts | 61 +++++++++++++++++++ ...{withdrawD3Pool.ts => withdraw_d3_pool.ts} | 55 ++++++++--------- proposals/description/fip_105.ts | 17 ++++++ ...{withdrawD3Pool.ts => withdraw_d3_pool.ts} | 24 +------- test/integration/proposals_config.ts | 14 ++++- 5 files changed, 119 insertions(+), 52 deletions(-) create mode 100644 proposals/dao/fip_105.ts rename proposals/dao/{withdrawD3Pool.ts => withdraw_d3_pool.ts} (65%) create mode 100644 proposals/description/fip_105.ts rename proposals/description/{withdrawD3Pool.ts => withdraw_d3_pool.ts} (61%) diff --git a/proposals/dao/fip_105.ts b/proposals/dao/fip_105.ts new file mode 100644 index 000000000..b8356ce96 --- /dev/null +++ b/proposals/dao/fip_105.ts @@ -0,0 +1,61 @@ +import { ethers } from 'hardhat'; +import { expect } from 'chai'; +import { + DeployUpgradeFunc, + NamedAddresses, + SetupUpgradeFunc, + TeardownUpgradeFunc, + ValidateUpgradeFunc +} from '@custom-types/types'; + +/* + +DAO Proposal #105 + +Description: Deploy a Fei skimmer for the DAI PSM +*/ + +const fipNumber = '105'; + +const skimThreshold = ethers.constants.WeiPerEther.mul(10_000_000); + +const deploy: DeployUpgradeFunc = async (deployAddress: string, addresses: NamedAddresses, logging: boolean) => { + // 1. Deploy a Fei Skimmer for the DAI PSM + const daiPSMFeiSkimmerFactory = await ethers.getContractFactory('FeiSkimmer'); + const daiFixedPricePSMFeiSkimmer = await daiPSMFeiSkimmerFactory.deploy( + addresses.core, + addresses.daiFixedPricePSM, + skimThreshold + ); + await daiFixedPricePSMFeiSkimmer.deployed(); + logging && console.log('DAI PSM Fei Skimmer deployed at', daiFixedPricePSMFeiSkimmer.address); + return { + daiPSMFeiSkimmer: daiFixedPricePSMFeiSkimmer + }; +}; + +// Do any setup necessary for running the test. +// This could include setting up Hardhat to impersonate accounts, +// ensuring contracts have a specific state, etc. +const setup: SetupUpgradeFunc = async (addresses, oldContracts, contracts, logging) => { + console.log(`No actions to complete in setup for fip${fipNumber}`); +}; + +// Tears down any changes made in setup() that need to be +// cleaned up before doing any validation checks. +const teardown: TeardownUpgradeFunc = async (addresses, oldContracts, contracts, logging) => { + console.log(`No actions to complete in teardown for fip${fipNumber}`); +}; + +// Run any validations required on the fip using mocha or console logging +// IE check balances, check state of contracts, etc. +const validate: ValidateUpgradeFunc = async (addresses, oldContracts, contracts, logging) => { + const daiFixedPricePSMFeiSkimmer = contracts.daiFixedPricePSMFeiSkimmer; + const core = contracts.core; + + expect(await daiFixedPricePSMFeiSkimmer.threshold()).to.be.equal(skimThreshold); + expect(await daiFixedPricePSMFeiSkimmer.source()).to.be.equal(addresses.daiFixedPricePSM); + expect(await core.hasRole(ethers.utils.id('PCV_CONTROLLER_ROLE'), daiFixedPricePSMFeiSkimmer.address)).to.be.true; +}; + +export { deploy, setup, teardown, validate }; diff --git a/proposals/dao/withdrawD3Pool.ts b/proposals/dao/withdraw_d3_pool.ts similarity index 65% rename from proposals/dao/withdrawD3Pool.ts rename to proposals/dao/withdraw_d3_pool.ts index 3332c21c1..7631820d7 100644 --- a/proposals/dao/withdrawD3Pool.ts +++ b/proposals/dao/withdraw_d3_pool.ts @@ -7,31 +7,20 @@ import { TeardownUpgradeFunc, ValidateUpgradeFunc } from '@custom-types/types'; +import { forceEth } from '@test/integration/setup/utils'; const fipNumber = 'withdraw_from_d3Pool'; -let convexResistantBalanceBefore: ethers.BigNumber; -let convexFeiBalanceBefore: ethers.BigNumber; -let curveResistantBalanceBefore: ethers.BigNumber; -let curveFeiBalanceBefore: ethers.BigNumber; -let daiInitialPSMFeiBalance: ethers.BigNumber; +let convexResistantBalanceBefore: any; +let convexFeiBalanceBefore: any; +let curveResistantBalanceBefore: any; +let curveFeiBalanceBefore: any; +let daiInitialPSMFeiBalance: any; // Do any deployments // This should exclusively include new contract deployments const deploy: DeployUpgradeFunc = async (deployAddress: string, addresses: NamedAddresses, logging: boolean) => { - const skimThreshold = ethers.constants.WeiPerEther.mul(10_000_000); - // 1. Deploy a Fei Skimmer for the DAI PSM - const daiPSMFeiSkimmerFactory = await ethers.getContractFactory('FeiSkimmer'); - const daiPSMFeiSkimmer = await daiPSMFeiSkimmerFactory.deploy( - addresses.core, - addresses.daiFixedPricePSM, - skimThreshold - ); - await daiPSMFeiSkimmer.deployed(); - logging && console.log('DAI PSM Fei Skimmer deployed at', daiPSMFeiSkimmer.address); - return { - daiPSMFeiSkimmer - }; + return {}; }; // Do any setup necessary for running the test. @@ -46,6 +35,9 @@ const setup: SetupUpgradeFunc = async (addresses, oldContracts, contracts, loggi [curveResistantBalanceBefore, curveFeiBalanceBefore] = await curvePCVdeposit.resistantBalanceAndFei(); daiInitialPSMFeiBalance = await daiFixedPricePSM.feiBalance(); + + await forceEth(addresses.tribalCouncilTimelock); + await forceEth(addresses.tribalCouncilSafe); }; // Tears down any changes made in setup() that need to be @@ -59,30 +51,37 @@ const teardown: TeardownUpgradeFunc = async (addresses, oldContracts, contracts, const validate: ValidateUpgradeFunc = async (addresses, oldContracts, contracts, logging) => { const convexPCVDeposit = contracts.d3poolConvexPCVDeposit; const curvePCVDeposit = contracts.d3poolCurvePCVDeposit; - const core = contracts.core; - const daiPSMFeiSkimmer = contracts.daiPSMFeiSkimmer; + const daiFixedPricePSM = contracts.daiFixedPricePSM; + const LPWithdrawAmount = ethers.constants.WeiPerEther.mul(30_000_000); const feiWithdrawAmount = ethers.constants.WeiPerEther.mul(10_000_000); - // 1. Validate DAI PSM FEI skimmer - expect(await daiPSMFeiSkimmer.threshold()).to.be.equal(feiWithdrawAmount); - expect(await daiPSMFeiSkimmer.source()).to.be.equal(addresses.daiFixedPricePSM); - // TODO: Need DAO vote to give out PCV_CONTROLLER role - // expect(await core.hasRole(ethers.utils.id('PCV_CONTROLLER_ROLE'), daiPSMFeiSkimmer.address)).to.be.true; - // 2. Validate withdraw convexPCVDeposit const [convexResistantBalanceAfter, convexFeiBalanceAfter] = await convexPCVDeposit.resistantBalanceAndFei(); + expect(convexFeiBalanceAfter).to.bignumber.equal(convexFeiBalanceBefore); // Fei balance shouldn't have changed + + // Might need calculating + // expect(convexResistantBalanceAfter).to.bignumber.equal(convexResistantBalanceBefore.sub(LPWithdrawAmount)); + + // 3. Validate curvePCVDeposit const [curveResistantBalanceAfter, curveFeiBalanceAfter] = await curvePCVDeposit.resistantBalanceAndFei(); + expect(curveFeiBalanceAfter).to.bignumber.equal(curveFeiBalanceBefore.sub(feiWithdrawAmount)); + + // Might need calculating + // expect(curveResistantBalanceAfter).to.bignumber.equal(curveResistantBalanceBefore.sub(feiWithdrawAmount)); console.log( + 'convex balance before', convexResistantBalanceBefore.toString(), + 'convex balance afer', convexResistantBalanceAfter.toString(), + 'convex fei before', convexFeiBalanceBefore.toString(), + 'convex fei after', convexFeiBalanceAfter.toString() ); - // 3. Validate withdraw of Fei from D3 Pool - const daiPSMFeiBalance = await daiPSMFeiSkimmer.feiBalance(); + const daiPSMFeiBalance = await daiFixedPricePSM.feiBalance(); expect(daiPSMFeiBalance).to.be.equal(daiInitialPSMFeiBalance.add(feiWithdrawAmount)); }; diff --git a/proposals/description/fip_105.ts b/proposals/description/fip_105.ts new file mode 100644 index 000000000..39b881b73 --- /dev/null +++ b/proposals/description/fip_105.ts @@ -0,0 +1,17 @@ +import { ProposalDescription } from '@custom-types/types'; + +const fip_105: ProposalDescription = { + title: 'FIP-105: Grant DAI PSM skimmer PCV_CONTROLLER_ROLE', + commands: [ + { + target: 'core', + values: '0', + method: 'grantRole(bytes32,address)', + arguments: ['0x0866eae1216ed05a11636a648003f3f62921eb97ccb05acc30636f62958a8bd6', '{daiFixedPricePSMFeiSkimmer}'], + description: 'Grant the new DAI PSM Skimmer the PCV_CONTROLLER_ROLE' + } + ], + description: 'Configure a new Fei Skimmer to burn excess DAI from the DAI PSM' +}; + +export default fip_105; diff --git a/proposals/description/withdrawD3Pool.ts b/proposals/description/withdraw_d3_pool.ts similarity index 61% rename from proposals/description/withdrawD3Pool.ts rename to proposals/description/withdraw_d3_pool.ts index b64be29cc..5e7e2f189 100644 --- a/proposals/description/withdrawD3Pool.ts +++ b/proposals/description/withdraw_d3_pool.ts @@ -4,39 +4,19 @@ const fip_x: ProposalDescription = { // Curve/Convex reports balance in USD title: 'Withdraw from the D3Pool', commands: [ - { - target: 'core', - values: '0', - method: 'grantPCVController(address)', - arguments: ['{daiFixedPriceFeiSkimmer}'], - description: 'Grant PCV Controller to daiFixedPriceFeiSkimmer' - }, { target: 'pcvGuardianNew', values: '0', method: 'withdrawToSafeAddress(address,address,uint256,bool,bool)', - arguments: [ - '{d3poolConvexPCVDeposit}', - '{d3poolCurvePCVDeposit}', - '30000000000000000000000000', - 'false', - 'false' - ], + arguments: ['{d3poolConvexPCVDeposit}', '{d3poolCurvePCVDeposit}', '30000000000000000000000000', false, false], description: 'Withdraw 30M USD worth of LP tokens to the d3PoolCurvePCVDeposit' }, { target: 'pcvGuardianNew', values: '0', method: 'withdrawToSafeAddress(address,address,uint256,bool,bool)', - arguments: ['{d3poolCurvePCVDeposit}', '{daiFixedPricePSM}', '10000000000000000000000000', 'false', 'false'], + arguments: ['{d3poolCurvePCVDeposit}', '{daiFixedPricePSM}', '10000000000000000000000000', false, false], description: 'Withdraw 10M worth of Fei from the Curve D3 pool to the DAI PSM' - }, - { - target: 'daiPSMSkimmer', - values: '0', - method: 'skim()', - arguments: [], - description: 'Skim all the Fei on the DAI PSM - burn it' } ], description: ` diff --git a/test/integration/proposals_config.ts b/test/integration/proposals_config.ts index 5e189ffae..ebae3a4e2 100644 --- a/test/integration/proposals_config.ts +++ b/test/integration/proposals_config.ts @@ -1,14 +1,24 @@ import { ProposalCategory, ProposalsConfigMap } from '@custom-types/types'; -import withdrawD3Pool from '@proposals/description/withdrawD3Pool'; +import withdrawD3Pool from '@proposals/description/withdraw_d3_pool'; +import fip_105 from '@proposals/description/fip_105'; const proposals: ProposalsConfigMap = { + fip_105: { + deploy: true, // deploy flag for whether to run deploy action during e2e tests or use mainnet state + totalValue: 0, // amount of ETH to send to DAO execution + proposal: fip_105, // full proposal file, imported from '@proposals/description/fip_xx.ts' + proposalId: '', + affectedContractSignoff: ['daiPSMFeiSkimmer'], + deprecatedContractSignoff: [''], + category: ProposalCategory.DAO + }, withdraw_d3_pool: { deploy: false, // deploy flag for whether to run deploy action during e2e tests or use mainnet state totalValue: 0, // amount of ETH to send to DAO execution proposal: withdrawD3Pool, // full proposal file, imported from '@proposals/description/fip_xx.ts' proposalId: '', - affectedContractSignoff: [''], + affectedContractSignoff: ['d3poolCurvePCVDeposit', 'd3poolConvexPCVDeposit'], deprecatedContractSignoff: [''], category: ProposalCategory.TC } From 792a50a02f1a7db8d7f0dbe9c2efd1d224d4a223 Mon Sep 17 00:00:00 2001 From: thomas-waite Date: Tue, 10 May 2022 17:53:14 +0100 Subject: [PATCH 029/274] test: update curve validation tests --- proposals/dao/fip_105.ts | 3 +- proposals/dao/withdraw_d3_pool.ts | 54 ++++++++++++++--------- proposals/description/withdraw_d3_pool.ts | 2 - test/integration/proposals_config.ts | 4 +- 4 files changed, 36 insertions(+), 27 deletions(-) diff --git a/proposals/dao/fip_105.ts b/proposals/dao/fip_105.ts index b8356ce96..536879084 100644 --- a/proposals/dao/fip_105.ts +++ b/proposals/dao/fip_105.ts @@ -16,7 +16,6 @@ Description: Deploy a Fei skimmer for the DAI PSM */ const fipNumber = '105'; - const skimThreshold = ethers.constants.WeiPerEther.mul(10_000_000); const deploy: DeployUpgradeFunc = async (deployAddress: string, addresses: NamedAddresses, logging: boolean) => { @@ -30,7 +29,7 @@ const deploy: DeployUpgradeFunc = async (deployAddress: string, addresses: Named await daiFixedPricePSMFeiSkimmer.deployed(); logging && console.log('DAI PSM Fei Skimmer deployed at', daiFixedPricePSMFeiSkimmer.address); return { - daiPSMFeiSkimmer: daiFixedPricePSMFeiSkimmer + daiFixedPricePSMFeiSkimmer }; }; diff --git a/proposals/dao/withdraw_d3_pool.ts b/proposals/dao/withdraw_d3_pool.ts index 7631820d7..e9e3f1602 100644 --- a/proposals/dao/withdraw_d3_pool.ts +++ b/proposals/dao/withdraw_d3_pool.ts @@ -52,35 +52,47 @@ const validate: ValidateUpgradeFunc = async (addresses, oldContracts, contracts, const convexPCVDeposit = contracts.d3poolConvexPCVDeposit; const curvePCVDeposit = contracts.d3poolCurvePCVDeposit; const daiFixedPricePSM = contracts.daiFixedPricePSM; - - const LPWithdrawAmount = ethers.constants.WeiPerEther.mul(30_000_000); const feiWithdrawAmount = ethers.constants.WeiPerEther.mul(10_000_000); - // 2. Validate withdraw convexPCVDeposit + // 2. Validate withdraw convexPCVDeposit - have pulled 30M LP tokens from Convex const [convexResistantBalanceAfter, convexFeiBalanceAfter] = await convexPCVDeposit.resistantBalanceAndFei(); - expect(convexFeiBalanceAfter).to.bignumber.equal(convexFeiBalanceBefore); // Fei balance shouldn't have changed - // Might need calculating - // expect(convexResistantBalanceAfter).to.bignumber.equal(convexResistantBalanceBefore.sub(LPWithdrawAmount)); + // ~20M in resistantBalance (value of LP tokens?) has been withdrawn + expect(convexResistantBalanceAfter).to.bignumber.at.least( + convexResistantBalanceBefore.sub(ethers.constants.WeiPerEther.mul(20_100_000)) + ); + expect(convexResistantBalanceAfter).to.bignumber.at.most( + convexResistantBalanceBefore.sub(ethers.constants.WeiPerEther.mul(19_900_000)) + ); + + // ~10M Fei has been withdrawn - would only expect LP tokens to be withdrawn? + expect(convexFeiBalanceAfter).to.bignumber.at.least( + convexFeiBalanceBefore.sub(ethers.constants.WeiPerEther.mul(10_100_000)) + ); + expect(convexFeiBalanceAfter).to.bignumber.at.most( + convexFeiBalanceBefore.sub(ethers.constants.WeiPerEther.mul(9_900_000)) + ); - // 3. Validate curvePCVDeposit + // 3. Validate curvePCVDeposit - have transferred 30M LP tokens here, but then withdrawn 10M. Net 20M inflow const [curveResistantBalanceAfter, curveFeiBalanceAfter] = await curvePCVDeposit.resistantBalanceAndFei(); - expect(curveFeiBalanceAfter).to.bignumber.equal(curveFeiBalanceBefore.sub(feiWithdrawAmount)); - - // Might need calculating - // expect(curveResistantBalanceAfter).to.bignumber.equal(curveResistantBalanceBefore.sub(feiWithdrawAmount)); - - console.log( - 'convex balance before', - convexResistantBalanceBefore.toString(), - 'convex balance afer', - convexResistantBalanceAfter.toString(), - 'convex fei before', - convexFeiBalanceBefore.toString(), - 'convex fei after', - convexFeiBalanceAfter.toString() + + // ~13.6M in resistantBalance net inflow + expect(curveResistantBalanceAfter).to.bignumber.at.most( + curveResistantBalanceBefore.add(ethers.constants.WeiPerEther.mul(13_400_000)) + ); + expect(curveResistantBalanceAfter).to.bignumber.at.least( + curveResistantBalanceBefore.add(ethers.constants.WeiPerEther.mul(13_200_000)) + ); + + // ~6.3M Fei net inflow + expect(curveFeiBalanceAfter).to.bignumber.at.most( + curveFeiBalanceBefore.add(ethers.constants.WeiPerEther.mul(6_700_000)) + ); + expect(curveFeiBalanceAfter).to.bignumber.at.least( + curveFeiBalanceBefore.add(ethers.constants.WeiPerEther.mul(6_500_000)) ); + // 10M net flow into DAI PSM const daiPSMFeiBalance = await daiFixedPricePSM.feiBalance(); expect(daiPSMFeiBalance).to.be.equal(daiInitialPSMFeiBalance.add(feiWithdrawAmount)); }; diff --git a/proposals/description/withdraw_d3_pool.ts b/proposals/description/withdraw_d3_pool.ts index 5e7e2f189..d803d9b53 100644 --- a/proposals/description/withdraw_d3_pool.ts +++ b/proposals/description/withdraw_d3_pool.ts @@ -23,8 +23,6 @@ const fip_x: ProposalDescription = { Withdraw 30M USD worth of LP tokens from the d3 pool on Curve. Send the LP tokens to the d3PoolCurvePCVDeposit and then withdraw 10M FEI from the pool to the DAI PSM. - - Then skim all the FEI on the DAI PSM and burn it. ` }; diff --git a/test/integration/proposals_config.ts b/test/integration/proposals_config.ts index ebae3a4e2..c962c8c5d 100644 --- a/test/integration/proposals_config.ts +++ b/test/integration/proposals_config.ts @@ -9,7 +9,7 @@ const proposals: ProposalsConfigMap = { totalValue: 0, // amount of ETH to send to DAO execution proposal: fip_105, // full proposal file, imported from '@proposals/description/fip_xx.ts' proposalId: '', - affectedContractSignoff: ['daiPSMFeiSkimmer'], + affectedContractSignoff: ['daiFixedPricePSMFeiSkimmer'], deprecatedContractSignoff: [''], category: ProposalCategory.DAO }, @@ -18,7 +18,7 @@ const proposals: ProposalsConfigMap = { totalValue: 0, // amount of ETH to send to DAO execution proposal: withdrawD3Pool, // full proposal file, imported from '@proposals/description/fip_xx.ts' proposalId: '', - affectedContractSignoff: ['d3poolCurvePCVDeposit', 'd3poolConvexPCVDeposit'], + affectedContractSignoff: ['pcvGuardianNew', 'd3poolCurvePCVDeposit', 'd3poolConvexPCVDeposit', 'daiFixedPricePSM'], deprecatedContractSignoff: [''], category: ProposalCategory.TC } From 1f4721d52341c831585c4692b3d26ee38942add5 Mon Sep 17 00:00:00 2001 From: thomas-waite Date: Tue, 10 May 2022 18:07:31 +0100 Subject: [PATCH 030/274] refactor: update categorization and deps --- proposals/dao/withdraw_d3_pool.ts | 11 ++++++----- protocol-configuration/mainnetAddresses.ts | 2 +- test/integration/proposals_config.ts | 4 ++-- 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/proposals/dao/withdraw_d3_pool.ts b/proposals/dao/withdraw_d3_pool.ts index e9e3f1602..a4e6350f5 100644 --- a/proposals/dao/withdraw_d3_pool.ts +++ b/proposals/dao/withdraw_d3_pool.ts @@ -8,14 +8,15 @@ import { ValidateUpgradeFunc } from '@custom-types/types'; import { forceEth } from '@test/integration/setup/utils'; +import { BigNumber } from 'ethers'; const fipNumber = 'withdraw_from_d3Pool'; -let convexResistantBalanceBefore: any; -let convexFeiBalanceBefore: any; -let curveResistantBalanceBefore: any; -let curveFeiBalanceBefore: any; -let daiInitialPSMFeiBalance: any; +let convexResistantBalanceBefore: BigNumber; +let convexFeiBalanceBefore: BigNumber; +let curveResistantBalanceBefore: BigNumber; +let curveFeiBalanceBefore: BigNumber; +let daiInitialPSMFeiBalance: BigNumber; // Do any deployments // This should exclusively include new contract deployments diff --git a/protocol-configuration/mainnetAddresses.ts b/protocol-configuration/mainnetAddresses.ts index 7d4b49d54..315bff400 100644 --- a/protocol-configuration/mainnetAddresses.ts +++ b/protocol-configuration/mainnetAddresses.ts @@ -1679,7 +1679,7 @@ const MainnetAddresses: MainnetAddresses = { daiFixedPriceFeiSkimmer: { artifactName: 'FeiSkimmer', address: '', - category: AddressCategory.PCV + category: AddressCategory.Peg }, daiPSMFeiSkimmer: { artifactName: 'FeiSkimmer', diff --git a/test/integration/proposals_config.ts b/test/integration/proposals_config.ts index c962c8c5d..a844b6bd1 100644 --- a/test/integration/proposals_config.ts +++ b/test/integration/proposals_config.ts @@ -10,7 +10,7 @@ const proposals: ProposalsConfigMap = { proposal: fip_105, // full proposal file, imported from '@proposals/description/fip_xx.ts' proposalId: '', affectedContractSignoff: ['daiFixedPricePSMFeiSkimmer'], - deprecatedContractSignoff: [''], + deprecatedContractSignoff: [], category: ProposalCategory.DAO }, withdraw_d3_pool: { @@ -19,7 +19,7 @@ const proposals: ProposalsConfigMap = { proposal: withdrawD3Pool, // full proposal file, imported from '@proposals/description/fip_xx.ts' proposalId: '', affectedContractSignoff: ['pcvGuardianNew', 'd3poolCurvePCVDeposit', 'd3poolConvexPCVDeposit', 'daiFixedPricePSM'], - deprecatedContractSignoff: [''], + deprecatedContractSignoff: [], category: ProposalCategory.TC } }; From 7263d18e986c1e5adfa97276b169d179c5531215 Mon Sep 17 00:00:00 2001 From: thomas-waite Date: Tue, 10 May 2022 21:17:00 +0100 Subject: [PATCH 031/274] feat: add setter for Source, increase skim threshold --- contracts/pcv/utils/FeiSkimmer.sol | 10 +++++++++- proposals/dao/fip_105.ts | 2 +- test/unit/pcv/utils/FeiSkimmer.test.ts | 17 +++++++++++++++++ 3 files changed, 27 insertions(+), 2 deletions(-) diff --git a/contracts/pcv/utils/FeiSkimmer.sol b/contracts/pcv/utils/FeiSkimmer.sol index 21bff5f64..aab9b07c7 100644 --- a/contracts/pcv/utils/FeiSkimmer.sol +++ b/contracts/pcv/utils/FeiSkimmer.sol @@ -8,9 +8,10 @@ import "../../refs/CoreRef.sol"; /// @author Fei Protocol contract FeiSkimmer is CoreRef { event ThresholdUpdate(uint256 newThreshold); + event SourceUpdate(address newSource); /// @notice source PCV deposit to skim excess FEI from - IPCVDeposit public immutable source; + IPCVDeposit public source; /// @notice the threshold of FEI above which to skim uint256 public threshold; @@ -53,4 +54,11 @@ contract FeiSkimmer is CoreRef { threshold = newThreshold; emit ThresholdUpdate(newThreshold); } + + /// @notice Set the target to skim from. Only Governor or Admin + /// @param newSource the new source to skim from + function setSource(address newSource) external onlyGovernorOrAdmin { + source = IPCVDeposit(newSource); + emit SourceUpdate(newSource); + } } diff --git a/proposals/dao/fip_105.ts b/proposals/dao/fip_105.ts index 536879084..9270aa3c6 100644 --- a/proposals/dao/fip_105.ts +++ b/proposals/dao/fip_105.ts @@ -16,7 +16,7 @@ Description: Deploy a Fei skimmer for the DAI PSM */ const fipNumber = '105'; -const skimThreshold = ethers.constants.WeiPerEther.mul(10_000_000); +const skimThreshold = ethers.constants.WeiPerEther.mul(20_000_000); const deploy: DeployUpgradeFunc = async (deployAddress: string, addresses: NamedAddresses, logging: boolean) => { // 1. Deploy a Fei Skimmer for the DAI PSM diff --git a/test/unit/pcv/utils/FeiSkimmer.test.ts b/test/unit/pcv/utils/FeiSkimmer.test.ts index f3a1890fd..e11a2fc42 100644 --- a/test/unit/pcv/utils/FeiSkimmer.test.ts +++ b/test/unit/pcv/utils/FeiSkimmer.test.ts @@ -81,4 +81,21 @@ describe('FeiSkimmer', function () { ); }); }); + + describe('Set Source', function () { + it('from governor succeeds', async function () { + expect(await skimmer.source()).to.be.equal(source.address); + + await skimmer.connect(impersonatedSigners[governorAddress]).setSource(userAddress); + + expect(await skimmer.source()).to.be.equal(userAddress); + }); + + it('not from governor succeeds', async function () { + await expectRevert( + skimmer.connect(impersonatedSigners[userAddress]).setSource(userAddress), + 'CoreRef: Caller is not a governor or contract admin' + ); + }); + }); }); From 9110fc1430e650d90e4f3ac5afa5b9635f0bba1f Mon Sep 17 00:00:00 2001 From: thomas-waite Date: Tue, 10 May 2022 23:26:48 +0100 Subject: [PATCH 032/274] feat: add mainnet address --- protocol-configuration/mainnetAddresses.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/protocol-configuration/mainnetAddresses.ts b/protocol-configuration/mainnetAddresses.ts index 315bff400..728a075a0 100644 --- a/protocol-configuration/mainnetAddresses.ts +++ b/protocol-configuration/mainnetAddresses.ts @@ -1678,7 +1678,7 @@ const MainnetAddresses: MainnetAddresses = { }, daiFixedPriceFeiSkimmer: { artifactName: 'FeiSkimmer', - address: '', + address: '0x03dF86Dbe97e31d18864978baAAc6D697Ed6df36', category: AddressCategory.Peg }, daiPSMFeiSkimmer: { From dc64a3abd6ae05ea6c7b18996f13ac4545f132de Mon Sep 17 00:00:00 2001 From: thomas-waite Date: Tue, 10 May 2022 23:31:32 +0100 Subject: [PATCH 033/274] docs: update test name nit --- protocol-configuration/permissions.ts | 3 +-- test/unit/pcv/utils/FeiSkimmer.test.ts | 4 ++-- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/protocol-configuration/permissions.ts b/protocol-configuration/permissions.ts index 8f3765a9f..ca1aaae8c 100644 --- a/protocol-configuration/permissions.ts +++ b/protocol-configuration/permissions.ts @@ -22,8 +22,7 @@ export const permissions = { 'lusdPCVDripController', 'ethPSMFeiSkimmer', 'lusdPSMFeiSkimmer', - 'raiPCVDripController', - 'daiFixedPriceFeiSkimmer' + 'raiPCVDripController' ], GUARDIAN_ROLE: ['multisig', 'pcvGuardianNew', 'pcvSentinel'], ORACLE_ADMIN_ROLE: [ diff --git a/test/unit/pcv/utils/FeiSkimmer.test.ts b/test/unit/pcv/utils/FeiSkimmer.test.ts index e11a2fc42..dfad53b18 100644 --- a/test/unit/pcv/utils/FeiSkimmer.test.ts +++ b/test/unit/pcv/utils/FeiSkimmer.test.ts @@ -74,7 +74,7 @@ describe('FeiSkimmer', function () { expect(await skimmer.threshold()).to.be.equal(0); }); - it('not from governor succeeds', async function () { + it('not from governor fails', async function () { await expectRevert( skimmer.connect(impersonatedSigners[userAddress]).setThreshold(0), 'CoreRef: Caller is not a governor or contract admin' @@ -91,7 +91,7 @@ describe('FeiSkimmer', function () { expect(await skimmer.source()).to.be.equal(userAddress); }); - it('not from governor succeeds', async function () { + it('not from governor fails', async function () { await expectRevert( skimmer.connect(impersonatedSigners[userAddress]).setSource(userAddress), 'CoreRef: Caller is not a governor or contract admin' From 3f4c85ec5be002ee0129198c6cb7166500068257 Mon Sep 17 00:00:00 2001 From: thomas-waite Date: Wed, 11 May 2022 00:32:44 +0100 Subject: [PATCH 034/274] refactor: update naming and block number --- block.txt | 2 +- protocol-configuration/mainnetAddresses.ts | 2 +- protocol-configuration/permissions.ts | 3 ++- test/integration/proposals_config.ts | 2 +- 4 files changed, 5 insertions(+), 4 deletions(-) diff --git a/block.txt b/block.txt index ff8768fe4..f8f3c141f 100644 --- a/block.txt +++ b/block.txt @@ -1 +1 @@ -14742151 \ No newline at end of file +14751415 \ No newline at end of file diff --git a/protocol-configuration/mainnetAddresses.ts b/protocol-configuration/mainnetAddresses.ts index 728a075a0..903d10c1f 100644 --- a/protocol-configuration/mainnetAddresses.ts +++ b/protocol-configuration/mainnetAddresses.ts @@ -1676,7 +1676,7 @@ const MainnetAddresses: MainnetAddresses = { address: '0xFf419Bc27483edb94b7Ad5c97b7FaB5DB323c7E0', category: AddressCategory.Deprecated }, - daiFixedPriceFeiSkimmer: { + daiFixedPricePSMFeiSkimmer: { artifactName: 'FeiSkimmer', address: '0x03dF86Dbe97e31d18864978baAAc6D697Ed6df36', category: AddressCategory.Peg diff --git a/protocol-configuration/permissions.ts b/protocol-configuration/permissions.ts index ca1aaae8c..127367517 100644 --- a/protocol-configuration/permissions.ts +++ b/protocol-configuration/permissions.ts @@ -22,7 +22,8 @@ export const permissions = { 'lusdPCVDripController', 'ethPSMFeiSkimmer', 'lusdPSMFeiSkimmer', - 'raiPCVDripController' + 'raiPCVDripController', + 'daiFixedPricePSMFeiSkimmer' ], GUARDIAN_ROLE: ['multisig', 'pcvGuardianNew', 'pcvSentinel'], ORACLE_ADMIN_ROLE: [ diff --git a/test/integration/proposals_config.ts b/test/integration/proposals_config.ts index a844b6bd1..e38ab1a4a 100644 --- a/test/integration/proposals_config.ts +++ b/test/integration/proposals_config.ts @@ -5,7 +5,7 @@ import fip_105 from '@proposals/description/fip_105'; const proposals: ProposalsConfigMap = { fip_105: { - deploy: true, // deploy flag for whether to run deploy action during e2e tests or use mainnet state + deploy: false, // deploy flag for whether to run deploy action during e2e tests or use mainnet state totalValue: 0, // amount of ETH to send to DAO execution proposal: fip_105, // full proposal file, imported from '@proposals/description/fip_xx.ts' proposalId: '', From a7098c14308dd61feefc97f8432dba9203e44407 Mon Sep 17 00:00:00 2001 From: thomas-waite Date: Wed, 11 May 2022 00:54:20 +0100 Subject: [PATCH 035/274] deps: update contract dependencies --- protocol-configuration/dependencies.ts | 6 +++++- test/integration/proposals_config.ts | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/protocol-configuration/dependencies.ts b/protocol-configuration/dependencies.ts index b1ce07647..cd565a389 100644 --- a/protocol-configuration/dependencies.ts +++ b/protocol-configuration/dependencies.ts @@ -134,7 +134,8 @@ const dependencies: DependencyMap = { 'nopeDAO', 'podAdminGateway', 'podFactory', - 'roleBastion' + 'roleBastion', + 'daiFixedPricePSMFeiSkimmer' ] }, fei: { @@ -1070,6 +1071,9 @@ const dependencies: DependencyMap = { }, balancerLensBpt30Fei70Weth: { contractDependencies: ['oneConstantOracle', 'chainlinkEthUsdOracleWrapper'] + }, + daiFixedPricePSMFeiSkimmer: { + contractDependencies: ['core'] } }; diff --git a/test/integration/proposals_config.ts b/test/integration/proposals_config.ts index e38ab1a4a..1f1a5ff84 100644 --- a/test/integration/proposals_config.ts +++ b/test/integration/proposals_config.ts @@ -9,7 +9,7 @@ const proposals: ProposalsConfigMap = { totalValue: 0, // amount of ETH to send to DAO execution proposal: fip_105, // full proposal file, imported from '@proposals/description/fip_xx.ts' proposalId: '', - affectedContractSignoff: ['daiFixedPricePSMFeiSkimmer'], + affectedContractSignoff: ['daiFixedPricePSMFeiSkimmer', 'core'], deprecatedContractSignoff: [], category: ProposalCategory.DAO }, From 08f0f7ed46561b708c90825a732e77f4726ef2fe Mon Sep 17 00:00:00 2001 From: thomas-waite Date: Wed, 11 May 2022 00:57:25 +0100 Subject: [PATCH 036/274] feat: deploy script for LBP swapper --- proposals/dao/swap_dpi.ts | 77 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 77 insertions(+) create mode 100644 proposals/dao/swap_dpi.ts diff --git a/proposals/dao/swap_dpi.ts b/proposals/dao/swap_dpi.ts new file mode 100644 index 000000000..efc9d1954 --- /dev/null +++ b/proposals/dao/swap_dpi.ts @@ -0,0 +1,77 @@ +import hre, { ethers, artifacts } from 'hardhat'; +import { expect } from 'chai'; +import { + DeployUpgradeFunc, + NamedAddresses, + SetupUpgradeFunc, + TeardownUpgradeFunc, + ValidateUpgradeFunc +} from '@custom-types/types'; + +/* + +Swap DPI for DAI + +Description: + +Steps: + 1 - + 2 - + 3 - + +*/ + +const fipNumber = 'swap_dpi'; + +// LBP Swapper config +const LBP_FREQUENCY = '86400'; // 24 hours +const MIN_LBP_SIZE = ethers.constants.WeiPerEther.mul(1_000_000); // 1M +let poolId; // auction pool id + +const deploy: DeployUpgradeFunc = async (deployAddress: string, addresses: NamedAddresses, logging: boolean) => { + const BalancerLBPSwapperFactory = await ethers.getContractFactory('BalancerLBPSwapper'); + const dpiToDaiSwapper = await BalancerLBPSwapperFactory.deploy( + addresses.core, + { + _oracle: addresses.chainlinkDpiUsdOracleWrapper, + _backupOracle: ethers.constants.AddressZero, + _invertOraclePrice: true, + _decimalsNormalizer: 0 + }, + LBP_FREQUENCY, + '100000000000000000', // small weight 10% + '900000000000000000', // large weight 90% + addresses.dpi, + addresses.dai, + addresses.daiFixedPricePSM, // send DAI to DAI PSM + MIN_LBP_SIZE + ); + + await dpiToDaiSwapper.deployed(); + logging && console.log('DPI to DAI swapper deployed to: ', dpiToDaiSwapper.address); + + return { + dpiToDaiSwapper + }; +}; + +// Do any setup necessary for running the test. +// This could include setting up Hardhat to impersonate accounts, +// ensuring contracts have a specific state, etc. +const setup: SetupUpgradeFunc = async (addresses, oldContracts, contracts, logging) => { + console.log(`No actions to complete in setup for fip${fipNumber}`); +}; + +// Tears down any changes made in setup() that need to be +// cleaned up before doing any validation checks. +const teardown: TeardownUpgradeFunc = async (addresses, oldContracts, contracts, logging) => { + console.log(`No actions to complete in teardown for fip${fipNumber}`); +}; + +// Run any validations required on the fip using mocha or console logging +// IE check balances, check state of contracts, etc. +const validate: ValidateUpgradeFunc = async (addresses, oldContracts, contracts, logging) => { + console.log(`No actions to complete in validate for fip${fipNumber}`); +}; + +export { deploy, setup, teardown, validate }; From 70f4546a26520ec00638f9a2580bb10f8fd685d1 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 11 May 2022 07:26:34 +0000 Subject: [PATCH 037/274] Bump dotenv from 16.0.0 to 16.0.1 Bumps [dotenv](https://github.com/motdotla/dotenv) from 16.0.0 to 16.0.1. - [Release notes](https://github.com/motdotla/dotenv/releases) - [Changelog](https://github.com/motdotla/dotenv/blob/master/CHANGELOG.md) - [Commits](https://github.com/motdotla/dotenv/compare/v16.0.0...v16.0.1) --- updated-dependencies: - dependency-name: dotenv dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- package-lock.json | 14 +++++++------- package.json | 2 +- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/package-lock.json b/package-lock.json index 6f9040ba1..57463d5d7 100644 --- a/package-lock.json +++ b/package-lock.json @@ -24,7 +24,7 @@ "@uniswap/v2-core": "^1.0.1", "@uniswap/v2-periphery": "^1.1.0-beta.0", "chai": "^4.3.6", - "dotenv": "^16.0.0", + "dotenv": "^16.0.1", "hardhat": "^2.9.3", "hardhat-contract-sizer": "^2.5.1", "hardhat-gas-reporter": "^1.0.8", @@ -7124,9 +7124,9 @@ } }, "node_modules/dotenv": { - "version": "16.0.0", - "resolved": "https://registry.npmjs.org/dotenv/-/dotenv-16.0.0.tgz", - "integrity": "sha512-qD9WU0MPM4SWLPJy/r2Be+2WgQj8plChsyrCNQzW/0WjvcJQiKQJ9mH3ZgB3fxbUUxgc/11ZJ0Fi5KiimWGz2Q==", + "version": "16.0.1", + "resolved": "https://registry.npmjs.org/dotenv/-/dotenv-16.0.1.tgz", + "integrity": "sha512-1K6hR6wtk2FviQ4kEiSjFiH5rpzEVi8WW0x96aztHVMhEspNpc4DVOUTEHtEva5VThQ8IaBX1Pe4gSzpVVUsKQ==", "engines": { "node": ">=12" } @@ -34478,9 +34478,9 @@ } }, "dotenv": { - "version": "16.0.0", - "resolved": "https://registry.npmjs.org/dotenv/-/dotenv-16.0.0.tgz", - "integrity": "sha512-qD9WU0MPM4SWLPJy/r2Be+2WgQj8plChsyrCNQzW/0WjvcJQiKQJ9mH3ZgB3fxbUUxgc/11ZJ0Fi5KiimWGz2Q==" + "version": "16.0.1", + "resolved": "https://registry.npmjs.org/dotenv/-/dotenv-16.0.1.tgz", + "integrity": "sha512-1K6hR6wtk2FviQ4kEiSjFiH5rpzEVi8WW0x96aztHVMhEspNpc4DVOUTEHtEva5VThQ8IaBX1Pe4gSzpVVUsKQ==" }, "duplexer3": { "version": "0.1.4", diff --git a/package.json b/package.json index 88614510a..ed25925fc 100644 --- a/package.json +++ b/package.json @@ -64,7 +64,7 @@ "@uniswap/v2-core": "^1.0.1", "@uniswap/v2-periphery": "^1.1.0-beta.0", "chai": "^4.3.6", - "dotenv": "^16.0.0", + "dotenv": "^16.0.1", "hardhat": "^2.9.3", "hardhat-contract-sizer": "^2.5.1", "hardhat-gas-reporter": "^1.0.8", From 8c196125f55656fe25dbe3d9ecb479901f76ff9f Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 11 May 2022 07:28:39 +0000 Subject: [PATCH 038/274] Bump @types/node from 17.0.31 to 17.0.32 Bumps [@types/node](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/node) from 17.0.31 to 17.0.32. - [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases) - [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/node) --- updated-dependencies: - dependency-name: "@types/node" dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- package-lock.json | 14 +++++++------- package.json | 2 +- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/package-lock.json b/package-lock.json index 6f9040ba1..370ac4fa2 100644 --- a/package-lock.json +++ b/package-lock.json @@ -39,7 +39,7 @@ "@typechain/hardhat": "^2.3.0", "@types/chai": "^4.3.1", "@types/mocha": "^9.1.1", - "@types/node": "^17.0.31", + "@types/node": "^17.0.32", "@typescript-eslint/eslint-plugin": "^4.31.2", "@typescript-eslint/parser": "^4.31.2", "chai-bn": "^0.3.1", @@ -4471,9 +4471,9 @@ "dev": true }, "node_modules/@types/node": { - "version": "17.0.31", - "resolved": "https://registry.npmjs.org/@types/node/-/node-17.0.31.tgz", - "integrity": "sha512-AR0x5HbXGqkEx9CadRH3EBYx/VkiUgZIhP4wvPn/+5KIsgpNoyFaRlVe0Zlx9gRtg8fA06a9tskE2MSN7TcG4Q==" + "version": "17.0.32", + "resolved": "https://registry.npmjs.org/@types/node/-/node-17.0.32.tgz", + "integrity": "sha512-eAIcfAvhf/BkHcf4pkLJ7ECpBAhh9kcxRBpip9cTiO+hf+aJrsxYxBeS6OXvOd9WqNAJmavXVpZvY1rBjNsXmw==" }, "node_modules/@types/node-fetch": { "version": "2.6.1", @@ -32390,9 +32390,9 @@ "dev": true }, "@types/node": { - "version": "17.0.31", - "resolved": "https://registry.npmjs.org/@types/node/-/node-17.0.31.tgz", - "integrity": "sha512-AR0x5HbXGqkEx9CadRH3EBYx/VkiUgZIhP4wvPn/+5KIsgpNoyFaRlVe0Zlx9gRtg8fA06a9tskE2MSN7TcG4Q==" + "version": "17.0.32", + "resolved": "https://registry.npmjs.org/@types/node/-/node-17.0.32.tgz", + "integrity": "sha512-eAIcfAvhf/BkHcf4pkLJ7ECpBAhh9kcxRBpip9cTiO+hf+aJrsxYxBeS6OXvOd9WqNAJmavXVpZvY1rBjNsXmw==" }, "@types/node-fetch": { "version": "2.6.1", diff --git a/package.json b/package.json index 88614510a..67c698fde 100644 --- a/package.json +++ b/package.json @@ -79,7 +79,7 @@ "@typechain/hardhat": "^2.3.0", "@types/chai": "^4.3.1", "@types/mocha": "^9.1.1", - "@types/node": "^17.0.31", + "@types/node": "^17.0.32", "@typescript-eslint/eslint-plugin": "^4.31.2", "@typescript-eslint/parser": "^4.31.2", "chai-bn": "^0.3.1", From 5825bbca012c621d5eab8edbb1684a2d7d71d73b Mon Sep 17 00:00:00 2001 From: thomas-waite Date: Wed, 11 May 2022 00:51:25 +0100 Subject: [PATCH 039/274] feat: withdraw aave and compound fei --- proposals/dao/withdraw_aave_comp_fei.ts | 54 +++++++++++++++++++ .../description/withdraw_aave_comp_fei.ts | 24 +++++++++ 2 files changed, 78 insertions(+) create mode 100644 proposals/dao/withdraw_aave_comp_fei.ts create mode 100644 proposals/description/withdraw_aave_comp_fei.ts diff --git a/proposals/dao/withdraw_aave_comp_fei.ts b/proposals/dao/withdraw_aave_comp_fei.ts new file mode 100644 index 000000000..d2eb8655d --- /dev/null +++ b/proposals/dao/withdraw_aave_comp_fei.ts @@ -0,0 +1,54 @@ +import hre, { ethers, artifacts } from 'hardhat'; +import { expect } from 'chai'; +import { + DeployUpgradeFunc, + NamedAddresses, + SetupUpgradeFunc, + TeardownUpgradeFunc, + ValidateUpgradeFunc +} from '@custom-types/types'; + +/* + +DAO Proposal #9001 + +Description: + +Steps: + 1 - + 2 - + 3 - + +*/ + +const fipNumber = '9001'; // Change me! + +// Do any deployments +// This should exclusively include new contract deployments +const deploy: DeployUpgradeFunc = async (deployAddress: string, addresses: NamedAddresses, logging: boolean) => { + console.log(`No deploy actions for fip${fipNumber}`); + return { + // put returned contract objects here + }; +}; + +// Do any setup necessary for running the test. +// This could include setting up Hardhat to impersonate accounts, +// ensuring contracts have a specific state, etc. +const setup: SetupUpgradeFunc = async (addresses, oldContracts, contracts, logging) => { + console.log(`No actions to complete in setup for fip${fipNumber}`); +}; + +// Tears down any changes made in setup() that need to be +// cleaned up before doing any validation checks. +const teardown: TeardownUpgradeFunc = async (addresses, oldContracts, contracts, logging) => { + console.log(`No actions to complete in teardown for fip${fipNumber}`); +}; + +// Run any validations required on the fip using mocha or console logging +// IE check balances, check state of contracts, etc. +const validate: ValidateUpgradeFunc = async (addresses, oldContracts, contracts, logging) => { + console.log(`No actions to complete in validate for fip${fipNumber}`); +}; + +export { deploy, setup, teardown, validate }; diff --git a/proposals/description/withdraw_aave_comp_fei.ts b/proposals/description/withdraw_aave_comp_fei.ts new file mode 100644 index 000000000..6dc6c7055 --- /dev/null +++ b/proposals/description/withdraw_aave_comp_fei.ts @@ -0,0 +1,24 @@ +import { ProposalDescription } from '@custom-types/types'; + +const fip_x: ProposalDescription = { + title: 'Withdraw Fei from Aave and Compound', + commands: [ + { + target: 'pcvGuardianNew', + values: '0', + method: 'withdrawToSafeAddress(address,address,uint256,bool,bool)', + arguments: ['{}', '{daiFixedPricePSM}', '6400000000000000000000000', false, false], + description: 'Withdraw 6.4M Fei from Aave to the DAI PSM' + }, + { + target: 'pcvGuardianNew', + values: '0', + method: 'withdrawToSafeAddress(address,address,uint256,bool,bool)', + arguments: ['{}', '{daiFixedPricePSM}', '3000000000000000000000000', false, false], + description: 'Withdraw 3M Fei from Compound to the DAI PSM' + } + ], + description: 'Withdraw 6.4M FEI from Aave and 3M FEI from Compound to the DAI PSM' +}; + +export default fip_x; From 02c82d56b6ec42dcd50103cc797671bef8aa45f3 Mon Sep 17 00:00:00 2001 From: thomas-waite Date: Wed, 11 May 2022 14:32:19 +0100 Subject: [PATCH 040/274] feat: add aave and compound fei withdrawal test add mainnet address for underlying compound deposit --- proposals/dao/withdraw_aave_comp_fei.ts | 52 ++++++++++++++----- .../description/withdraw_aave_comp_fei.ts | 4 +- protocol-configuration/mainnetAddresses.ts | 5 ++ test/integration/proposals_config.ts | 22 ++++---- 4 files changed, 55 insertions(+), 28 deletions(-) diff --git a/proposals/dao/withdraw_aave_comp_fei.ts b/proposals/dao/withdraw_aave_comp_fei.ts index d2eb8655d..cb9e3c224 100644 --- a/proposals/dao/withdraw_aave_comp_fei.ts +++ b/proposals/dao/withdraw_aave_comp_fei.ts @@ -7,29 +7,25 @@ import { TeardownUpgradeFunc, ValidateUpgradeFunc } from '@custom-types/types'; +import { BigNumber } from 'ethers'; +import { forceEth } from '@test/integration/setup/utils'; /* - -DAO Proposal #9001 - -Description: - -Steps: - 1 - - 2 - - 3 - - +Withdraw FEI from Aave and Compound */ const fipNumber = '9001'; // Change me! +let aavePCVBalanceBefore: BigNumber; +let compoundPCVBalanceBefore: BigNumber; +let daiInitialPSMFeiBalance: BigNumber; +const totalFeiWithdraw = ethers.constants.WeiPerEther.mul(9_400_000); + // Do any deployments // This should exclusively include new contract deployments const deploy: DeployUpgradeFunc = async (deployAddress: string, addresses: NamedAddresses, logging: boolean) => { console.log(`No deploy actions for fip${fipNumber}`); - return { - // put returned contract objects here - }; + return {}; }; // Do any setup necessary for running the test. @@ -37,6 +33,12 @@ const deploy: DeployUpgradeFunc = async (deployAddress: string, addresses: Named // ensuring contracts have a specific state, etc. const setup: SetupUpgradeFunc = async (addresses, oldContracts, contracts, logging) => { console.log(`No actions to complete in setup for fip${fipNumber}`); + aavePCVBalanceBefore = await contracts.aaveFeiPCVDeposit.balance(); + compoundPCVBalanceBefore = await contracts.compoundPCVDepositWrapper.balance(); + daiInitialPSMFeiBalance = await contracts.daiFixedPricePSM.feiBalance(); + + await forceEth(addresses.tribalCouncilTimelock); + await forceEth(addresses.tribalCouncilSafe); }; // Tears down any changes made in setup() that need to be @@ -48,7 +50,29 @@ const teardown: TeardownUpgradeFunc = async (addresses, oldContracts, contracts, // Run any validations required on the fip using mocha or console logging // IE check balances, check state of contracts, etc. const validate: ValidateUpgradeFunc = async (addresses, oldContracts, contracts, logging) => { - console.log(`No actions to complete in validate for fip${fipNumber}`); + // 1. Validate Aave PCV deposit + const aavePCVBalanceAfter = await contracts.aaveFeiPCVDeposit.balance(); + expect(aavePCVBalanceAfter).to.bignumber.at.least( + aavePCVBalanceBefore.sub(ethers.constants.WeiPerEther.mul(6_500_000)) + ); + + expect(aavePCVBalanceAfter).to.bignumber.at.most( + aavePCVBalanceBefore.sub(ethers.constants.WeiPerEther.mul(6_300_000)) + ); + + // 2. Validate Compound PCV deposit + const compoundPCVBalanceAfter = await contracts.compoundPCVDepositWrapper.balance(); + expect(compoundPCVBalanceAfter).to.bignumber.at.least( + compoundPCVBalanceBefore.sub(ethers.constants.WeiPerEther.mul(3_100_000)) + ); + + expect(compoundPCVBalanceAfter).to.bignumber.at.most( + compoundPCVBalanceBefore.sub(ethers.constants.WeiPerEther.mul(2_900_000)) + ); + + // 3. Validate funds received by DAI PSM + const daiFixedPricePSMBalance = await contracts.daiFixedPricePSM.feiBalance(); + expect(daiFixedPricePSMBalance).to.be.equal(daiInitialPSMFeiBalance.add(totalFeiWithdraw)); }; export { deploy, setup, teardown, validate }; diff --git a/proposals/description/withdraw_aave_comp_fei.ts b/proposals/description/withdraw_aave_comp_fei.ts index 6dc6c7055..f98912850 100644 --- a/proposals/description/withdraw_aave_comp_fei.ts +++ b/proposals/description/withdraw_aave_comp_fei.ts @@ -7,14 +7,14 @@ const fip_x: ProposalDescription = { target: 'pcvGuardianNew', values: '0', method: 'withdrawToSafeAddress(address,address,uint256,bool,bool)', - arguments: ['{}', '{daiFixedPricePSM}', '6400000000000000000000000', false, false], + arguments: ['{aaveFeiPCVDeposit}', '{daiFixedPricePSM}', '6400000000000000000000000', false, false], description: 'Withdraw 6.4M Fei from Aave to the DAI PSM' }, { target: 'pcvGuardianNew', values: '0', method: 'withdrawToSafeAddress(address,address,uint256,bool,bool)', - arguments: ['{}', '{daiFixedPricePSM}', '3000000000000000000000000', false, false], + arguments: ['{compoundUnderlyingPCVDepost}', '{daiFixedPricePSM}', '3000000000000000000000000', false, false], description: 'Withdraw 3M Fei from Compound to the DAI PSM' } ], diff --git a/protocol-configuration/mainnetAddresses.ts b/protocol-configuration/mainnetAddresses.ts index 89b4d82f1..94ff4491d 100644 --- a/protocol-configuration/mainnetAddresses.ts +++ b/protocol-configuration/mainnetAddresses.ts @@ -1981,6 +1981,11 @@ const MainnetAddresses: MainnetAddresses = { address: '0xB80B3dc4F8B30589477b2bA0e4EF2b8224bDf0a5', category: AddressCategory.PCV }, + compoundUnderlyingPCVDepost: { + artifactName: 'PCVDeposit', + address: '0xe1f2a7342459b54fbfea9f40695cdd46efadeeee', + category: AddressCategory.PCV_V1 + }, turboFusePCVDeposit: { artifactName: 'ERC20CompoundPCVDeposit', address: '0x2c47Fef515d2C70F2427706999E158533F7cF090', diff --git a/test/integration/proposals_config.ts b/test/integration/proposals_config.ts index e825c3957..8c87408e7 100644 --- a/test/integration/proposals_config.ts +++ b/test/integration/proposals_config.ts @@ -1,19 +1,17 @@ import { ProposalCategory, ProposalsConfigMap } from '@custom-types/types'; -// import fip_xx_proposal from '@proposals/description/fip_xx'; +import withdraw_aave_comp_fei from '@proposals/description/withdraw_aave_comp_fei'; const proposals: ProposalsConfigMap = { - /* - fip_xx: { - deploy: true, // deploy flag for whether to run deploy action during e2e tests or use mainnet state - totalValue: 0, // amount of ETH to send to DAO execution - proposal: fip_xx, // full proposal file, imported from '@proposals/description/fip_xx.ts' - proposalId: '', - affectedContractSignoff: [''], - deprecatedContractSignoff: [''], - category: ProposalCategory.DAO - } - */ + withdraw_aave_comp_fei: { + deploy: true, // deploy flag for whether to run deploy action during e2e tests or use mainnet state + totalValue: 0, // amount of ETH to send to DAO execution + proposal: withdraw_aave_comp_fei, // full proposal file, imported from '@proposals/description/fip_xx.ts' + proposalId: '', + affectedContractSignoff: [''], + deprecatedContractSignoff: [''], + category: ProposalCategory.TC + } }; export default proposals; From 40e9da077d5bf5b41d6080f48d00a3d80b6dc914 Mon Sep 17 00:00:00 2001 From: thomas-waite Date: Wed, 11 May 2022 14:51:50 +0100 Subject: [PATCH 041/274] refactor: rename compound pcv deposits --- proposals/dao/withdraw_aave_comp_fei.ts | 4 ++-- proposals/description/withdraw_aave_comp_fei.ts | 2 +- protocol-configuration/collateralizationOracle.ts | 2 +- protocol-configuration/mainnetAddresses.ts | 4 ++-- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/proposals/dao/withdraw_aave_comp_fei.ts b/proposals/dao/withdraw_aave_comp_fei.ts index cb9e3c224..813a293dd 100644 --- a/proposals/dao/withdraw_aave_comp_fei.ts +++ b/proposals/dao/withdraw_aave_comp_fei.ts @@ -34,7 +34,7 @@ const deploy: DeployUpgradeFunc = async (deployAddress: string, addresses: Named const setup: SetupUpgradeFunc = async (addresses, oldContracts, contracts, logging) => { console.log(`No actions to complete in setup for fip${fipNumber}`); aavePCVBalanceBefore = await contracts.aaveFeiPCVDeposit.balance(); - compoundPCVBalanceBefore = await contracts.compoundPCVDepositWrapper.balance(); + compoundPCVBalanceBefore = await contracts.compoundFeiPCVDepositWrapper.balance(); daiInitialPSMFeiBalance = await contracts.daiFixedPricePSM.feiBalance(); await forceEth(addresses.tribalCouncilTimelock); @@ -61,7 +61,7 @@ const validate: ValidateUpgradeFunc = async (addresses, oldContracts, contracts, ); // 2. Validate Compound PCV deposit - const compoundPCVBalanceAfter = await contracts.compoundPCVDepositWrapper.balance(); + const compoundPCVBalanceAfter = await contracts.compoundFeiPCVDepositWrapper.balance(); expect(compoundPCVBalanceAfter).to.bignumber.at.least( compoundPCVBalanceBefore.sub(ethers.constants.WeiPerEther.mul(3_100_000)) ); diff --git a/proposals/description/withdraw_aave_comp_fei.ts b/proposals/description/withdraw_aave_comp_fei.ts index f98912850..493bcca93 100644 --- a/proposals/description/withdraw_aave_comp_fei.ts +++ b/proposals/description/withdraw_aave_comp_fei.ts @@ -14,7 +14,7 @@ const fip_x: ProposalDescription = { target: 'pcvGuardianNew', values: '0', method: 'withdrawToSafeAddress(address,address,uint256,bool,bool)', - arguments: ['{compoundUnderlyingPCVDepost}', '{daiFixedPricePSM}', '3000000000000000000000000', false, false], + arguments: ['{compoundFeiPCVDeposit}', '{daiFixedPricePSM}', '3000000000000000000000000', false, false], description: 'Withdraw 3M Fei from Compound to the DAI PSM' } ], diff --git a/protocol-configuration/collateralizationOracle.ts b/protocol-configuration/collateralizationOracle.ts index 94dc4861a..b09a7a990 100644 --- a/protocol-configuration/collateralizationOracle.ts +++ b/protocol-configuration/collateralizationOracle.ts @@ -17,7 +17,7 @@ const collateralizationAddresses = { 'rariPool22FeiPCVDepositWrapper', 'feiBuybackLensNoFee', 'convexPoolPCVDepositWrapper', - 'compoundPCVDepositWrapper', + 'compoundFeiPCVDepositWrapper', 'turboFusePCVDeposit' ], lusd: [ diff --git a/protocol-configuration/mainnetAddresses.ts b/protocol-configuration/mainnetAddresses.ts index 94ff4491d..7d9b9ca02 100644 --- a/protocol-configuration/mainnetAddresses.ts +++ b/protocol-configuration/mainnetAddresses.ts @@ -1976,12 +1976,12 @@ const MainnetAddresses: MainnetAddresses = { address: '0x1370CA8655C255948d6c6110066d78680601B7c2', category: AddressCategory.PCV }, - compoundPCVDepositWrapper: { + compoundFeiPCVDepositWrapper: { artifactName: 'PCVDepositWrapper', address: '0xB80B3dc4F8B30589477b2bA0e4EF2b8224bDf0a5', category: AddressCategory.PCV }, - compoundUnderlyingPCVDepost: { + compoundFeiPCVDeposit: { artifactName: 'PCVDeposit', address: '0xe1f2a7342459b54fbfea9f40695cdd46efadeeee', category: AddressCategory.PCV_V1 From 520ac768c4f8c658e9475d365de2054819e341a0 Mon Sep 17 00:00:00 2001 From: thomas-waite Date: Wed, 11 May 2022 16:42:26 +0100 Subject: [PATCH 042/274] refactor: set skimmer contract admin, scope setSource to Governor --- contracts/pcv/utils/FeiSkimmer.sol | 5 +++-- proposals/dao/fip_105.ts | 3 +++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/contracts/pcv/utils/FeiSkimmer.sol b/contracts/pcv/utils/FeiSkimmer.sol index aab9b07c7..5312c23cb 100644 --- a/contracts/pcv/utils/FeiSkimmer.sol +++ b/contracts/pcv/utils/FeiSkimmer.sol @@ -27,6 +27,7 @@ contract FeiSkimmer is CoreRef { ) CoreRef(_core) { source = _source; threshold = _threshold; + _setContractAdminRole(keccak256("PCV_MINOR_PARAM_ROLE")); emit ThresholdUpdate(threshold); } @@ -55,9 +56,9 @@ contract FeiSkimmer is CoreRef { emit ThresholdUpdate(newThreshold); } - /// @notice Set the target to skim from. Only Governor or Admin + /// @notice Set the target to skim from. Only Governor /// @param newSource the new source to skim from - function setSource(address newSource) external onlyGovernorOrAdmin { + function setSource(address newSource) external onlyGovernor { source = IPCVDeposit(newSource); emit SourceUpdate(newSource); } diff --git a/proposals/dao/fip_105.ts b/proposals/dao/fip_105.ts index 9270aa3c6..36a3c8edc 100644 --- a/proposals/dao/fip_105.ts +++ b/proposals/dao/fip_105.ts @@ -55,6 +55,9 @@ const validate: ValidateUpgradeFunc = async (addresses, oldContracts, contracts, expect(await daiFixedPricePSMFeiSkimmer.threshold()).to.be.equal(skimThreshold); expect(await daiFixedPricePSMFeiSkimmer.source()).to.be.equal(addresses.daiFixedPricePSM); expect(await core.hasRole(ethers.utils.id('PCV_CONTROLLER_ROLE'), daiFixedPricePSMFeiSkimmer.address)).to.be.true; + + // Validate skimmer contract admin role is set to PCV_MINOR_PARAM_ROLE + expect(await daiFixedPricePSMFeiSkimmer.CONTRACT_ADMIN_ROLE(), ethers.utils.id('PCV_MINOR_PARAM_ROLE')).to.be.true; }; export { deploy, setup, teardown, validate }; From 13aee82c05223c46a364390f51d858ae29468f2f Mon Sep 17 00:00:00 2001 From: thomas-waite Date: Wed, 11 May 2022 21:17:27 +0100 Subject: [PATCH 043/274] feat: add validate script and e2e test --- proposals/dao/swap_dpi.ts | 77 ---------- proposals/dao/swap_dpi_to_dai.ts | 209 +++++++++++++++++++++++++++ test/integration/proposals_config.ts | 22 ++- 3 files changed, 219 insertions(+), 89 deletions(-) delete mode 100644 proposals/dao/swap_dpi.ts create mode 100644 proposals/dao/swap_dpi_to_dai.ts diff --git a/proposals/dao/swap_dpi.ts b/proposals/dao/swap_dpi.ts deleted file mode 100644 index efc9d1954..000000000 --- a/proposals/dao/swap_dpi.ts +++ /dev/null @@ -1,77 +0,0 @@ -import hre, { ethers, artifacts } from 'hardhat'; -import { expect } from 'chai'; -import { - DeployUpgradeFunc, - NamedAddresses, - SetupUpgradeFunc, - TeardownUpgradeFunc, - ValidateUpgradeFunc -} from '@custom-types/types'; - -/* - -Swap DPI for DAI - -Description: - -Steps: - 1 - - 2 - - 3 - - -*/ - -const fipNumber = 'swap_dpi'; - -// LBP Swapper config -const LBP_FREQUENCY = '86400'; // 24 hours -const MIN_LBP_SIZE = ethers.constants.WeiPerEther.mul(1_000_000); // 1M -let poolId; // auction pool id - -const deploy: DeployUpgradeFunc = async (deployAddress: string, addresses: NamedAddresses, logging: boolean) => { - const BalancerLBPSwapperFactory = await ethers.getContractFactory('BalancerLBPSwapper'); - const dpiToDaiSwapper = await BalancerLBPSwapperFactory.deploy( - addresses.core, - { - _oracle: addresses.chainlinkDpiUsdOracleWrapper, - _backupOracle: ethers.constants.AddressZero, - _invertOraclePrice: true, - _decimalsNormalizer: 0 - }, - LBP_FREQUENCY, - '100000000000000000', // small weight 10% - '900000000000000000', // large weight 90% - addresses.dpi, - addresses.dai, - addresses.daiFixedPricePSM, // send DAI to DAI PSM - MIN_LBP_SIZE - ); - - await dpiToDaiSwapper.deployed(); - logging && console.log('DPI to DAI swapper deployed to: ', dpiToDaiSwapper.address); - - return { - dpiToDaiSwapper - }; -}; - -// Do any setup necessary for running the test. -// This could include setting up Hardhat to impersonate accounts, -// ensuring contracts have a specific state, etc. -const setup: SetupUpgradeFunc = async (addresses, oldContracts, contracts, logging) => { - console.log(`No actions to complete in setup for fip${fipNumber}`); -}; - -// Tears down any changes made in setup() that need to be -// cleaned up before doing any validation checks. -const teardown: TeardownUpgradeFunc = async (addresses, oldContracts, contracts, logging) => { - console.log(`No actions to complete in teardown for fip${fipNumber}`); -}; - -// Run any validations required on the fip using mocha or console logging -// IE check balances, check state of contracts, etc. -const validate: ValidateUpgradeFunc = async (addresses, oldContracts, contracts, logging) => { - console.log(`No actions to complete in validate for fip${fipNumber}`); -}; - -export { deploy, setup, teardown, validate }; diff --git a/proposals/dao/swap_dpi_to_dai.ts b/proposals/dao/swap_dpi_to_dai.ts new file mode 100644 index 000000000..73b2da711 --- /dev/null +++ b/proposals/dao/swap_dpi_to_dai.ts @@ -0,0 +1,209 @@ +import hre, { ethers, artifacts } from 'hardhat'; +import { expect } from 'chai'; +import { TransactionResponse } from '@ethersproject/providers'; +import { + DeployUpgradeFunc, + NamedAddresses, + SetupUpgradeFunc, + TeardownUpgradeFunc, + ValidateUpgradeFunc +} from '@custom-types/types'; +import { getImpersonatedSigner, overwriteChainlinkAggregator, time } from '@test/helpers'; +import { forceEth } from '@test/integration/setup/utils'; + +/* + +Swap DPI for DAI + +*/ + +const fipNumber = 'swap_dpi'; + +// LBP Swapper config +const LBP_FREQUENCY = '86400'; // 24 hours +const MIN_LBP_SIZE = ethers.constants.WeiPerEther.mul(1_000_000); // 1M +let poolId; // auction pool id + +const deploy: DeployUpgradeFunc = async (deployAddress: string, addresses: NamedAddresses, logging: boolean) => { + // DPI: 3,459,532 + // DAI: 147,712 + + // Total: 3,607,244 + // 1. Deploy the Balancer LBP swapper + const BalancerLBPSwapperFactory = await ethers.getContractFactory('BalancerLBPSwapper'); + const dpiToDaiSwapper = await BalancerLBPSwapperFactory.deploy( + addresses.core, + { + _oracle: addresses.chainlinkDpiUsdOracleWrapper, + _backupOracle: ethers.constants.AddressZero, + _invertOraclePrice: true, + _decimalsNormalizer: 0 + }, + LBP_FREQUENCY, + '40000000000000000', // small weight 4% + '960000000000000000', // large weight 96% + addresses.dpi, + addresses.dai, + addresses.daiFixedPricePSM, // send DAI to DAI PSM + MIN_LBP_SIZE // minimum size of a pool which the swapper is used against + ); + + await dpiToDaiSwapper.deployed(); + logging && console.log('DPI to DAI swapper deployed to: ', dpiToDaiSwapper.address); + + // 2. Create a liquidity bootstrapping pool between DPI and DAI + const lbpFactory = await ethers.getContractAt( + 'ILiquidityBootstrappingPoolFactory', + addresses.balancerLBPoolFactoryNoFee + ); + + const tx: TransactionResponse = await lbpFactory.create( + 'DPI->DAI Auction Pool', // pool name + 'apDPI-DAI', // lbp token symbol + [addresses.dpi, addresses.dai], // pool contains [DPI, DAI] + [ethers.constants.WeiPerEther.mul(90).div(100), ethers.constants.WeiPerEther.mul(10).div(100)], // initial weights 10%/90% + ethers.constants.WeiPerEther.mul(30).div(10_000), // 0.3% swap fees + dpiToDaiSwapper.address, // pool owner = fei protocol swapper + true + ); + + // Where does the initial liquidity come from? + + const txReceipt = await tx.wait(); + const { logs: rawLogs } = txReceipt; + const noFeeDpiDaiLBPAddress = `0x${rawLogs[rawLogs.length - 1].topics[1].slice(-40)}`; + poolId = rawLogs[1].topics[1]; + + logging && console.log('LBP Pool deployed to: ', noFeeDpiDaiLBPAddress); + logging && console.log('LBP Pool Id: ', poolId); + + // 3. Initialise the LBP swapper with the pool address + const tx2 = await dpiToDaiSwapper.init(noFeeDpiDaiLBPAddress); + await tx2.wait(); + + // 4. Deploy a lens to report the swapper value - possibly don't need these. Small position + const BPTLensFactory = await ethers.getContractFactory('BPTLens'); + const dpiToDaiLensDai = await BPTLensFactory.deploy( + addresses.dai, // token reported in + noFeeDpiDaiLBPAddress, // pool address + addresses.chainlinkDaiUsdOracleWrapper, // reportedOracle - DAI + addresses.chainlinkDpiUsdOracleWrapper, // otherOracle - DPI + false, // feiIsReportedIn + false // feiIsOther + ); + await dpiToDaiLensDai.deployTransaction.wait(); + + logging && console.log('BPTLens for DPI in swapper pool: ', dpiToDaiLensDai.address); + + const dpiToDaiLensDpi = await BPTLensFactory.deploy( + addresses.dpi, // token reported in + noFeeDpiDaiLBPAddress, // pool address + addresses.chainlinkDpiUsdOracleWrapper, // reportedOracle - DPI + addresses.chainlinkDaiUsdOracleWrapper, // otherOracle - DAI + false, // feiIsReportedIn + false // feiIsOther + ); + + logging && console.log('BPTLens for DAI in swapper pool: ', dpiToDaiLensDpi.address); + + return { + dpiToDaiSwapper, + dpiToDaiLensDai, + dpiToDaiLensDpi + }; +}; + +// Do any setup necessary for running the test. +// This could include setting up Hardhat to impersonate accounts, +// ensuring contracts have a specific state, etc. +const setup: SetupUpgradeFunc = async (addresses, oldContracts, contracts, logging) => { + // overwrite chainlink ETH/USD oracle + await overwriteChainlinkAggregator(addresses.chainlinkEthUsdOracle, '250000000000', '8'); + + // invariant checks + expect(await contracts.dpiToDaiSwapper.tokenSpent()).to.be.equal(addresses.dpi); + expect(await contracts.dpiToDaiSwapper.tokenReceived()).to.be.equal(addresses.dai); + expect(await contracts.dpiToDaiSwapper.tokenReceivingAddress()).to.be.equal(addresses.daiFixedPricePSM); + const poolTokens = await contracts.balancerVault.getPoolTokens(poolId); + expect(poolTokens.tokens[0]).to.be.equal(addresses.dpi); + expect(poolTokens.tokens[1]).to.be.equal(addresses.dai); + + console.log('Starting DAI PSM dai balance [M]', (await contracts.daiFixedPricePSM.balance()) / 1e24); +}; + +// Tears down any changes made in setup() that need to be +// cleaned up before doing any validation checks. +const teardown: TeardownUpgradeFunc = async (addresses, oldContracts, contracts, logging) => { + console.log(`No actions to complete in teardown for fip${fipNumber}`); +}; + +// Run any validations required on the fip using mocha or console logging +// IE check balances, check state of contracts, etc. +const validate: ValidateUpgradeFunc = async (addresses, oldContracts, contracts, logging) => { + console.log('Final DAI PSM dai balance [M]', (await contracts.daiFixedPricePSM.balance()) / 1e24); + + // LBP swapper should be empty + const poolTokens = await contracts.balancerVault.getPoolTokens(poolId); + expect(poolTokens.balances[0]).to.be.equal('0'); + expect(poolTokens.balances[1]).to.be.equal('0'); + + // Lenses should report 0 because LBP is empty + expect(await contracts.dpiToDaiLensDai.balance()).to.be.equal('0'); + expect(await contracts.dpiToDaiLensDpi.balance()).to.be.equal('0'); + + // Swapper should hold no tokens + expect(await contracts.dpi.balanceOf(contracts.dpiToDaiSwapper.address)).to.be.equal('0'); + expect(await contracts.dai.balanceOf(contracts.dpiToDaiSwapper.address)).to.be.equal('0'); + + // End-to-end test : use the guardian to start a LUSD->DAI auction + const signer = await getImpersonatedSigner(addresses.multisig); // guardian + + // Want to transfer all DPI from the dpiDepositWrapper and rariPool19DpiPCVDepositWrapper + // dpiDepositWrapper = $3.2m + // rariPool19DpiPCVDepositWrapper = $0.2m + + // Move 3.4M DPI to the Swapper + const dpiDepositWrapperAmount = await contracts.dpiDepositWrapper.balance(); + logging && console.log('DPI deposit amount: ', dpiDepositWrapperAmount.toString()); + await contracts.pcvGuardianNew.connect(signer).withdrawToSafeAddress( + contracts.dpiDepositWrapper.address, // address pcvDeposit, + contracts.dpiToDaiSwapper.address, // address safeAddress, + dpiDepositWrapperAmount, // uint256 amount - 35,231 DPI + false, // bool pauseAfter, + false // bool depositAfter + ); + + const dpiRariDepositAmount = await contracts.rariPool19DpiPCVDepositWrapper.balance(); + logging && console.log('Rari DPI amount: ', dpiRariDepositAmount.toString()); + await contracts.pcvGuardianNew.connect(signer).withdrawToSafeAddress( + contracts.dpiDepositWrapper.address, // address pcvDeposit, + contracts.dpiToDaiSwapper.address, // address safeAddress, + dpiRariDepositAmount, // uint256 amount - - 2,657 DPI + false, // bool pauseAfter, + false // bool depositAfter + ); + + // Move ~147k DAI to the Swapper + const compoundDAIDepositAmount = await contracts.compoundDAIDepositWrapper.balance(); + logging && console.log('Compound DAI amount: ', compoundDAIDepositAmount.toString()); + await contracts.pcvGuardianNew.connect(signer).withdrawToSafeAddress( + contracts.compoundDaiPCVDeposit.address, // address pcvDeposit, + contracts.dpiToDaiSwapper.address, // address safeAddress, + compoundDAIDepositAmount, // uint256 amount + false, // bool pauseAfter, + false // bool depositAfter + ); + expect(await contracts.dpi.balanceOf(contracts.dpiToDaiSwapper.address)).to.be.equal( + ethers.constants.WeiPerEther.mul(dpiDepositWrapperAmount.add(dpiRariDepositAmount)) + ); + expect(await contracts.dai.balanceOf(contracts.dpiToDaiSwapper.address)).to.be.equal( + ethers.constants.WeiPerEther.mul(compoundDAIDepositAmount) + ); + // + await time.increase(await contracts.dpiToDaiSwapper.remainingTime()); + expect(await contracts.dpiToDaiSwapper.isTimeEnded()).to.be.true; + await contracts.dpiToDaiSwapper.connect(signer).swap(); + expect(await contracts.dpiToDaiSwapper.isTimeEnded()).to.be.false; +}; + +export { deploy, setup, teardown, validate }; diff --git a/test/integration/proposals_config.ts b/test/integration/proposals_config.ts index e825c3957..c76acb97e 100644 --- a/test/integration/proposals_config.ts +++ b/test/integration/proposals_config.ts @@ -1,19 +1,17 @@ import { ProposalCategory, ProposalsConfigMap } from '@custom-types/types'; -// import fip_xx_proposal from '@proposals/description/fip_xx'; +import swap_dpi_to_dai from '@proposals/description/swap_dpi_to_dai'; const proposals: ProposalsConfigMap = { - /* - fip_xx: { - deploy: true, // deploy flag for whether to run deploy action during e2e tests or use mainnet state - totalValue: 0, // amount of ETH to send to DAO execution - proposal: fip_xx, // full proposal file, imported from '@proposals/description/fip_xx.ts' - proposalId: '', - affectedContractSignoff: [''], - deprecatedContractSignoff: [''], - category: ProposalCategory.DAO - } - */ + swap_dpi_to_dai: { + deploy: true, + proposalId: null, + affectedContractSignoff: [], + deprecatedContractSignoff: [], + category: ProposalCategory.DAO, + totalValue: 0, + proposal: swap_dpi_to_dai + } }; export default proposals; From 547a222b1304ab3cb594b11650f80f5cccf87a95 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 12 May 2022 07:23:00 +0000 Subject: [PATCH 044/274] Bump @nomiclabs/hardhat-ethers from 2.0.5 to 2.0.6 Bumps [@nomiclabs/hardhat-ethers](https://github.com/nomiclabs/hardhat) from 2.0.5 to 2.0.6. - [Release notes](https://github.com/nomiclabs/hardhat/releases) - [Commits](https://github.com/nomiclabs/hardhat/compare/@nomiclabs/hardhat-ethers@2.0.5...@nomiclabs/hardhat-ethers@2.0.6) --- updated-dependencies: - dependency-name: "@nomiclabs/hardhat-ethers" dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- package-lock.json | 14 +++++++------- package.json | 2 +- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/package-lock.json b/package-lock.json index acd494568..13b15fb70 100644 --- a/package-lock.json +++ b/package-lock.json @@ -33,7 +33,7 @@ }, "devDependencies": { "@idle-finance/hardhat-proposals-plugin": "^0.2.3", - "@nomiclabs/hardhat-ethers": "^2.0.5", + "@nomiclabs/hardhat-ethers": "^2.0.6", "@nomiclabs/hardhat-etherscan": "^3.0.3", "@typechain/ethers-v5": "^7.1.2", "@typechain/hardhat": "^2.3.0", @@ -1936,9 +1936,9 @@ } }, "node_modules/@nomiclabs/hardhat-ethers": { - "version": "2.0.5", - "resolved": "https://registry.npmjs.org/@nomiclabs/hardhat-ethers/-/hardhat-ethers-2.0.5.tgz", - "integrity": "sha512-A2gZAGB6kUvLx+kzM92HKuUF33F1FSe90L0TmkXkT2Hh0OKRpvWZURUSU2nghD2yC4DzfEZ3DftfeHGvZ2JTUw==", + "version": "2.0.6", + "resolved": "https://registry.npmjs.org/@nomiclabs/hardhat-ethers/-/hardhat-ethers-2.0.6.tgz", + "integrity": "sha512-q2Cjp20IB48rEn2NPjR1qxsIQBvFVYW9rFRCFq+bC4RUrn1Ljz3g4wM8uSlgIBZYBi2JMXxmOzFqHraczxq4Ng==", "peerDependencies": { "ethers": "^5.0.0", "hardhat": "^2.0.0" @@ -30139,9 +30139,9 @@ } }, "@nomiclabs/hardhat-ethers": { - "version": "2.0.5", - "resolved": "https://registry.npmjs.org/@nomiclabs/hardhat-ethers/-/hardhat-ethers-2.0.5.tgz", - "integrity": "sha512-A2gZAGB6kUvLx+kzM92HKuUF33F1FSe90L0TmkXkT2Hh0OKRpvWZURUSU2nghD2yC4DzfEZ3DftfeHGvZ2JTUw==", + "version": "2.0.6", + "resolved": "https://registry.npmjs.org/@nomiclabs/hardhat-ethers/-/hardhat-ethers-2.0.6.tgz", + "integrity": "sha512-q2Cjp20IB48rEn2NPjR1qxsIQBvFVYW9rFRCFq+bC4RUrn1Ljz3g4wM8uSlgIBZYBi2JMXxmOzFqHraczxq4Ng==", "requires": {} }, "@nomiclabs/hardhat-etherscan": { diff --git a/package.json b/package.json index afdc465ee..a85b48ccd 100644 --- a/package.json +++ b/package.json @@ -73,7 +73,7 @@ }, "devDependencies": { "@idle-finance/hardhat-proposals-plugin": "^0.2.3", - "@nomiclabs/hardhat-ethers": "^2.0.5", + "@nomiclabs/hardhat-ethers": "^2.0.6", "@nomiclabs/hardhat-etherscan": "^3.0.3", "@typechain/ethers-v5": "^7.1.2", "@typechain/hardhat": "^2.3.0", From 3431a0c3a1a5187ba39478eb85a154502be7e51b Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 12 May 2022 07:25:03 +0000 Subject: [PATCH 045/274] Bump hardhat from 2.9.3 to 2.9.4 Bumps [hardhat](https://github.com/nomiclabs/hardhat) from 2.9.3 to 2.9.4. - [Release notes](https://github.com/nomiclabs/hardhat/releases) - [Commits](https://github.com/nomiclabs/hardhat/compare/hardhat@2.9.3...hardhat@2.9.4) --- updated-dependencies: - dependency-name: hardhat dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- package-lock.json | 49 +++++++++++++++++++++++++---------------------- package.json | 2 +- 2 files changed, 27 insertions(+), 24 deletions(-) diff --git a/package-lock.json b/package-lock.json index acd494568..3917c1cfd 100644 --- a/package-lock.json +++ b/package-lock.json @@ -25,7 +25,7 @@ "@uniswap/v2-periphery": "^1.1.0-beta.0", "chai": "^4.3.6", "dotenv": "^16.0.1", - "hardhat": "^2.9.3", + "hardhat": "^2.9.4", "hardhat-contract-sizer": "^2.5.1", "hardhat-gas-reporter": "^1.0.8", "merkletreejs": "^0.2.31", @@ -18396,15 +18396,15 @@ } }, "node_modules/hardhat": { - "version": "2.9.3", - "resolved": "https://registry.npmjs.org/hardhat/-/hardhat-2.9.3.tgz", - "integrity": "sha512-7Vw99RbYbMZ15UzegOR/nqIYIqddZXvLwJGaX5sX4G5bydILnbjmDU6g3jMKJSiArEixS3vHAEaOs5CW1JQ3hg==", - "dependencies": { - "@ethereumjs/block": "^3.6.0", - "@ethereumjs/blockchain": "^5.5.0", - "@ethereumjs/common": "^2.6.0", - "@ethereumjs/tx": "^3.4.0", - "@ethereumjs/vm": "^5.6.0", + "version": "2.9.4", + "resolved": "https://registry.npmjs.org/hardhat/-/hardhat-2.9.4.tgz", + "integrity": "sha512-7hpJz1lXz3H/1shcI284xgQ9WPdXGMuXKoNj8ySJKG7pdifB/lNs1o+Kx/P4TKFwhOiGQYH51/wS2NHKI+dPfg==", + "dependencies": { + "@ethereumjs/block": "^3.6.2", + "@ethereumjs/blockchain": "^5.5.2", + "@ethereumjs/common": "^2.6.4", + "@ethereumjs/tx": "^3.5.1", + "@ethereumjs/vm": "^5.9.0", "@ethersproject/abi": "^5.1.2", "@metamask/eth-sig-util": "^4.0.0", "@sentry/node": "^5.18.1", @@ -18423,7 +18423,7 @@ "env-paths": "^2.2.0", "ethereum-cryptography": "^0.1.2", "ethereumjs-abi": "^0.6.8", - "ethereumjs-util": "^7.1.3", + "ethereumjs-util": "^7.1.4", "find-up": "^2.1.0", "fp-ts": "1.19.3", "fs-extra": "^7.0.1", @@ -18431,7 +18431,7 @@ "immutable": "^4.0.0-rc.12", "io-ts": "1.10.4", "lodash": "^4.17.11", - "merkle-patricia-tree": "^4.2.2", + "merkle-patricia-tree": "^4.2.4", "mnemonist": "^0.38.0", "mocha": "^9.2.0", "p-map": "^4.0.0", @@ -18454,6 +18454,9 @@ }, "engines": { "node": "^12.0.0 || ^14.0.0 || ^16.0.0" + }, + "peerDependencies": { + "chai": "^4.2.0" } }, "node_modules/hardhat-contract-sizer": { @@ -43018,15 +43021,15 @@ } }, "hardhat": { - "version": "2.9.3", - "resolved": "https://registry.npmjs.org/hardhat/-/hardhat-2.9.3.tgz", - "integrity": "sha512-7Vw99RbYbMZ15UzegOR/nqIYIqddZXvLwJGaX5sX4G5bydILnbjmDU6g3jMKJSiArEixS3vHAEaOs5CW1JQ3hg==", - "requires": { - "@ethereumjs/block": "^3.6.0", - "@ethereumjs/blockchain": "^5.5.0", - "@ethereumjs/common": "^2.6.0", - "@ethereumjs/tx": "^3.4.0", - "@ethereumjs/vm": "^5.6.0", + "version": "2.9.4", + "resolved": "https://registry.npmjs.org/hardhat/-/hardhat-2.9.4.tgz", + "integrity": "sha512-7hpJz1lXz3H/1shcI284xgQ9WPdXGMuXKoNj8ySJKG7pdifB/lNs1o+Kx/P4TKFwhOiGQYH51/wS2NHKI+dPfg==", + "requires": { + "@ethereumjs/block": "^3.6.2", + "@ethereumjs/blockchain": "^5.5.2", + "@ethereumjs/common": "^2.6.4", + "@ethereumjs/tx": "^3.5.1", + "@ethereumjs/vm": "^5.9.0", "@ethersproject/abi": "^5.1.2", "@metamask/eth-sig-util": "^4.0.0", "@sentry/node": "^5.18.1", @@ -43045,7 +43048,7 @@ "env-paths": "^2.2.0", "ethereum-cryptography": "^0.1.2", "ethereumjs-abi": "^0.6.8", - "ethereumjs-util": "^7.1.3", + "ethereumjs-util": "^7.1.4", "find-up": "^2.1.0", "fp-ts": "1.19.3", "fs-extra": "^7.0.1", @@ -43053,7 +43056,7 @@ "immutable": "^4.0.0-rc.12", "io-ts": "1.10.4", "lodash": "^4.17.11", - "merkle-patricia-tree": "^4.2.2", + "merkle-patricia-tree": "^4.2.4", "mnemonist": "^0.38.0", "mocha": "^9.2.0", "p-map": "^4.0.0", diff --git a/package.json b/package.json index afdc465ee..24bd5a3c1 100644 --- a/package.json +++ b/package.json @@ -65,7 +65,7 @@ "@uniswap/v2-periphery": "^1.1.0-beta.0", "chai": "^4.3.6", "dotenv": "^16.0.1", - "hardhat": "^2.9.3", + "hardhat": "^2.9.4", "hardhat-contract-sizer": "^2.5.1", "hardhat-gas-reporter": "^1.0.8", "merkletreejs": "^0.2.31", From 2931aecaaa40381bf55dd847f981db7ada1cb1ce Mon Sep 17 00:00:00 2001 From: Erwan Beauvois Date: Thu, 12 May 2022 18:39:42 +0200 Subject: [PATCH 046/274] Add BalancerGaugeStaker contract --- .../external/balancer/IBalancerMinter.sol | 122 ++++++++++++++++++ contracts/metagov/BalancerGaugeStaker.sol | 81 ++++++++++++ 2 files changed, 203 insertions(+) create mode 100644 contracts/external/balancer/IBalancerMinter.sol create mode 100644 contracts/metagov/BalancerGaugeStaker.sol diff --git a/contracts/external/balancer/IBalancerMinter.sol b/contracts/external/balancer/IBalancerMinter.sol new file mode 100644 index 000000000..6a1587882 --- /dev/null +++ b/contracts/external/balancer/IBalancerMinter.sol @@ -0,0 +1,122 @@ +// SPDX-License-Identifier: GPL-3.0-or-later +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + +// See https://etherscan.io/address/0x239e55F427D44C3cc793f49bFB507ebe76638a2b + +pragma solidity ^0.8.4; + +interface IBalancerMinter { + event Minted(address indexed recipient, address gauge, uint256 minted); + + /** + * @notice Returns the address of the Balancer Governance Token + */ + function getBalancerToken() external view returns (address); + + /** + * @notice Returns the address of the Balancer Token Admin contract + */ + function getBalancerTokenAdmin() external view returns (address); + + /** + * @notice Returns the address of the Gauge Controller + */ + function getGaugeController() external view returns (address); + + /** + * @notice Mint everything which belongs to `msg.sender` and send to them + * @param gauge `LiquidityGauge` address to get mintable amount from + */ + function mint(address gauge) external returns (uint256); + + /** + * @notice Mint everything which belongs to `msg.sender` across multiple gauges + * @param gauges List of `LiquidityGauge` addresses + */ + function mintMany(address[] calldata gauges) external returns (uint256); + + /** + * @notice Mint tokens for `user` + * @dev Only possible when `msg.sender` has been approved by `user` to mint on their behalf + * @param gauge `LiquidityGauge` address to get mintable amount from + * @param user Address to mint to + */ + function mintFor(address gauge, address user) external returns (uint256); + + /** + * @notice Mint tokens for `user` across multiple gauges + * @dev Only possible when `msg.sender` has been approved by `user` to mint on their behalf + * @param gauges List of `LiquidityGauge` addresses + * @param user Address to mint to + */ + function mintManyFor(address[] calldata gauges, address user) external returns (uint256); + + /** + * @notice The total number of tokens minted for `user` from `gauge` + */ + function minted(address user, address gauge) external view returns (uint256); + + /** + * @notice Whether `minter` is approved to mint tokens for `user` + */ + function getMinterApproval(address minter, address user) external view returns (bool); + + /** + * @notice Set whether `minter` is approved to mint tokens on your behalf + */ + function setMinterApproval(address minter, bool approval) external; + + /** + * @notice Set whether `minter` is approved to mint tokens on behalf of `user`, who has signed a message authorizing + * them. + */ + function setMinterApprovalWithSignature( + address minter, + bool approval, + address user, + uint256 deadline, + uint8 v, + bytes32 r, + bytes32 s + ) external; + + // The below functions are near-duplicates of functions available above. + // They are included for ABI compatibility with snake_casing as used in vyper contracts. + // solhint-disable func-name-mixedcase + + /** + * @notice Whether `minter` is approved to mint tokens for `user` + */ + function allowed_to_mint_for(address minter, address user) external view returns (bool); + + /** + * @notice Mint everything which belongs to `msg.sender` across multiple gauges + * @dev This function is not recommended as `mintMany()` is more flexible and gas efficient + * @param gauges List of `LiquidityGauge` addresses + */ + function mint_many(address[8] calldata gauges) external; + + /** + * @notice Mint tokens for `user` + * @dev Only possible when `msg.sender` has been approved by `user` to mint on their behalf + * @param gauge `LiquidityGauge` address to get mintable amount from + * @param user Address to mint to + */ + function mint_for(address gauge, address user) external; + + /** + * @notice Toggle whether `minter` is approved to mint tokens for `user` + */ + function toggle_approve_mint(address minter) external; +} diff --git a/contracts/metagov/BalancerGaugeStaker.sol b/contracts/metagov/BalancerGaugeStaker.sol new file mode 100644 index 000000000..fbb5d2b99 --- /dev/null +++ b/contracts/metagov/BalancerGaugeStaker.sol @@ -0,0 +1,81 @@ +// SPDX-License-Identifier: GPL-3.0-or-later +pragma solidity ^0.8.0; + +import "../pcv/PCVDeposit.sol"; +import "./utils/LiquidityGaugeManager.sol"; +import "../external/balancer/IBalancerMinter.sol"; + +/// @title Deposit that can stake in Balancer gauges +/// @author Fei Protocol +contract BalancerGaugeStaker is PCVDeposit, LiquidityGaugeManager { + address public constant BALANCER_GAUGE_CONTROLLER = 0xC128468b7Ce63eA702C1f104D55A2566b13D3ABD; + address public constant BALANCER_MINTER = 0x239e55F427D44C3cc793f49bFB507ebe76638a2b; + address public constant BAL = 0xba100000625a3754423978a60c9317c58a424e3D; + + /// @notice Balancer gauge staker + /// @param _core Fei Core for reference + constructor(address _core) CoreRef(_core) LiquidityGaugeManager(BALANCER_GAUGE_CONTROLLER) {} + + /// @notice returns total balance of PCV in the Deposit + function balance() public view override returns (uint256) { + return IERC20(BAL).balanceOf(address(this)); + } + + /// @notice gets the token address in which this deposit returns its balance + function balanceReportedIn() public view virtual override returns (address) { + return BAL; + } + + /// @notice gets the resistant token balance and protocol owned fei of this deposit + function resistantBalanceAndFei() public view virtual override returns (uint256, uint256) { + return (balance(), 0); + } + + /// @notice noop + function deposit() external override {} + + /// @notice withdraw BAL held to another address + /// the BAL rewards accrue on this PCVDeposit when Gauge rewards are claimed. + function withdraw(address to, uint256 amount) external override onlyPCVController whenNotPaused { + IERC20(BAL).transfer(to, amount); + } + + /// @notice withdraw ERC20 from the contract + /// @param token address of the ERC20 to send + /// @param to address destination of the ERC20 + /// @param amount quantity of ERC20 to send + function withdrawERC20( + address token, + address to, + uint256 amount + ) public virtual override onlyPCVController { + // if the token has a gauge, we unstake it from the gauge before transfer + // @dev : note that this gauge unstaking normally is access controlled to + // onlyTribeRole(TribeRoles.METAGOVERNANCE_GAUGE_ADMIN), but since + // withdrawERC20() is a higher clearance role (PCVController), this + // privilege of gauge unstaking is also made available to the PCV controller, + // that may have important reasons to quickly unstake from the gauge and move + // the staked ERC20s to another place. + address gaugeAddress = tokenToGauge[token]; + if (gaugeAddress != address(0)) { + ILiquidityGauge(gaugeAddress).withdraw(amount, false); + } + + _withdrawERC20(token, to, amount); + } + + /// @notice Mint everything which belongs to this contract in the given gauge + /// @param token whose gauge should be claimed + function mint(address token) external whenNotPaused returns (uint256) { + // fetch gauge address from internal mapping to avoid this permissionless + // call to mint on any arbitrary gauge. + address gaugeAddress = tokenToGauge[token]; + require(gaugeAddress != address(0), "BalancerGaugeStaker: token has no gauge configured"); + + // emit the same event as Gauge rewards claiming for offline indexing + uint256 minted = IBalancerMinter(BALANCER_MINTER).mint(gaugeAddress); + emit GaugeRewardsClaimed(gaugeAddress, BAL, minted); + + return minted; + } +} From 98f7ced225554204d605cd448dbd4bd9e7b23a9d Mon Sep 17 00:00:00 2001 From: Erwan Beauvois Date: Thu, 12 May 2022 18:42:33 +0200 Subject: [PATCH 047/274] Add balancer_gauge_fix proposal (wip) --- proposals/dao/balancer_gauge_fix.ts | 116 ++++++++++++++++++++ proposals/description/balancer_gauge_fix.ts | 49 +++++++++ test/integration/proposals_config.ts | 10 ++ 3 files changed, 175 insertions(+) create mode 100644 proposals/dao/balancer_gauge_fix.ts create mode 100644 proposals/description/balancer_gauge_fix.ts diff --git a/proposals/dao/balancer_gauge_fix.ts b/proposals/dao/balancer_gauge_fix.ts new file mode 100644 index 000000000..a19619159 --- /dev/null +++ b/proposals/dao/balancer_gauge_fix.ts @@ -0,0 +1,116 @@ +import hre, { ethers, artifacts } from 'hardhat'; +import { expect } from 'chai'; +import { + DeployUpgradeFunc, + NamedAddresses, + SetupUpgradeFunc, + TeardownUpgradeFunc, + ValidateUpgradeFunc +} from '@custom-types/types'; +import { getImpersonatedSigner, overwriteChainlinkAggregator, time } from '@test/helpers'; +import { forceEth } from '@test/integration/setup/utils'; + +const e18 = '000000000000000000'; +const fipNumber = 'balancer_gauge_fix'; +let pcvStatsBefore; + +// Do any deployments +// This should exclusively include new contract deployments +const deploy: DeployUpgradeFunc = async (deployAddress: string, addresses: NamedAddresses, logging: boolean) => { + // Deploy balancer gauge staker implementation + const balancerGaugeStakerFactory = await ethers.getContractFactory('BalancerGaugeStaker'); + const balancerGaugeStakerImplementation = await balancerGaugeStakerFactory.deploy( + addresses.core // address _core + ); + await balancerGaugeStakerImplementation.deployTransaction.wait(); + logging && console.log('balancerGaugeStakerImplementation: ', balancerGaugeStakerImplementation.address); + + // Deploy balancer gauge staker proxy + const ProxyFactory = await ethers.getContractFactory('TransparentUpgradeableProxy'); + const balancerGaugeStakerProxy = await ProxyFactory.deploy( + balancerGaugeStakerImplementation.address, + addresses.proxyAdmin, + '0x' // empty calldata + ); + await balancerGaugeStakerProxy.deployTransaction.wait(); + const balancerGaugeStaker = await ethers.getContractAt('BalancerGaugeStaker', balancerGaugeStakerProxy.address); + logging && console.log('balancerGaugeStaker: ', balancerGaugeStaker.address); + + return { + balancerGaugeStakerImplementation, + balancerGaugeStaker + }; +}; + +// Do any setup necessary for running the test. +// This could include setting up Hardhat to impersonate accounts, +// ensuring contracts have a specific state, etc. +const setup: SetupUpgradeFunc = async (addresses, oldContracts, contracts, logging) => { + console.log(`Setup of ${fipNumber} : reading CR oracle...`); + + // make sure TC has enough ETH to run + await forceEth(addresses.tribalCouncilSafe); + await forceEth(addresses.tribalCouncilTimelock); + + // make sure ETH oracle is fresh (for B.AMM not to revert, etc) + // Read Chainlink ETHUSD price & override chainlink storage to make it a fresh value + const ethPrice = (await contracts.chainlinkEthUsdOracleWrapper.read())[0].toString() / 1e10; + await overwriteChainlinkAggregator(addresses.chainlinkEthUsdOracle, Math.round(ethPrice), '8'); + + // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + // assume non-zero B-70WETH-30FEI were unstaked & moved to the PCVDeposit + // before this proposal's execution. + // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + const lpTokenHolder = '0x4f9463405f5bc7b4c1304222c1df76efbd81a407'; + const lpTokenSigner = await getImpersonatedSigner(lpTokenHolder); + await forceEth(lpTokenHolder); + await contracts.balancerFeiWethPool.connect(lpTokenSigner).transfer(addresses.balancerDepositFeiWeth, `1000${e18}`); + + // read pcvStats before proposal execution + pcvStatsBefore = await contracts.collateralizationOracle.pcvStats(); +}; + +// Tears down any changes made in setup() that need to be +// cleaned up before doing any validation checks. +const teardown: TeardownUpgradeFunc = async (addresses, oldContracts, contracts, logging) => { + console.log(`No actions to complete in teardown for fip${fipNumber}`); +}; + +// Run any validations required on the fip using mocha or console logging +// IE check balances, check state of contracts, etc. +const validate: ValidateUpgradeFunc = async (addresses, oldContracts, contracts, logging) => { + // check the new staking contract has staked in gauge + + // check rewards can be claimed + await time.increase('3600'); + console.log('BAL balance before claim', (await contracts.bal.balanceOf(addresses.balancerGaugeStaker)) / 1e18); + await contracts.balancerGaugeStaker.mint(addresses.balancerFeiWethPool); + console.log('BAL balance after claim ', (await contracts.bal.balanceOf(addresses.balancerGaugeStaker)) / 1e18); + + // check collateralization oracle reports the LP tokens staked + + // check withdraw() can move BAL + + // check withdrawERC20() can unstake gauge & move LP tokens + + // display pcvStats + console.log('----------------------------------------------------'); + console.log(' pcvStatsBefore.protocolControlledValue [M]e18 ', pcvStatsBefore.protocolControlledValue / 1e24); + console.log(' pcvStatsBefore.userCirculatingFei [M]e18 ', pcvStatsBefore.userCirculatingFei / 1e24); + console.log(' pcvStatsBefore.protocolEquity [M]e18 ', pcvStatsBefore.protocolEquity / 1e24); + const pcvStatsAfter = await contracts.collateralizationOracle.pcvStats(); + console.log('----------------------------------------------------'); + console.log(' pcvStatsAfter.protocolControlledValue [M]e18 ', pcvStatsAfter.protocolControlledValue / 1e24); + console.log(' pcvStatsAfter.userCirculatingFei [M]e18 ', pcvStatsAfter.userCirculatingFei / 1e24); + console.log(' pcvStatsAfter.protocolEquity [M]e18 ', pcvStatsAfter.protocolEquity / 1e24); + console.log('----------------------------------------------------'); + const pcvDiff = pcvStatsAfter.protocolControlledValue.sub(pcvStatsBefore.protocolControlledValue); + const cFeiDiff = pcvStatsAfter.userCirculatingFei.sub(pcvStatsBefore.userCirculatingFei); + const eqDiff = pcvStatsAfter.protocolEquity.sub(pcvStatsBefore.protocolEquity); + console.log(' PCV diff [M]e18 ', pcvDiff / 1e24); + console.log(' Circ FEI diff [M]e18 ', cFeiDiff / 1e24); + console.log(' Equity diff [M]e18 ', eqDiff / 1e24); + console.log('----------------------------------------------------'); +}; + +export { deploy, setup, teardown, validate }; diff --git a/proposals/description/balancer_gauge_fix.ts b/proposals/description/balancer_gauge_fix.ts new file mode 100644 index 000000000..06410fe0b --- /dev/null +++ b/proposals/description/balancer_gauge_fix.ts @@ -0,0 +1,49 @@ +import { ProposalDescription } from '@custom-types/types'; + +const fip_x: ProposalDescription = { + title: 'Balancer Gauge Staker', + commands: [ + { + target: 'pcvGuardian', + values: '0', + method: 'setSafeAddress(address)', + arguments: ['{balancerGaugeStaker}'], + description: 'Set balancerGaugeStaker as safe address' + }, + // TODO: TC grants itself the gauge admin role + { + target: 'balancerGaugeStaker', + values: '0', + method: 'setTokenToGauge(address,address)', + arguments: [ + '{bpt30Fei70Weth}', // token address + '{balancerGaugeBpt30Fei70Weth}' // gauge address + ], + description: 'Set Balancer B-30FEI-70WETH pool tokens gauge address' + }, + { + target: 'ratioPCVControllerV2', + values: '0', + method: 'withdrawRatioERC20(address,address,address,uint256)', + arguments: [ + '{bpt30Fei70Weth}', // token + '{balancerDepositFeiWeth}', // from + '{balancerGaugeStaker}', // to + '10000' // 100% + ], + description: 'Move all LP tokens to the new gauge staker' + }, + { + target: 'balancerGaugeStaker', + values: '0', + method: 'stakeAllInGauge(address)', + arguments: [ + '{bpt30Fei70Weth}' // token + ], + description: 'Stake all B-30FEI-70WETH in gauge' + } + ], + description: 'Migrate liquidity to a new Balancer Gauge Staker which is able to claim BAL rewards.' +}; + +export default fip_x; diff --git a/test/integration/proposals_config.ts b/test/integration/proposals_config.ts index e825c3957..4bdf20b41 100644 --- a/test/integration/proposals_config.ts +++ b/test/integration/proposals_config.ts @@ -1,6 +1,7 @@ import { ProposalCategory, ProposalsConfigMap } from '@custom-types/types'; // import fip_xx_proposal from '@proposals/description/fip_xx'; +import balancer_gauge_fix from '@proposals/description/balancer_gauge_fix'; const proposals: ProposalsConfigMap = { /* @@ -14,6 +15,15 @@ const proposals: ProposalsConfigMap = { category: ProposalCategory.DAO } */ + balancer_gauge_fix: { + deploy: true, // deploy flag for whether to run deploy action during e2e tests or use mainnet state + totalValue: 0, // amount of ETH to send to DAO execution + proposal: balancer_gauge_fix, // full proposal file, imported from '@proposals/description/fip_xx.ts' + proposalId: null, + affectedContractSignoff: [], + deprecatedContractSignoff: [], + category: ProposalCategory.TC + } }; export default proposals; From 26d7d525365be011fa7f8f8e13a9f5be88044847 Mon Sep 17 00:00:00 2001 From: Caleb Date: Thu, 12 May 2022 21:38:15 -0700 Subject: [PATCH 048/274] getFuseBadDebt script works --- contracts/external/fuse/CToken.sol | 14 +++- hardhat.config.ts | 7 +- scripts/utils/getFuseBadDebt.ts | 111 +++++++++++++++++++++++++++++ 3 files changed, 128 insertions(+), 4 deletions(-) create mode 100644 scripts/utils/getFuseBadDebt.ts diff --git a/contracts/external/fuse/CToken.sol b/contracts/external/fuse/CToken.sol index 5122cf384..91ea49d7f 100644 --- a/contracts/external/fuse/CToken.sol +++ b/contracts/external/fuse/CToken.sol @@ -2,5 +2,17 @@ pragma solidity ^0.8.4; abstract contract CToken { - function getCash() external view returns (uint256) {} + function getCash() external view virtual returns (uint256); + + function underlying() external view virtual returns (address); + + function borrowBalanceCurrent() external virtual returns (uint256); +} + +abstract contract CTokenFuse { + function getCash() external view virtual returns (uint256); + + function underlying() external view virtual returns (address); + + function borrowBalanceCurrent(address debtor) external virtual returns (uint256); } diff --git a/hardhat.config.ts b/hardhat.config.ts index 6a68d2c71..57f2923b3 100644 --- a/hardhat.config.ts +++ b/hardhat.config.ts @@ -23,6 +23,7 @@ const runAllTests = process.env.RUN_ALL_TESTS; const useJSONTestReporter = process.env.REPORT_TEST_RESULTS_AS_JSON; const etherscanKey = process.env.ETHERSCAN_API_KEY; const forkBlock = process.env.FORK_BLOCK; +const logging = process.env.LOGGING; if (!(process.env.NODE_OPTIONS && process.env.NODE_OPTIONS.includes('max-old-space-size'))) { throw new Error( @@ -35,9 +36,9 @@ if (enableMainnetForking) { throw new Error('Cannot fork mainnet without mainnet alchemy api key.'); } - console.log('Mainnet forking enabled.'); + logging && console.log('Mainnet forking enabled.'); } else { - console.log('Mainnet forking disabled.'); + logging && console.log('Mainnet forking disabled.'); } if (useJSONTestReporter) { @@ -58,7 +59,7 @@ export default { forking: enableMainnetForking ? { url: `https://eth-mainnet.alchemyapi.io/v2/${mainnetAlchemyApiKey}`, - blockNumber: parseInt(forkBlock) + blockNumber: forkBlock ? parseInt(forkBlock) : undefined } : undefined }, diff --git a/scripts/utils/getFuseBadDebt.ts b/scripts/utils/getFuseBadDebt.ts new file mode 100644 index 000000000..2b29ca205 --- /dev/null +++ b/scripts/utils/getFuseBadDebt.ts @@ -0,0 +1,111 @@ +import hre from 'hardhat'; +import { CTokenFuse } from '@custom-types/contracts'; +import { forceEth } from '@test/integration/setup/utils'; +import { getAddress } from 'ethers/lib/utils'; +import { BigNumber } from 'ethers'; + +const debtorContractAddress = '0x32075bad9050d4767018084f0cb87b3182d36c45'; + +const affectedPoolIds = [8, 18, 27, 127, 144, 146, 156]; + +const underlyings = { + '0x0000000000000000000000000000000000000000': 'ETH', + '0x956f47f50a910163d8bf957cf5846d573e7f87ca': 'FEI', + '0x853d955acef822db058eb8505911ed77f175b99e': 'FRAX', + '0x03ab458634910aad20ef5f1c8ee96f1d6ac54919': 'RAI', + '0x6b175474e89094c44da98b954eedeac495271d0f': 'DAI', + '0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48': 'USDC', + '0x5f98805a4e8be255a32880fdec7f6728c6568ba0': 'LUSD', + '0x7f39c581f595b53c5cb19bd0b3f8da6c935e2ca0': 'wstETH', + '0xa693b19d2931d498c5b318df961919bb4aee87a5': 'USTw', + '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2': 'WETH', + '0xdac17f958d2ee523a2206206994597c13d831ec7': 'USDT' +}; + +const ctokens = { + '0xd8553552f8868c1ef160eedf031cf0bcf9686945': 'Pool 8: FEI', + '0xbb025d470162cc5ea24daf7d4566064ee7f5f111': 'Pool 8: ETH', + '0x7e9ce3caa9910cc048590801e64174957ed41d43': 'Pool 8: DAI', + '0x7259ee19d6b5e755e7c65cecfd2466c09e251185': 'Pool 8: wstETH', + '0x647a36d421183a0a9fa62717a64b664a24e469c7': 'Pool 8: LUSD', + '0xfa1057d02a0c1a4885851e3f4fd496ee7d38f56e': 'Pool 18: ETH', + '0x8e4e0257a4759559b4b1ac087fe8d80c63f20d19': 'Pool 18: DAI', + '0x6f95d4d251053483f41c8718c30f4f3c404a8cf2': 'Pool 18: USDC', + '0x3e5c122ffa75a9fe16ec0c69f7e9149203ea1a5d': 'Pool 18: FRAX', + '0x17b1a2e012cc4c31f83b90ff11d3942857664efc': 'Pool 18: FEI', + '0x51ff03410a0da915082af444274c381bd1b4cdb1': 'Pool 18: RAI', + '0xb7fe5f277058b3f9eabf6e0655991f10924bfa54': 'Pool 18: USTw', + '0x9de558fce4f289b305e38abe2169b75c626c114e': 'Pool 27: FRAX', + '0xda396c927e3e6bef77a98f372ce431b49edec43d': 'Pool 27: FEI', + '0xf148cdec066b94410d403ac5fe1bb17ec75c5851': 'Pool 27: ETH', + '0x0c402f06c11c6e6a6616c98868a855448d4cfe65': 'Pool 27: USTw', + '0x26267e41ceca7c8e0f143554af707336f27fa051': 'Pool 127: ETH', + '0xebe0d1cb6a0b8569929e062d67bfbc07608f0a47': 'Pool 127: USDC', + '0x4b68ef5ab32261082df1a6c9c6a89ffd5ef168b1': 'Pool 127: DAI', + '0xe097783483d1b7527152ef8b150b99b9b2700c8d': 'Pool 127: USDT', + '0x0f0d710911fb37038b3ad88fc43ddad4edbe16a5': 'Pool 127: USTw', + '0x8922c1147e141c055fddfc0ed5a119f3378c8ef8': 'Pool 127: FRAX', + '0x7dbc3af9251756561ce755fcc11c754184af71f7': 'Pool 144: ETH', + '0x3a2804ec0ff521374af654d8d0daa1d1ae1ee900': 'Pool 144: FEI', + '0xa54c548d11792b3d26ad74f5f899e12cdfd64fd6': 'Pool 144: FRAX', + '0xa6c25548df506d84afd237225b5b34f2feb1aa07': 'Pool 144: DAI', + '0xfbd8aaf46ab3c2732fa930e5b343cd67cea5054c': 'Pool 146: ETH', + '0x49da42a1eca4ac6ca0c6943d9e5dc64e4641e0e3': 'Pool 146: wstETH', + '0xe14c2e156a3f310d41240ce8760eb3cb8a0ddbe3': 'Pool 156: USTw', + '0x001e407f497e024b9fb1cb93ef841f43d645ca4f': 'Pool 156: FEI', + '0x5cadc2a04921213de60b237688776e0f1a7155e6': 'Pool 156: FRAX', + '0x9cd060a4855290bf0c5aed266abe119ff3b01966': 'Pool 156: DAI', + '0x74897c0061adeec84d292e8900c7bdd00b3388e4': 'Pool 156: LUSD', + '0x88d3557eb6280cc084ca36e425d6bc52d0a04429': 'Pool 156: USDC', + '0xe92a3db67e4b6ac86114149f522644b34264f858': 'Pool 156: ETH' +}; + +async function getFuseBadDebt() { + // fork mainnet so that we can call borrowBalanceCurrent + // + // lol + // lmao + // + // (this also allows us to get historical debt amounts by changing the fork block) + + const debt = { + ETH: BigNumber.from(0), + FEI: BigNumber.from(0), + FRAX: BigNumber.from(0), + RAI: BigNumber.from(0), + DAI: BigNumber.from(0), + USDC: BigNumber.from(0), + LUSD: BigNumber.from(0), + wstETH: BigNumber.from(0), + USTw: BigNumber.from(0), + WETH: BigNumber.from(0), + USDT: BigNumber.from(0) + }; + + const signer = (await hre.ethers.getSigners())[0]; + await forceEth(signer.address); + + for (const ctokenAddress of Object.keys(ctokens)) { + const ctoken = await hre.ethers.getContractAt('CTokenFuse', ctokenAddress, signer); + const underlyingAddress = (await ctoken.underlying()).toLowerCase(); + const debtAmount = await ctoken.callStatic.borrowBalanceCurrent(getAddress(debtorContractAddress)); + const collateralName = underlyings[underlyingAddress]; + debt[collateralName] = debt[collateralName].add(debtAmount); + if (!debtAmount.isZero()) { + console.log(`Added ${collateralName} debt of ${debtAmount} from ${ctokens[ctokenAddress]}`); + } + } + + console.log(`\nTotal debt as of block ${hre.ethers.provider.blockNumber} for address ${debtorContractAddress}`); + console.log(`--------------------------`); + for (const key of Object.keys(debt)) { + console.log(`${key}: ${debt[key].toString()}`); + } +} + +getFuseBadDebt() + .then(() => process.exit(0)) + .catch((err) => { + console.log(err); + process.exit(1); + }); From a0738ce770b1c4f2365cced1cceb5916a86c9b60 Mon Sep 17 00:00:00 2001 From: thomas-waite Date: Fri, 13 May 2022 15:28:08 +0200 Subject: [PATCH 049/274] feat: add DAO script, update CR --- proposals/description/swap_dpi_to_dai.ts | 46 +++++++++++++++++++ .../collateralizationOracle.ts | 4 +- 2 files changed, 48 insertions(+), 2 deletions(-) create mode 100644 proposals/description/swap_dpi_to_dai.ts diff --git a/proposals/description/swap_dpi_to_dai.ts b/proposals/description/swap_dpi_to_dai.ts new file mode 100644 index 000000000..086bb91dd --- /dev/null +++ b/proposals/description/swap_dpi_to_dai.ts @@ -0,0 +1,46 @@ +import { ProposalDescription } from '@custom-types/types'; + +const swap_dpi_to_dai: ProposalDescription = { + title: 'Swap DPI to DAI', + // Pull DPI from the DAO timelock + // Send it to the Pool along with DAI + // Trigger the LBP + commands: [ + { + target: 'dpi', + values: '0', + method: 'transfer(address,uint256)', + arguments: ['{dpiToDaiSwapper}', '37888449801955370645659'], + description: 'Transfer DPI from DAO timelock to the LBP pool' + }, + { + target: 'compoundDaiPCVDeposit', + values: '0', + method: 'withdraw(address,uint256)', + arguments: ['{dpiToDaiSwapper}', ''], + description: 'Withdraw Use the PCVGuardian to transfer DAI from the CompoundPCVDeposit to the LBP pool' + }, + { + target: 'collateralizationOracle', + values: '0', + method: 'addDeposit(address)', + arguments: ['{dpiToDaiLensDai}'], + description: 'Add DAI lens on swapper to CR oracle' + }, + { + target: 'collateralizationOracle', + values: '0', + method: 'addDeposit(address)', + arguments: ['{dpiToDaiLensDpi}'], + description: 'Add DPI lens on swapper to CR oracle' + } + ], + description: ` + Transfer DPI and DAI to the LBP swapper. This will be used over the course of a month + to swap DPI for DAI. + + The DAI received will be sent to the Compound DAI deposit, where it can then be dripped to PSM. + ` +}; + +export default swap_dpi_to_dai; diff --git a/protocol-configuration/collateralizationOracle.ts b/protocol-configuration/collateralizationOracle.ts index 94dc4861a..e127a2fc1 100644 --- a/protocol-configuration/collateralizationOracle.ts +++ b/protocol-configuration/collateralizationOracle.ts @@ -27,7 +27,7 @@ const collateralizationAddresses = { 'lusdPSM', 'rariPool8LusdPCVDeposit' ], - dai: ['compoundDaiPCVDepositWrapper', 'daiFixedPricePSM', 'rariPool8DaiPCVDeposit'], + dai: ['compoundDaiPCVDepositWrapper', 'daiFixedPricePSM', 'rariPool8DaiPCVDeposit', 'dpiToDaiLensDai'], usd: ['namedStaticPCVDepositWrapper', 'd3poolCurvePCVDeposit', 'd3poolConvexPCVDeposit'], bal: ['balancerDepositBalWeth', 'balancerLensVeBalBal'], cream: ['creamDepositWrapper'], @@ -44,7 +44,7 @@ const collateralizationAddresses = { 'balancerLensBpt30Fei70Weth', 'balancerLensVeBalWeth' ], - dpi: ['rariPool19DpiPCVDepositWrapper', 'dpiDepositWrapper'], + dpi: ['rariPool19DpiPCVDepositWrapper', 'dpiDepositWrapper', 'dpiToDaiLensDpi'], rai: ['rariPool9RaiPCVDepositWrapper', 'aaveRaiPCVDepositWrapper', 'raiDepositWrapper', 'raiPriceBoundPSM'], agEUR: ['agEurDepositWrapper', 'uniswapLensAgEurUniswapGauge', 'agEurUniswapPCVDeposit'], volt: ['voltDepositWrapper'] From 0446f4bf3cb2e25eb6ee56e0479a5b420664da47 Mon Sep 17 00:00:00 2001 From: thomas-waite Date: Fri, 13 May 2022 15:30:57 +0200 Subject: [PATCH 050/274] refactor: update weights --- proposals/dao/swap_dpi_to_dai.ts | 27 ++++++++++++--------------- 1 file changed, 12 insertions(+), 15 deletions(-) diff --git a/proposals/dao/swap_dpi_to_dai.ts b/proposals/dao/swap_dpi_to_dai.ts index 73b2da711..fb2ecab71 100644 --- a/proposals/dao/swap_dpi_to_dai.ts +++ b/proposals/dao/swap_dpi_to_dai.ts @@ -13,19 +13,18 @@ import { forceEth } from '@test/integration/setup/utils'; /* -Swap DPI for DAI - +Swap DPI for DAI using an LBP Swapper */ -const fipNumber = 'swap_dpi'; +const fipNumber = 'swap_dpi_to_dai'; // LBP Swapper config -const LBP_FREQUENCY = '86400'; // 24 hours +const LBP_FREQUENCY = 86400 * 30; // 1 month in seconds const MIN_LBP_SIZE = ethers.constants.WeiPerEther.mul(1_000_000); // 1M let poolId; // auction pool id const deploy: DeployUpgradeFunc = async (deployAddress: string, addresses: NamedAddresses, logging: boolean) => { - // DPI: 3,459,532 + // DPI: 37888449801955370645659 (95%) // DAI: 147,712 // Total: 3,607,244 @@ -40,11 +39,11 @@ const deploy: DeployUpgradeFunc = async (deployAddress: string, addresses: Named _decimalsNormalizer: 0 }, LBP_FREQUENCY, - '40000000000000000', // small weight 4% - '960000000000000000', // large weight 96% + '30000000000000000', // small weight 4% + '950000000000000000', // large weight 96% addresses.dpi, addresses.dai, - addresses.daiFixedPricePSM, // send DAI to DAI PSM + addresses.compoundDaiPCVDeposit, // send DAI to Compound DAI deposit, where it can then be dripped to PSM MIN_LBP_SIZE // minimum size of a pool which the swapper is used against ); @@ -61,14 +60,12 @@ const deploy: DeployUpgradeFunc = async (deployAddress: string, addresses: Named 'DPI->DAI Auction Pool', // pool name 'apDPI-DAI', // lbp token symbol [addresses.dpi, addresses.dai], // pool contains [DPI, DAI] - [ethers.constants.WeiPerEther.mul(90).div(100), ethers.constants.WeiPerEther.mul(10).div(100)], // initial weights 10%/90% + [ethers.constants.WeiPerEther.mul(95).div(100), ethers.constants.WeiPerEther.mul(5).div(100)], // initial weights 5%/95% ethers.constants.WeiPerEther.mul(30).div(10_000), // 0.3% swap fees dpiToDaiSwapper.address, // pool owner = fei protocol swapper true ); - // Where does the initial liquidity come from? - const txReceipt = await tx.wait(); const { logs: rawLogs } = txReceipt; const noFeeDpiDaiLBPAddress = `0x${rawLogs[rawLogs.length - 1].topics[1].slice(-40)}`; @@ -81,7 +78,7 @@ const deploy: DeployUpgradeFunc = async (deployAddress: string, addresses: Named const tx2 = await dpiToDaiSwapper.init(noFeeDpiDaiLBPAddress); await tx2.wait(); - // 4. Deploy a lens to report the swapper value - possibly don't need these. Small position + // 4. Deploy a lens to report the swapper value const BPTLensFactory = await ethers.getContractFactory('BPTLens'); const dpiToDaiLensDai = await BPTLensFactory.deploy( addresses.dai, // token reported in @@ -123,12 +120,12 @@ const setup: SetupUpgradeFunc = async (addresses, oldContracts, contracts, loggi // invariant checks expect(await contracts.dpiToDaiSwapper.tokenSpent()).to.be.equal(addresses.dpi); expect(await contracts.dpiToDaiSwapper.tokenReceived()).to.be.equal(addresses.dai); - expect(await contracts.dpiToDaiSwapper.tokenReceivingAddress()).to.be.equal(addresses.daiFixedPricePSM); + expect(await contracts.dpiToDaiSwapper.tokenReceivingAddress()).to.be.equal(addresses.compoundDaiPCVDeposit); const poolTokens = await contracts.balancerVault.getPoolTokens(poolId); expect(poolTokens.tokens[0]).to.be.equal(addresses.dpi); expect(poolTokens.tokens[1]).to.be.equal(addresses.dai); - console.log('Starting DAI PSM dai balance [M]', (await contracts.daiFixedPricePSM.balance()) / 1e24); + console.log('Starting DAI PSM dai balance [M]', (await contracts.compoundDaiPCVDeposit.balance()) / 1e24); }; // Tears down any changes made in setup() that need to be @@ -140,7 +137,7 @@ const teardown: TeardownUpgradeFunc = async (addresses, oldContracts, contracts, // Run any validations required on the fip using mocha or console logging // IE check balances, check state of contracts, etc. const validate: ValidateUpgradeFunc = async (addresses, oldContracts, contracts, logging) => { - console.log('Final DAI PSM dai balance [M]', (await contracts.daiFixedPricePSM.balance()) / 1e24); + console.log('Final DAI PSM dai balance [M]', (await contracts.compoundDaiPCVDeposit.balance()) / 1e24); // LBP swapper should be empty const poolTokens = await contracts.balancerVault.getPoolTokens(poolId); From 8ff6e00781731659dbf2a7c16d484341bd45504b Mon Sep 17 00:00:00 2001 From: thomas-waite Date: Fri, 13 May 2022 15:45:51 +0200 Subject: [PATCH 051/274] refactor: improve validation --- proposals/dao/swap_dpi_to_dai.ts | 93 +++++++----------------- proposals/description/swap_dpi_to_dai.ts | 5 +- 2 files changed, 29 insertions(+), 69 deletions(-) diff --git a/proposals/dao/swap_dpi_to_dai.ts b/proposals/dao/swap_dpi_to_dai.ts index fb2ecab71..f26693f67 100644 --- a/proposals/dao/swap_dpi_to_dai.ts +++ b/proposals/dao/swap_dpi_to_dai.ts @@ -1,4 +1,4 @@ -import hre, { ethers, artifacts } from 'hardhat'; +import { ethers } from 'hardhat'; import { expect } from 'chai'; import { TransactionResponse } from '@ethersproject/providers'; import { @@ -9,10 +9,10 @@ import { ValidateUpgradeFunc } from '@custom-types/types'; import { getImpersonatedSigner, overwriteChainlinkAggregator, time } from '@test/helpers'; -import { forceEth } from '@test/integration/setup/utils'; -/* +const toBN = ethers.BigNumber.from; +/* Swap DPI for DAI using an LBP Swapper */ @@ -23,11 +23,14 @@ const LBP_FREQUENCY = 86400 * 30; // 1 month in seconds const MIN_LBP_SIZE = ethers.constants.WeiPerEther.mul(1_000_000); // 1M let poolId; // auction pool id +const daiSeedAmount = toBN('187947000000000000000000'); +const dpiSeedAmount = toBN('37888449801955370645659'); + const deploy: DeployUpgradeFunc = async (deployAddress: string, addresses: NamedAddresses, logging: boolean) => { - // DPI: 37888449801955370645659 (95%) - // DAI: 147,712 + // Amounts: + // DPI: 37888449801955370645659 (95%), 37k DPI, $3,758,957.86 + // DAI: 187947000000000000000000 (5%), 187k DAI, $187,947.89 - // Total: 3,607,244 // 1. Deploy the Balancer LBP swapper const BalancerLBPSwapperFactory = await ethers.getContractFactory('BalancerLBPSwapper'); const dpiToDaiSwapper = await BalancerLBPSwapperFactory.deploy( @@ -39,8 +42,8 @@ const deploy: DeployUpgradeFunc = async (deployAddress: string, addresses: Named _decimalsNormalizer: 0 }, LBP_FREQUENCY, - '30000000000000000', // small weight 4% - '950000000000000000', // large weight 96% + '50000000000000000', // small weight 5% + '950000000000000000', // large weight 95% addresses.dpi, addresses.dai, addresses.compoundDaiPCVDeposit, // send DAI to Compound DAI deposit, where it can then be dripped to PSM @@ -125,22 +128,7 @@ const setup: SetupUpgradeFunc = async (addresses, oldContracts, contracts, loggi expect(poolTokens.tokens[0]).to.be.equal(addresses.dpi); expect(poolTokens.tokens[1]).to.be.equal(addresses.dai); - console.log('Starting DAI PSM dai balance [M]', (await contracts.compoundDaiPCVDeposit.balance()) / 1e24); -}; - -// Tears down any changes made in setup() that need to be -// cleaned up before doing any validation checks. -const teardown: TeardownUpgradeFunc = async (addresses, oldContracts, contracts, logging) => { - console.log(`No actions to complete in teardown for fip${fipNumber}`); -}; - -// Run any validations required on the fip using mocha or console logging -// IE check balances, check state of contracts, etc. -const validate: ValidateUpgradeFunc = async (addresses, oldContracts, contracts, logging) => { - console.log('Final DAI PSM dai balance [M]', (await contracts.compoundDaiPCVDeposit.balance()) / 1e24); - // LBP swapper should be empty - const poolTokens = await contracts.balancerVault.getPoolTokens(poolId); expect(poolTokens.balances[0]).to.be.equal('0'); expect(poolTokens.balances[1]).to.be.equal('0'); @@ -152,53 +140,28 @@ const validate: ValidateUpgradeFunc = async (addresses, oldContracts, contracts, expect(await contracts.dpi.balanceOf(contracts.dpiToDaiSwapper.address)).to.be.equal('0'); expect(await contracts.dai.balanceOf(contracts.dpiToDaiSwapper.address)).to.be.equal('0'); - // End-to-end test : use the guardian to start a LUSD->DAI auction - const signer = await getImpersonatedSigner(addresses.multisig); // guardian + console.log('Starting DAI PSM dai balance [M]', (await contracts.compoundDaiPCVDeposit.balance()) / 1e24); +}; - // Want to transfer all DPI from the dpiDepositWrapper and rariPool19DpiPCVDepositWrapper - // dpiDepositWrapper = $3.2m - // rariPool19DpiPCVDepositWrapper = $0.2m - - // Move 3.4M DPI to the Swapper - const dpiDepositWrapperAmount = await contracts.dpiDepositWrapper.balance(); - logging && console.log('DPI deposit amount: ', dpiDepositWrapperAmount.toString()); - await contracts.pcvGuardianNew.connect(signer).withdrawToSafeAddress( - contracts.dpiDepositWrapper.address, // address pcvDeposit, - contracts.dpiToDaiSwapper.address, // address safeAddress, - dpiDepositWrapperAmount, // uint256 amount - 35,231 DPI - false, // bool pauseAfter, - false // bool depositAfter - ); +// Tears down any changes made in setup() that need to be +// cleaned up before doing any validation checks. +const teardown: TeardownUpgradeFunc = async (addresses, oldContracts, contracts, logging) => { + console.log(`No actions to complete in teardown for fip${fipNumber}`); +}; - const dpiRariDepositAmount = await contracts.rariPool19DpiPCVDepositWrapper.balance(); - logging && console.log('Rari DPI amount: ', dpiRariDepositAmount.toString()); - await contracts.pcvGuardianNew.connect(signer).withdrawToSafeAddress( - contracts.dpiDepositWrapper.address, // address pcvDeposit, - contracts.dpiToDaiSwapper.address, // address safeAddress, - dpiRariDepositAmount, // uint256 amount - - 2,657 DPI - false, // bool pauseAfter, - false // bool depositAfter - ); +// Run any validations required on the fip using mocha or console logging +// IE check balances, check state of contracts, etc. +const validate: ValidateUpgradeFunc = async (addresses, oldContracts, contracts, logging) => { + // By this point, the DAO has moved funds to the LBP swapper and the auction should be active + console.log('Final DAI PSM dai balance [M]', (await contracts.compoundDaiPCVDeposit.balance()) / 1e24); + + expect(await contracts.dpi.balanceOf(contracts.dpiToDaiSwapper.address)).to.be.equal(dpiSeedAmount); + expect(await contracts.dai.balanceOf(contracts.dpiToDaiSwapper.address)).to.be.equal(daiSeedAmount); - // Move ~147k DAI to the Swapper - const compoundDAIDepositAmount = await contracts.compoundDAIDepositWrapper.balance(); - logging && console.log('Compound DAI amount: ', compoundDAIDepositAmount.toString()); - await contracts.pcvGuardianNew.connect(signer).withdrawToSafeAddress( - contracts.compoundDaiPCVDeposit.address, // address pcvDeposit, - contracts.dpiToDaiSwapper.address, // address safeAddress, - compoundDAIDepositAmount, // uint256 amount - false, // bool pauseAfter, - false // bool depositAfter - ); - expect(await contracts.dpi.balanceOf(contracts.dpiToDaiSwapper.address)).to.be.equal( - ethers.constants.WeiPerEther.mul(dpiDepositWrapperAmount.add(dpiRariDepositAmount)) - ); - expect(await contracts.dai.balanceOf(contracts.dpiToDaiSwapper.address)).to.be.equal( - ethers.constants.WeiPerEther.mul(compoundDAIDepositAmount) - ); - // await time.increase(await contracts.dpiToDaiSwapper.remainingTime()); expect(await contracts.dpiToDaiSwapper.isTimeEnded()).to.be.true; + + const signer = await getImpersonatedSigner(addresses.multisig); // guardian await contracts.dpiToDaiSwapper.connect(signer).swap(); expect(await contracts.dpiToDaiSwapper.isTimeEnded()).to.be.false; }; diff --git a/proposals/description/swap_dpi_to_dai.ts b/proposals/description/swap_dpi_to_dai.ts index 086bb91dd..b9755120a 100644 --- a/proposals/description/swap_dpi_to_dai.ts +++ b/proposals/description/swap_dpi_to_dai.ts @@ -2,9 +2,6 @@ import { ProposalDescription } from '@custom-types/types'; const swap_dpi_to_dai: ProposalDescription = { title: 'Swap DPI to DAI', - // Pull DPI from the DAO timelock - // Send it to the Pool along with DAI - // Trigger the LBP commands: [ { target: 'dpi', @@ -17,7 +14,7 @@ const swap_dpi_to_dai: ProposalDescription = { target: 'compoundDaiPCVDeposit', values: '0', method: 'withdraw(address,uint256)', - arguments: ['{dpiToDaiSwapper}', ''], + arguments: ['{dpiToDaiSwapper}', '187947000000000000000000'], description: 'Withdraw Use the PCVGuardian to transfer DAI from the CompoundPCVDeposit to the LBP pool' }, { From b26045e09bead57b1376cbcbb1e48c321591ad2f Mon Sep 17 00:00:00 2001 From: thomas-waite Date: Fri, 13 May 2022 16:44:04 +0200 Subject: [PATCH 052/274] deps: update fork block num --- block.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/block.txt b/block.txt index ff8768fe4..1474b8721 100644 --- a/block.txt +++ b/block.txt @@ -1 +1 @@ -14742151 \ No newline at end of file +14767945 \ No newline at end of file From e5bee2f1073c51aa8f8cad2f3cc8d333e189f375 Mon Sep 17 00:00:00 2001 From: Erwan Beauvois Date: Fri, 13 May 2022 16:54:00 +0200 Subject: [PATCH 053/274] add proxy init and make proposal executable by TC --- contracts/metagov/BalancerGaugeStaker.sol | 14 +++- proposals/dao/balancer_gauge_fix.ts | 80 ++++++++++++++++++++- proposals/description/balancer_gauge_fix.ts | 50 ++++++++++--- protocol-configuration/mainnetAddresses.ts | 8 +-- 4 files changed, 134 insertions(+), 18 deletions(-) diff --git a/contracts/metagov/BalancerGaugeStaker.sol b/contracts/metagov/BalancerGaugeStaker.sol index fbb5d2b99..fe49fd6e1 100644 --- a/contracts/metagov/BalancerGaugeStaker.sol +++ b/contracts/metagov/BalancerGaugeStaker.sol @@ -4,10 +4,13 @@ pragma solidity ^0.8.0; import "../pcv/PCVDeposit.sol"; import "./utils/LiquidityGaugeManager.sol"; import "../external/balancer/IBalancerMinter.sol"; +import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; /// @title Deposit that can stake in Balancer gauges /// @author Fei Protocol contract BalancerGaugeStaker is PCVDeposit, LiquidityGaugeManager { + using SafeERC20 for IERC20; + address public constant BALANCER_GAUGE_CONTROLLER = 0xC128468b7Ce63eA702C1f104D55A2566b13D3ABD; address public constant BALANCER_MINTER = 0x239e55F427D44C3cc793f49bFB507ebe76638a2b; address public constant BAL = 0xba100000625a3754423978a60c9317c58a424e3D; @@ -16,6 +19,12 @@ contract BalancerGaugeStaker is PCVDeposit, LiquidityGaugeManager { /// @param _core Fei Core for reference constructor(address _core) CoreRef(_core) LiquidityGaugeManager(BALANCER_GAUGE_CONTROLLER) {} + function initialize(address _core) external { + require(gaugeController == address(0), "BalancerGaugeStaker: initialized"); + CoreRef._initialize(_core); + gaugeController = BALANCER_GAUGE_CONTROLLER; + } + /// @notice returns total balance of PCV in the Deposit function balance() public view override returns (uint256) { return IERC20(BAL).balanceOf(address(this)); @@ -37,7 +46,8 @@ contract BalancerGaugeStaker is PCVDeposit, LiquidityGaugeManager { /// @notice withdraw BAL held to another address /// the BAL rewards accrue on this PCVDeposit when Gauge rewards are claimed. function withdraw(address to, uint256 amount) external override onlyPCVController whenNotPaused { - IERC20(BAL).transfer(to, amount); + IERC20(BAL).safeTransfer(to, amount); + emit Withdrawal(msg.sender, to, amount); } /// @notice withdraw ERC20 from the contract @@ -48,7 +58,7 @@ contract BalancerGaugeStaker is PCVDeposit, LiquidityGaugeManager { address token, address to, uint256 amount - ) public virtual override onlyPCVController { + ) public virtual override onlyPCVController whenNotPaused { // if the token has a gauge, we unstake it from the gauge before transfer // @dev : note that this gauge unstaking normally is access controlled to // onlyTribeRole(TribeRoles.METAGOVERNANCE_GAUGE_ADMIN), but since diff --git a/proposals/dao/balancer_gauge_fix.ts b/proposals/dao/balancer_gauge_fix.ts index a19619159..b8e3bbf56 100644 --- a/proposals/dao/balancer_gauge_fix.ts +++ b/proposals/dao/balancer_gauge_fix.ts @@ -36,9 +36,37 @@ const deploy: DeployUpgradeFunc = async (deployAddress: string, addresses: Named const balancerGaugeStaker = await ethers.getContractAt('BalancerGaugeStaker', balancerGaugeStakerProxy.address); logging && console.log('balancerGaugeStaker: ', balancerGaugeStaker.address); + // initialize proxy state + await balancerGaugeStaker.initialize(addresses.core); + + // Deploy lens to report the B-30FEI-70WETH staked in gauge + const gaugeLensFactory = await ethers.getContractFactory('CurveGaugeLens'); + const gaugeLensBpt30Fei70WethGauge = await gaugeLensFactory.deploy( + addresses.balancerGaugeBpt30Fei70Weth, + balancerGaugeStaker.address + ); + await gaugeLensBpt30Fei70WethGauge.deployTransaction.wait(); + logging && console.log('gaugeLensBpt30Fei70WethGauge:', gaugeLensBpt30Fei70WethGauge.address); + + // Deploy lens to report B-30FEI-70WETH as WETH and protocol-owned FEI + const balancerPool2LensFactory = await ethers.getContractFactory('BalancerPool2Lens'); + const balancerLensBpt30Fei70Weth = await balancerPool2LensFactory.deploy( + gaugeLensBpt30Fei70WethGauge.address, // address _depositAddress + addresses.wethERC20, // address _token + '0x90291319f1d4ea3ad4db0dd8fe9e12baf749e845', // IWeightedPool _pool + addresses.chainlinkEthUsdOracleWrapper, // IOracle _reportedOracle + addresses.oneConstantOracle, // IOracle _otherOracle + false, // bool _feiIsReportedIn + true // bool _feiIsOther + ); + await balancerLensBpt30Fei70Weth.deployTransaction.wait(); + logging && console.log('balancerLensBpt30Fei70Weth: ', balancerLensBpt30Fei70Weth.address); + return { balancerGaugeStakerImplementation, - balancerGaugeStaker + balancerGaugeStaker, + gaugeLensBpt30Fei70WethGauge, + balancerLensBpt30Fei70Weth }; }; @@ -80,18 +108,66 @@ const teardown: TeardownUpgradeFunc = async (addresses, oldContracts, contracts, // IE check balances, check state of contracts, etc. const validate: ValidateUpgradeFunc = async (addresses, oldContracts, contracts, logging) => { // check the new staking contract has staked in gauge + console.log('---------------------------------------------------------------'); + console.log( + 'BPTs staked in the gauge by the new contract', + (await contracts.balancerGaugeBpt30Fei70Weth.balanceOf(addresses.balancerGaugeStaker)) / 1e18 + ); // check rewards can be claimed - await time.increase('3600'); + console.log('---------------------------------------------------------------'); + console.log('claim rewards...'); + await time.increase('86400'); console.log('BAL balance before claim', (await contracts.bal.balanceOf(addresses.balancerGaugeStaker)) / 1e18); await contracts.balancerGaugeStaker.mint(addresses.balancerFeiWethPool); console.log('BAL balance after claim ', (await contracts.bal.balanceOf(addresses.balancerGaugeStaker)) / 1e18); + console.log('balancerGaugeStaker.balance() ', (await contracts.balancerGaugeStaker.balance()) / 1e18); // check collateralization oracle reports the LP tokens staked + console.log('---------------------------------------------------------------'); + console.log('checking presence in CR oracle'); + expect(await contracts.collateralizationOracle.depositToToken(addresses.balancerLensBpt30Fei70Weth)).to.be.equal( + addresses.weth + ); + expect(await contracts.collateralizationOracle.depositToToken(addresses.balancerLensBpt30Fei70WethOld)).to.be.equal( + ethers.constants.AddressZero + ); + console.log('checking resistant balance and fei'); + const resistantBalanceAndFei = await contracts.balancerLensBpt30Fei70Weth.resistantBalanceAndFei(); + console.log('resistantBalanceAndFei[0]', resistantBalanceAndFei[0] / 1e18); + console.log('resistantBalanceAndFei[1]', resistantBalanceAndFei[1] / 1e18); // check withdraw() can move BAL + console.log('---------------------------------------------------------------'); + console.log('withdraw(feiDAOTimelock, 1e18)'); + const withdrawAmount = '1000000000000000000'; + const sourceBalanceBefore = await contracts.bal.balanceOf(addresses.balancerGaugeStaker); + const targetBalanceBefore = await contracts.bal.balanceOf(addresses.feiDAOTimelock); + console.log('BAL balance before withdraw [source]', sourceBalanceBefore / 1e18); + console.log('BAL balance before withdraw [target]', targetBalanceBefore / 1e18); + await contracts.balancerGaugeStaker.withdraw(addresses.feiDAOTimelock, withdrawAmount); + const sourceBalanceAfter = await contracts.bal.balanceOf(addresses.balancerGaugeStaker); + const targetBalanceAfter = await contracts.bal.balanceOf(addresses.feiDAOTimelock); + console.log('BAL balance after withdraw [source]', sourceBalanceAfter / 1e18); + console.log('BAL balance after withdraw [target]', targetBalanceAfter / 1e18); // check withdrawERC20() can unstake gauge & move LP tokens + console.log('---------------------------------------------------------------'); + console.log('withdrawERC20(bpt30Fei70Weth, feiDAOTimelock, 1e18)'); + const lpWithdrawAmount = '1000000000000000000'; + const sourceLpBalanceBefore = await contracts.balancerGaugeBpt30Fei70Weth.balanceOf(addresses.balancerGaugeStaker); + const targetLpBalanceBefore = await contracts.bpt30Fei70Weth.balanceOf(addresses.feiDAOTimelock); + console.log('LP balance before withdraw [source]', sourceLpBalanceBefore / 1e18); + console.log('LP balance before withdraw [target]', targetLpBalanceBefore / 1e18); + await contracts.balancerGaugeStaker.withdrawERC20( + addresses.bpt30Fei70Weth, + addresses.feiDAOTimelock, + lpWithdrawAmount + ); + const sourceLpBalanceAfter = await contracts.balancerGaugeBpt30Fei70Weth.balanceOf(addresses.balancerGaugeStaker); + const targetLpBalanceAfter = await contracts.bpt30Fei70Weth.balanceOf(addresses.feiDAOTimelock); + console.log('LP balance after withdraw [source]', sourceLpBalanceAfter / 1e18); + console.log('LP balance after withdraw [target]', targetLpBalanceAfter / 1e18); // display pcvStats console.log('----------------------------------------------------'); diff --git a/proposals/description/balancer_gauge_fix.ts b/proposals/description/balancer_gauge_fix.ts index 06410fe0b..a5a8cd473 100644 --- a/proposals/description/balancer_gauge_fix.ts +++ b/proposals/description/balancer_gauge_fix.ts @@ -1,16 +1,36 @@ import { ProposalDescription } from '@custom-types/types'; +// TODO: +// put here the amout of B-70WETH-30FEI BPTs to move that +// are on the balancerDepositFeiWeth and that should be +// staked in the gauge. +// As of 13/05, the BPTs are still staked in the gauge, but +// there is a transaction for unstaking that is pending in +// the OA Timelock, and the Guardian will move these BPTs +// to the balancerDepositFeiWeth, where part of them will +// possibly be redeemed to reduce the amount of liquidity. +const bpt30Fei70WethBalance = '1000000000000000000000'; + const fip_x: ProposalDescription = { title: 'Balancer Gauge Staker', commands: [ { - target: 'pcvGuardian', + target: 'pcvGuardianNew', values: '0', method: 'setSafeAddress(address)', arguments: ['{balancerGaugeStaker}'], description: 'Set balancerGaugeStaker as safe address' }, - // TODO: TC grants itself the gauge admin role + { + target: 'core', + values: '0', + method: 'grantRole(bytes32,address)', + arguments: [ + '0x3bee38c33241595abfefa470fd75bfa1cc9cb01eff02cf6732fd2baea4ea4241', // METAGOVERNANCE_GAUGE_ADMIN + '{tribalCouncilTimelock}' + ], + description: 'Grant TC Timelock the METAGOVERNANCE_GAUGE_ADMIN role' + }, { target: 'balancerGaugeStaker', values: '0', @@ -22,25 +42,35 @@ const fip_x: ProposalDescription = { description: 'Set Balancer B-30FEI-70WETH pool tokens gauge address' }, { - target: 'ratioPCVControllerV2', + target: 'pcvGuardianNew', values: '0', - method: 'withdrawRatioERC20(address,address,address,uint256)', + method: 'withdrawERC20ToSafeAddress(address,address,address,uint256,bool,bool)', arguments: [ - '{bpt30Fei70Weth}', // token - '{balancerDepositFeiWeth}', // from - '{balancerGaugeStaker}', // to - '10000' // 100% + '{balancerDepositFeiWeth}', // address pcvDeposit + '{balancerGaugeStaker}', // address safeAddress + '{bpt30Fei70Weth}', // address token + '1000000000000000000000', // uint256 amount + false, // bool pauseAfter + false // bool depositAfter ], description: 'Move all LP tokens to the new gauge staker' }, { target: 'balancerGaugeStaker', values: '0', - method: 'stakeAllInGauge(address)', + method: 'stakeInGauge(address,uint256)', arguments: [ - '{bpt30Fei70Weth}' // token + '{bpt30Fei70Weth}', // token + '1000000000000000000000' // amount ], description: 'Stake all B-30FEI-70WETH in gauge' + }, + { + target: 'collateralizationOracle', + values: '0', + method: 'swapDeposit(address,address)', + arguments: ['{balancerLensBpt30Fei70WethOld}', '{balancerLensBpt30Fei70Weth}'], + description: 'Add new FEI/WETH Lens to CR oracle & swap out the old one' } ], description: 'Migrate liquidity to a new Balancer Gauge Staker which is able to claim BAL rewards.' diff --git a/protocol-configuration/mainnetAddresses.ts b/protocol-configuration/mainnetAddresses.ts index 89b4d82f1..eae3e7f57 100644 --- a/protocol-configuration/mainnetAddresses.ts +++ b/protocol-configuration/mainnetAddresses.ts @@ -391,15 +391,15 @@ const MainnetAddresses: MainnetAddresses = { address: '0xc4EAc760C2C631eE0b064E39888b89158ff808B2', category: AddressCategory.Governance }, - gaugeLensBpt30Fei70WethGauge: { + gaugeLensBpt30Fei70WethGaugeOld: { artifactName: 'CurveGaugeLens', address: '0xa8E388a1f19f2b33Be8bf2cCeC43641C10b4D1e5', - category: AddressCategory.External // not really External, but not PCV + category: AddressCategory.Deprecated }, - balancerLensBpt30Fei70Weth: { + balancerLensBpt30Fei70WethOld: { artifactName: 'BalancerPool2Lens', address: '0xb31F75550e97A2C4c7AC8d4355032B8AE8b9584D', - category: AddressCategory.PCV + category: AddressCategory.Deprecated }, balancerLensVeBalBal: { artifactName: 'BalancerPool2Lens', From c530f53f9f6f7777a6c71b1d1411304f5f804eba Mon Sep 17 00:00:00 2001 From: thomas-waite Date: Fri, 13 May 2022 17:04:42 +0200 Subject: [PATCH 054/274] refactor: CR oracle updates --- proposals/dao/swap_dpi_to_dai.ts | 5 ++++- proposals/description/swap_dpi_to_dai.ts | 11 +++++++++-- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/proposals/dao/swap_dpi_to_dai.ts b/proposals/dao/swap_dpi_to_dai.ts index f26693f67..ec2b9f43a 100644 --- a/proposals/dao/swap_dpi_to_dai.ts +++ b/proposals/dao/swap_dpi_to_dai.ts @@ -9,6 +9,7 @@ import { ValidateUpgradeFunc } from '@custom-types/types'; import { getImpersonatedSigner, overwriteChainlinkAggregator, time } from '@test/helpers'; +import { forceEth } from '@test/integration/setup/utils'; const toBN = ethers.BigNumber.from; @@ -141,6 +142,8 @@ const setup: SetupUpgradeFunc = async (addresses, oldContracts, contracts, loggi expect(await contracts.dai.balanceOf(contracts.dpiToDaiSwapper.address)).to.be.equal('0'); console.log('Starting DAI PSM dai balance [M]', (await contracts.compoundDaiPCVDeposit.balance()) / 1e24); + + await forceEth(addresses.optimisticTimelock); }; // Tears down any changes made in setup() that need to be @@ -161,7 +164,7 @@ const validate: ValidateUpgradeFunc = async (addresses, oldContracts, contracts, await time.increase(await contracts.dpiToDaiSwapper.remainingTime()); expect(await contracts.dpiToDaiSwapper.isTimeEnded()).to.be.true; - const signer = await getImpersonatedSigner(addresses.multisig); // guardian + const signer = await getImpersonatedSigner(addresses.optimisticTimelock); // TODO: TribalCouncil should grant itself SWAP_ADMIN_ROLE await contracts.dpiToDaiSwapper.connect(signer).swap(); expect(await contracts.dpiToDaiSwapper.isTimeEnded()).to.be.false; }; diff --git a/proposals/description/swap_dpi_to_dai.ts b/proposals/description/swap_dpi_to_dai.ts index b9755120a..2826e4c90 100644 --- a/proposals/description/swap_dpi_to_dai.ts +++ b/proposals/description/swap_dpi_to_dai.ts @@ -22,14 +22,21 @@ const swap_dpi_to_dai: ProposalDescription = { values: '0', method: 'addDeposit(address)', arguments: ['{dpiToDaiLensDai}'], - description: 'Add DAI lens on swapper to CR oracle' + description: 'Add DAI swapper lens to the CR oracle' }, { target: 'collateralizationOracle', values: '0', method: 'addDeposit(address)', arguments: ['{dpiToDaiLensDpi}'], - description: 'Add DPI lens on swapper to CR oracle' + description: 'Add DPI swapper lens to the CR oracle' + }, + { + target: 'collateralizationOracle', + values: '0', + method: 'removeDeposit(address)', + arguments: ['{dpiDepositWrapper}'], + description: 'Remove DPI Deposit wrapper from CR oracle, as now empty' } ], description: ` From 36d34272792cbd35a80669abcc28f5e0878660ff Mon Sep 17 00:00:00 2001 From: thomas-waite Date: Fri, 13 May 2022 17:43:05 +0200 Subject: [PATCH 055/274] refactor: cleanup --- proposals/dao/swap_dpi_to_dai.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/proposals/dao/swap_dpi_to_dai.ts b/proposals/dao/swap_dpi_to_dai.ts index ec2b9f43a..0785bae97 100644 --- a/proposals/dao/swap_dpi_to_dai.ts +++ b/proposals/dao/swap_dpi_to_dai.ts @@ -21,7 +21,7 @@ const fipNumber = 'swap_dpi_to_dai'; // LBP Swapper config const LBP_FREQUENCY = 86400 * 30; // 1 month in seconds -const MIN_LBP_SIZE = ethers.constants.WeiPerEther.mul(1_000_000); // 1M +const MIN_LBP_SIZE = ethers.constants.WeiPerEther.mul(10_000); // 10k let poolId; // auction pool id const daiSeedAmount = toBN('187947000000000000000000'); From a9b3e9f6ab31f94bb7e552eaf614efc19271683e Mon Sep 17 00:00:00 2001 From: thomas-waite Date: Fri, 13 May 2022 17:50:26 +0200 Subject: [PATCH 056/274] feat: remove old deposits from CR --- proposals/description/swap_dpi_to_dai.ts | 16 +++++++++++++-- .../collateralizationOracle.ts | 15 +++----------- protocol-configuration/mainnetAddresses.ts | 16 +++++++-------- test/integration/proposals_config.ts | 20 +++++++++++++++++-- 4 files changed, 43 insertions(+), 24 deletions(-) diff --git a/proposals/description/swap_dpi_to_dai.ts b/proposals/description/swap_dpi_to_dai.ts index 2826e4c90..147d44965 100644 --- a/proposals/description/swap_dpi_to_dai.ts +++ b/proposals/description/swap_dpi_to_dai.ts @@ -34,8 +34,20 @@ const swap_dpi_to_dai: ProposalDescription = { { target: 'collateralizationOracle', values: '0', - method: 'removeDeposit(address)', - arguments: ['{dpiDepositWrapper}'], + method: 'removeDeposits(address[])', + arguments: [ + [ + '{dpiDepositWrapper}', + '{rariPool31FeiPCVDepositWrapper}', + '{rariPool25FeiPCVDepositWrapper}', + '{rariPool9RaiPCVDepositWrapper}', + '{aaveRaiPCVDepositWrapper}', + '{rariPool19DpiPCVDepositWrapper}', + '{liquityFusePoolLusdPCVDeposit}', + '{rariPool72FeiPCVDepositWrapper', + '{raiDepositWrapper}' + ] + ], description: 'Remove DPI Deposit wrapper from CR oracle, as now empty' } ], diff --git a/protocol-configuration/collateralizationOracle.ts b/protocol-configuration/collateralizationOracle.ts index e127a2fc1..82b8b66c6 100644 --- a/protocol-configuration/collateralizationOracle.ts +++ b/protocol-configuration/collateralizationOracle.ts @@ -5,14 +5,11 @@ const collateralizationAddresses = { 'rariPool6FeiPCVDepositWrapper', 'rariPool19FeiPCVDepositWrapper', 'rariPool24FeiPCVDepositWrapper', - 'rariPool25FeiPCVDepositWrapper', 'rariPool27FeiPCVDepositWrapper', 'rariPool18FeiPCVDepositWrapper', 'rariPool90FeiPCVDepositWrapper', 'aaveFeiPCVDepositWrapper', 'rariPool79FeiPCVDepositWrapper', - 'rariPool31FeiPCVDepositWrapper', - 'rariPool72FeiPCVDepositWrapper', 'rariPool128FeiPCVDepositWrapper', 'rariPool22FeiPCVDepositWrapper', 'feiBuybackLensNoFee', @@ -20,13 +17,7 @@ const collateralizationAddresses = { 'compoundPCVDepositWrapper', 'turboFusePCVDeposit' ], - lusd: [ - 'liquityFusePoolLusdPCVDeposit', - 'rariPool7LusdPCVDeposit', - 'bammDeposit', - 'lusdPSM', - 'rariPool8LusdPCVDeposit' - ], + lusd: ['rariPool7LusdPCVDeposit', 'bammDeposit', 'lusdPSM', 'rariPool8LusdPCVDeposit'], dai: ['compoundDaiPCVDepositWrapper', 'daiFixedPricePSM', 'rariPool8DaiPCVDeposit', 'dpiToDaiLensDai'], usd: ['namedStaticPCVDepositWrapper', 'd3poolCurvePCVDeposit', 'd3poolConvexPCVDeposit'], bal: ['balancerDepositBalWeth', 'balancerLensVeBalBal'], @@ -44,8 +35,8 @@ const collateralizationAddresses = { 'balancerLensBpt30Fei70Weth', 'balancerLensVeBalWeth' ], - dpi: ['rariPool19DpiPCVDepositWrapper', 'dpiDepositWrapper', 'dpiToDaiLensDpi'], - rai: ['rariPool9RaiPCVDepositWrapper', 'aaveRaiPCVDepositWrapper', 'raiDepositWrapper', 'raiPriceBoundPSM'], + dpi: ['dpiDepositWrapper', 'dpiToDaiLensDpi'], + rai: ['raiPriceBoundPSM'], agEUR: ['agEurDepositWrapper', 'uniswapLensAgEurUniswapGauge', 'agEurUniswapPCVDeposit'], volt: ['voltDepositWrapper'] }; diff --git a/protocol-configuration/mainnetAddresses.ts b/protocol-configuration/mainnetAddresses.ts index 89b4d82f1..cc85ec445 100644 --- a/protocol-configuration/mainnetAddresses.ts +++ b/protocol-configuration/mainnetAddresses.ts @@ -434,7 +434,7 @@ const MainnetAddresses: MainnetAddresses = { liquityFusePoolLusdPCVDeposit: { artifactName: 'ERC20CompoundPCVDeposit', address: '0x8C51E4532CC745cF3DFec5CEBd835D07E7BA1002', - category: AddressCategory.PCV + category: AddressCategory.Deprecated }, rariPool7LusdPCVDeposit: { artifactName: 'ERC20CompoundPCVDeposit', @@ -459,7 +459,7 @@ const MainnetAddresses: MainnetAddresses = { aaveRaiPCVDepositWrapper: { artifactName: 'PCVDepositWrapper', address: '0x1267B39c93711Dd374DEAB15e0127e4adB259BE0', - category: AddressCategory.PCV + category: AddressCategory.Deprecated }, compoundDaiPCVDepositWrapper: { artifactName: 'PCVDepositWrapper', @@ -519,7 +519,7 @@ const MainnetAddresses: MainnetAddresses = { rariPool19DpiPCVDepositWrapper: { artifactName: 'PCVDepositWrapper', address: '0x9a774a1B1208C323EDeD05E6Daf592E6E59cAa55', - category: AddressCategory.PCV + category: AddressCategory.Deprecated }, rariPool19FeiPCVDepositWrapper: { artifactName: 'PCVDepositWrapper', @@ -534,7 +534,7 @@ const MainnetAddresses: MainnetAddresses = { rariPool25FeiPCVDepositWrapper: { artifactName: 'PCVDepositWrapper', address: '0xB4FFD10C4C290Dc13E8e30BF186F1509001515fD', - category: AddressCategory.PCV + category: AddressCategory.Deprecated }, rariPool26FeiPCVDepositWrapper: { artifactName: 'PCVDepositWrapper', @@ -574,7 +574,7 @@ const MainnetAddresses: MainnetAddresses = { rariPool31FeiPCVDepositWrapper: { artifactName: 'PCVDepositWrapper', address: '0x05E2e93CFb0B53D36A3151ee727Bb581D4B918Ce', - category: AddressCategory.PCV + category: AddressCategory.Deprecated }, rariPool90FeiPCVDepositWrapper: { artifactName: 'PCVDepositWrapper', @@ -594,7 +594,7 @@ const MainnetAddresses: MainnetAddresses = { rariPool72FeiPCVDepositWrapper: { artifactName: 'PCVDepositWrapper', address: '0x395B1Bc1800fa0ad48ae3876E66d4C10d297650c', - category: AddressCategory.PCV + category: AddressCategory.Deprecated }, rariPool128FeiPCVDepositWrapper: { artifactName: 'PCVDepositWrapper', @@ -609,7 +609,7 @@ const MainnetAddresses: MainnetAddresses = { rariPool9RaiPCVDepositWrapper: { artifactName: 'PCVDepositWrapper', address: '0xCCe230c087F31032fc17621a2CF5E425A0b80C96', - category: AddressCategory.PCV + category: AddressCategory.Deprecated }, wethDepositWrapper: { artifactName: 'ERC20PCVDepositWrapper', @@ -624,7 +624,7 @@ const MainnetAddresses: MainnetAddresses = { raiDepositWrapper: { artifactName: 'ERC20PCVDepositWrapper', address: '0x7339cA4Ac94020b83A34f5edFA6e0F26986c434b', - category: AddressCategory.PCV + category: AddressCategory.Deprecated }, agEurDepositWrapper: { artifactName: 'ERC20PCVDepositWrapper', diff --git a/test/integration/proposals_config.ts b/test/integration/proposals_config.ts index c76acb97e..7668afa58 100644 --- a/test/integration/proposals_config.ts +++ b/test/integration/proposals_config.ts @@ -6,8 +6,24 @@ const proposals: ProposalsConfigMap = { swap_dpi_to_dai: { deploy: true, proposalId: null, - affectedContractSignoff: [], - deprecatedContractSignoff: [], + affectedContractSignoff: [ + 'dpi', + 'compoundDaiPCVDeposit', + 'dpiToDaiSwapper', + 'dpiToDaiLensDai', + 'dpiToDaiLensDpi', + '' + ], + deprecatedContractSignoff: [ + 'rariPool31FeiPCVDepositWrapper', + 'rariPool25FeiPCVDepositWrapper', + 'rariPool9RaiPCVDepositWrapper', + 'aaveRaiPCVDepositWrapper', + 'rariPool19DpiPCVDepositWrapper', + 'liquityFusePoolLusdPCVDeposit', + 'rariPool72FeiPCVDepositWrapper', + 'raiDepositWrapper' + ], category: ProposalCategory.DAO, totalValue: 0, proposal: swap_dpi_to_dai From b2e2716af739eb3a3c4c25b900337a9b9d98a77d Mon Sep 17 00:00:00 2001 From: thomas-waite Date: Fri, 13 May 2022 17:59:36 +0200 Subject: [PATCH 057/274] fix: update CR removal --- proposals/description/swap_dpi_to_dai.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/proposals/description/swap_dpi_to_dai.ts b/proposals/description/swap_dpi_to_dai.ts index 147d44965..cfc87e0fd 100644 --- a/proposals/description/swap_dpi_to_dai.ts +++ b/proposals/description/swap_dpi_to_dai.ts @@ -44,7 +44,7 @@ const swap_dpi_to_dai: ProposalDescription = { '{aaveRaiPCVDepositWrapper}', '{rariPool19DpiPCVDepositWrapper}', '{liquityFusePoolLusdPCVDeposit}', - '{rariPool72FeiPCVDepositWrapper', + '{rariPool72FeiPCVDepositWrapper}', '{raiDepositWrapper}' ] ], From 324ac216a18ce20ece532c6637aa8a1ecee6ea70 Mon Sep 17 00:00:00 2001 From: thomas-waite Date: Fri, 13 May 2022 18:07:38 +0200 Subject: [PATCH 058/274] refactor: fix dai PSM tests --- test/integration/tests/daiFixedPricePSM.ts | 6 ++++++ test/integration/tests/psm.ts | 8 +++++++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/test/integration/tests/daiFixedPricePSM.ts b/test/integration/tests/daiFixedPricePSM.ts index 69a66271a..3afdf8368 100644 --- a/test/integration/tests/daiFixedPricePSM.ts +++ b/test/integration/tests/daiFixedPricePSM.ts @@ -25,6 +25,7 @@ describe('e2e-peg-stability-module', function () { let doLogging: boolean; let userAddress; let minterAddress; + let governorAddress; let dai: Contract; let daiPSM: Contract; let fei: Contract; @@ -122,6 +123,11 @@ describe('e2e-peg-stability-module', function () { beforeEach(async () => { await fei.connect(impersonatedSigners[minterAddress]).mint(userAddress, redeemAmount); await fei.connect(impersonatedSigners[userAddress]).approve(daiPSM.address, redeemAmount); + + const isPaused = await daiPSM.paused(); + if (isPaused) { + await daiPSM.connect(impersonatedSigners[governorAddress]).unpause(); + } }); it('exchanges 10,000,000 FEI for DAI', async () => { diff --git a/test/integration/tests/psm.ts b/test/integration/tests/psm.ts index 3d88389b4..51bf3144f 100644 --- a/test/integration/tests/psm.ts +++ b/test/integration/tests/psm.ts @@ -23,6 +23,7 @@ describe('e2e-peg-stability-module', function () { let ethPSMRouter: Contract; let userAddress; let minterAddress; + let governorAddress; let weth: Contract; let dai: Contract; let raiPriceBoundPSM: Contract; @@ -88,7 +89,7 @@ describe('e2e-peg-stability-module', function () { contracts.feiDAOTimelock.address ]; - ({ userAddress, minterAddress, beneficiaryAddress1, guardianAddress } = addresses); + ({ userAddress, minterAddress, beneficiaryAddress1, guardianAddress, governorAddress } = addresses); await core.grantMinter(minterAddress); @@ -325,6 +326,11 @@ describe('e2e-peg-stability-module', function () { beforeEach(async () => { await fei.connect(impersonatedSigners[minterAddress]).mint(userAddress, redeemAmount); await fei.connect(impersonatedSigners[userAddress]).approve(daiFixedPricePSM.address, redeemAmount); + + const isPaused = await daiFixedPricePSM.paused(); + if (isPaused) { + await daiFixedPricePSM.connect(impersonatedSigners[governorAddress]).unpause(); + } }); it('exchanges 500,000 FEI for DAI', async () => { From c36d63cec5c1ad84185a0ee7b729fd828c39aad1 Mon Sep 17 00:00:00 2001 From: thomas-waite Date: Fri, 13 May 2022 18:12:07 +0200 Subject: [PATCH 059/274] refactor: mark underlying contracts as deprecated --- .../collateralizationOracle.ts | 2 +- protocol-configuration/mainnetAddresses.ts | 14 +++++++------- test/integration/proposals_config.ts | 18 +++++++++--------- 3 files changed, 17 insertions(+), 17 deletions(-) diff --git a/protocol-configuration/collateralizationOracle.ts b/protocol-configuration/collateralizationOracle.ts index 466d4d82b..8320cfd9d 100644 --- a/protocol-configuration/collateralizationOracle.ts +++ b/protocol-configuration/collateralizationOracle.ts @@ -35,7 +35,7 @@ const collateralizationAddresses = { 'balancerLensBpt30Fei70Weth', 'balancerLensVeBalWeth' ], - dpi: ['dpiDepositWrapper', 'dpiToDaiLensDpi'], + dpi: ['dpiToDaiLensDpi'], rai: ['raiPriceBoundPSM'], agEUR: ['agEurDepositWrapper', 'uniswapLensAgEurUniswapGauge', 'agEurUniswapPCVDeposit'], volt: ['voltDepositWrapper'] diff --git a/protocol-configuration/mainnetAddresses.ts b/protocol-configuration/mainnetAddresses.ts index 5c0118d1f..713247aa8 100644 --- a/protocol-configuration/mainnetAddresses.ts +++ b/protocol-configuration/mainnetAddresses.ts @@ -189,7 +189,7 @@ const MainnetAddresses: MainnetAddresses = { aaveRaiPCVDeposit: { artifactName: 'AavePCVDeposit', address: '0xd2174d78637a40448112aa6B30F9B19e6CF9d1F9', - category: AddressCategory.PCV_V1 + category: AddressCategory.Deprecated }, compoundDaiPCVDeposit: { artifactName: 'ERC20CompoundPCVDeposit', @@ -239,7 +239,7 @@ const MainnetAddresses: MainnetAddresses = { rariPool25FeiPCVDeposit: { artifactName: 'ERC20CompoundPCVDeposit', address: '0xe1662531aA5de1DAD8ab5B5756b8F6c8F3C759Ca', - category: AddressCategory.PCV_V1 + category: AddressCategory.Deprecated }, rariPool26FeiPCVDeposit: { artifactName: 'ERC20CompoundPCVDeposit', @@ -259,7 +259,7 @@ const MainnetAddresses: MainnetAddresses = { rariPool19DpiPCVDeposit: { artifactName: 'ERC20CompoundPCVDeposit', address: '0x3dD3d945C4253bAc5B4Cc326a001B7d3f9C4DD66', - category: AddressCategory.PCV_V1 + category: AddressCategory.Deprecated }, rariPool19FeiPCVDeposit: { artifactName: 'ERC20CompoundPCVDeposit', @@ -289,7 +289,7 @@ const MainnetAddresses: MainnetAddresses = { rariPool9RaiPCVDeposit: { artifactName: 'ERC20CompoundPCVDeposit', address: '0x9aAdFfe00eAe6d8e59bB4F7787C6b99388A6960D', - category: AddressCategory.PCV_V1 + category: AddressCategory.Deprecated }, rariPool28FeiPCVDeposit: { artifactName: 'ERC20CompoundPCVDeposit', @@ -299,12 +299,12 @@ const MainnetAddresses: MainnetAddresses = { rariPool31FeiPCVDeposit: { artifactName: 'ERC20CompoundPCVDeposit', address: '0x81DCB06eA4db474D1506Ca6275Ff7D870bA3A1Be', - category: AddressCategory.PCV_V1 + category: AddressCategory.Deprecated }, rariPool72FeiPCVDeposit: { artifactName: 'ERC20CompoundPCVDeposit', address: '0x4A5Af5A124E672C156241b76CAd4E41D09dd4883', - category: AddressCategory.PCV_V1 + category: AddressCategory.Deprecated }, rariPool79FeiPCVDeposit: { artifactName: 'ERC20CompoundPCVDeposit', @@ -619,7 +619,7 @@ const MainnetAddresses: MainnetAddresses = { dpiDepositWrapper: { artifactName: 'ERC20PCVDepositWrapper', address: '0xB250926E75b1CC6c53E77bb9426Baac14aB1e24c', - category: AddressCategory.PCV + category: AddressCategory.Deprecated }, raiDepositWrapper: { artifactName: 'ERC20PCVDepositWrapper', diff --git a/test/integration/proposals_config.ts b/test/integration/proposals_config.ts index 7668afa58..efe521531 100644 --- a/test/integration/proposals_config.ts +++ b/test/integration/proposals_config.ts @@ -6,14 +6,7 @@ const proposals: ProposalsConfigMap = { swap_dpi_to_dai: { deploy: true, proposalId: null, - affectedContractSignoff: [ - 'dpi', - 'compoundDaiPCVDeposit', - 'dpiToDaiSwapper', - 'dpiToDaiLensDai', - 'dpiToDaiLensDpi', - '' - ], + affectedContractSignoff: ['dpi', 'compoundDaiPCVDeposit', 'dpiToDaiSwapper', 'dpiToDaiLensDai', 'dpiToDaiLensDpi'], deprecatedContractSignoff: [ 'rariPool31FeiPCVDepositWrapper', 'rariPool25FeiPCVDepositWrapper', @@ -22,7 +15,14 @@ const proposals: ProposalsConfigMap = { 'rariPool19DpiPCVDepositWrapper', 'liquityFusePoolLusdPCVDeposit', 'rariPool72FeiPCVDepositWrapper', - 'raiDepositWrapper' + 'raiDepositWrapper', + 'rariPool31FeiPCVDeposit', + 'rariPool25FeiPCVDeposit', + 'rariPool9RaiPCVDeposit', + 'aaveRaiPCVDeposit', + 'rariPool19DpiPCVDeposit', + 'rariPool72FeiPCVDeposit', + 'dpiDepositWrapper' ], category: ProposalCategory.DAO, totalValue: 0, From 07aaff48f23804831c0853fedc58be6b1be7485d Mon Sep 17 00:00:00 2001 From: thomas-waite Date: Fri, 13 May 2022 18:21:59 +0200 Subject: [PATCH 060/274] test: unpause redeems in tests --- test/integration/tests/daiFixedPricePSM.ts | 7 ++++++- test/integration/tests/psm.ts | 7 ++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/test/integration/tests/daiFixedPricePSM.ts b/test/integration/tests/daiFixedPricePSM.ts index 3afdf8368..93ab14c8b 100644 --- a/test/integration/tests/daiFixedPricePSM.ts +++ b/test/integration/tests/daiFixedPricePSM.ts @@ -126,7 +126,12 @@ describe('e2e-peg-stability-module', function () { const isPaused = await daiPSM.paused(); if (isPaused) { - await daiPSM.connect(impersonatedSigners[governorAddress]).unpause(); + await daiPSM.unpause(); + } + + const isRedeemPaused = await daiPSM.redeemPaused(); + if (isRedeemPaused) { + await daiPSM.unpauseRedeem(); } }); diff --git a/test/integration/tests/psm.ts b/test/integration/tests/psm.ts index 51bf3144f..dc64d9c96 100644 --- a/test/integration/tests/psm.ts +++ b/test/integration/tests/psm.ts @@ -329,7 +329,12 @@ describe('e2e-peg-stability-module', function () { const isPaused = await daiFixedPricePSM.paused(); if (isPaused) { - await daiFixedPricePSM.connect(impersonatedSigners[governorAddress]).unpause(); + await daiFixedPricePSM.unpause(); + } + + const isRedeemPaused = await daiFixedPricePSM.redeemPaused(); + if (isRedeemPaused) { + await daiFixedPricePSM.unpauseRedeem(); } }); From 950a668e8993198ad5251e96d9c0216850aaa844 Mon Sep 17 00:00:00 2001 From: thomas-waite Date: Fri, 13 May 2022 20:20:25 +0200 Subject: [PATCH 061/274] test: fix error message in test --- test/unit/pcv/utils/FeiSkimmer.test.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/unit/pcv/utils/FeiSkimmer.test.ts b/test/unit/pcv/utils/FeiSkimmer.test.ts index dfad53b18..a94ff9985 100644 --- a/test/unit/pcv/utils/FeiSkimmer.test.ts +++ b/test/unit/pcv/utils/FeiSkimmer.test.ts @@ -94,7 +94,7 @@ describe('FeiSkimmer', function () { it('not from governor fails', async function () { await expectRevert( skimmer.connect(impersonatedSigners[userAddress]).setSource(userAddress), - 'CoreRef: Caller is not a governor or contract admin' + 'CoreRef: Caller is not a governor' ); }); }); From 17973d9012eb450b5c1c0eb9a0b20c6fd6485bae Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 16 May 2022 07:45:10 +0000 Subject: [PATCH 062/274] Bump @rari-capital/solmate from 6.2.0 to 6.3.0 Bumps [@rari-capital/solmate](https://github.com/Rari-Capital/solmate) from 6.2.0 to 6.3.0. - [Release notes](https://github.com/Rari-Capital/solmate/releases) - [Commits](https://github.com/Rari-Capital/solmate/commits) --- updated-dependencies: - dependency-name: "@rari-capital/solmate" dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- package-lock.json | 14 +++++++------- package.json | 2 +- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/package-lock.json b/package-lock.json index 03091eac0..418250920 100644 --- a/package-lock.json +++ b/package-lock.json @@ -19,7 +19,7 @@ "@openzeppelin/test-environment": "^0.1.7", "@openzeppelin/test-helpers": "^0.5.15", "@orcaprotocol/contracts": "^5.0.1", - "@rari-capital/solmate": "^6.2.0", + "@rari-capital/solmate": "^6.3.0", "@uniswap/lib": "^1.1.2", "@uniswap/v2-core": "^1.0.1", "@uniswap/v2-periphery": "^1.1.0-beta.0", @@ -2324,9 +2324,9 @@ } }, "node_modules/@rari-capital/solmate": { - "version": "6.2.0", - "resolved": "https://registry.npmjs.org/@rari-capital/solmate/-/solmate-6.2.0.tgz", - "integrity": "sha512-g94F+Ra9ixyJyNgvnOIufNjUz488uEG0nxIEEtJ7+g+tA1XGUupRB2kB5b+VO7WYO26RNOVD2fW6xE4e14iWpg==" + "version": "6.3.0", + "resolved": "https://registry.npmjs.org/@rari-capital/solmate/-/solmate-6.3.0.tgz", + "integrity": "sha512-SWPbnfZUCe4ahHNqcb0qsPrzzAzMZMoA3x6SxZn04g0dLm0xupVeHonM3LK13uhPGIULF8HzXg8CgXE/fEnMlQ==" }, "node_modules/@resolver-engine/core": { "version": "0.3.3", @@ -30477,9 +30477,9 @@ } }, "@rari-capital/solmate": { - "version": "6.2.0", - "resolved": "https://registry.npmjs.org/@rari-capital/solmate/-/solmate-6.2.0.tgz", - "integrity": "sha512-g94F+Ra9ixyJyNgvnOIufNjUz488uEG0nxIEEtJ7+g+tA1XGUupRB2kB5b+VO7WYO26RNOVD2fW6xE4e14iWpg==" + "version": "6.3.0", + "resolved": "https://registry.npmjs.org/@rari-capital/solmate/-/solmate-6.3.0.tgz", + "integrity": "sha512-SWPbnfZUCe4ahHNqcb0qsPrzzAzMZMoA3x6SxZn04g0dLm0xupVeHonM3LK13uhPGIULF8HzXg8CgXE/fEnMlQ==" }, "@resolver-engine/core": { "version": "0.3.3", diff --git a/package.json b/package.json index 7bd5ebe34..cfd17ae86 100644 --- a/package.json +++ b/package.json @@ -59,7 +59,7 @@ "@openzeppelin/test-environment": "^0.1.7", "@openzeppelin/test-helpers": "^0.5.15", "@orcaprotocol/contracts": "^5.0.1", - "@rari-capital/solmate": "^6.2.0", + "@rari-capital/solmate": "^6.3.0", "@uniswap/lib": "^1.1.2", "@uniswap/v2-core": "^1.0.1", "@uniswap/v2-periphery": "^1.1.0-beta.0", From f134cf6bd86762ddc6f8b9fbc989cc4f22408ca4 Mon Sep 17 00:00:00 2001 From: thomas-waite Date: Mon, 16 May 2022 11:21:54 +0200 Subject: [PATCH 063/274] refactor: reduce LBP timeline to 2 weeks --- proposals/dao/swap_dpi_to_dai.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/proposals/dao/swap_dpi_to_dai.ts b/proposals/dao/swap_dpi_to_dai.ts index 0785bae97..b1b378d0d 100644 --- a/proposals/dao/swap_dpi_to_dai.ts +++ b/proposals/dao/swap_dpi_to_dai.ts @@ -20,7 +20,7 @@ Swap DPI for DAI using an LBP Swapper const fipNumber = 'swap_dpi_to_dai'; // LBP Swapper config -const LBP_FREQUENCY = 86400 * 30; // 1 month in seconds +const LBP_FREQUENCY = 86400 * 14; // 2 weeks in seconds const MIN_LBP_SIZE = ethers.constants.WeiPerEther.mul(10_000); // 10k let poolId; // auction pool id From 98269dd3ba2de528747d562ea584f3d9b09d2d77 Mon Sep 17 00:00:00 2001 From: thomas-waite Date: Mon, 16 May 2022 14:21:21 +0200 Subject: [PATCH 064/274] feat: give TribalCouncilTimelock SWAP_ADMIN_ROLE --- proposals/dao/swap_dpi_to_dai.ts | 8 ++++- proposals/description/swap_dpi_to_dai.ts | 27 +++++++++++++++++ .../collateralizationOracle.ts | 1 - test/integration/proposals_config.ts | 30 ------------------- 4 files changed, 34 insertions(+), 32 deletions(-) diff --git a/proposals/dao/swap_dpi_to_dai.ts b/proposals/dao/swap_dpi_to_dai.ts index b1b378d0d..30c3cf5a8 100644 --- a/proposals/dao/swap_dpi_to_dai.ts +++ b/proposals/dao/swap_dpi_to_dai.ts @@ -155,6 +155,8 @@ const teardown: TeardownUpgradeFunc = async (addresses, oldContracts, contracts, // Run any validations required on the fip using mocha or console logging // IE check balances, check state of contracts, etc. const validate: ValidateUpgradeFunc = async (addresses, oldContracts, contracts, logging) => { + const core = contracts.core; + // By this point, the DAO has moved funds to the LBP swapper and the auction should be active console.log('Final DAI PSM dai balance [M]', (await contracts.compoundDaiPCVDeposit.balance()) / 1e24); @@ -164,7 +166,11 @@ const validate: ValidateUpgradeFunc = async (addresses, oldContracts, contracts, await time.increase(await contracts.dpiToDaiSwapper.remainingTime()); expect(await contracts.dpiToDaiSwapper.isTimeEnded()).to.be.true; - const signer = await getImpersonatedSigner(addresses.optimisticTimelock); // TODO: TribalCouncil should grant itself SWAP_ADMIN_ROLE + // Validate SWAP_ADMIN_ROLE is under ROLE_ADMIN and that TribalCouncilTimelock has the role + expect(await core.hasRole(ethers.utils.id('SWAP_ADMIN_ROLE'), addresses.tribalCouncilTimelock)).to.be.true; + expect(await core.getRoleAdmin(ethers.utils.id('SWAP_ADMIN_ROLE'))).to.be.equal(ethers.utils.id('ROLE_ADMIN')); + + const signer = await getImpersonatedSigner(addresses.tribalCouncilTimelock); // TODO: TribalCouncil should grant itself SWAP_ADMIN_ROLE await contracts.dpiToDaiSwapper.connect(signer).swap(); expect(await contracts.dpiToDaiSwapper.isTimeEnded()).to.be.false; }; diff --git a/proposals/description/swap_dpi_to_dai.ts b/proposals/description/swap_dpi_to_dai.ts index cfc87e0fd..e08ed651c 100644 --- a/proposals/description/swap_dpi_to_dai.ts +++ b/proposals/description/swap_dpi_to_dai.ts @@ -49,6 +49,33 @@ const swap_dpi_to_dai: ProposalDescription = { ] ], description: 'Remove DPI Deposit wrapper from CR oracle, as now empty' + }, + { + target: 'core', + values: '0', + method: 'createRole(bytes32,bytes32)', + arguments: [ + '0x471cfe1a44bf1b786db7d7104d51e6728ed7b90a35394ad7cc424adf8ed16816', // SWAP_ADMIN_ROLE + '0x899bd46557473cb80307a9dabc297131ced39608330a2d29b2d52b660c03923e' // GOVERN_ROLE + ], + description: 'Transfer admin of SWAP_ADMIN_ROLE to GOVERNOR, so it can be granted to the TribalCouncil' + }, + { + target: 'core', + values: '0', + method: 'grantRole(bytes32,address)', + arguments: ['0x471cfe1a44bf1b786db7d7104d51e6728ed7b90a35394ad7cc424adf8ed16816', '{tribalCouncilTimelock}'], + description: 'Grant TribalCouncilTimelock SWAP_ADMIN_ROLE so it can initiate the LBP swap' + }, + { + target: 'core', + values: '0', + method: 'createRole(bytes32,bytes32)', + arguments: [ + '0x471cfe1a44bf1b786db7d7104d51e6728ed7b90a35394ad7cc424adf8ed16816', + '0x2172861495e7b85edac73e3cd5fbb42dd675baadf627720e687bcfdaca025096' + ], + description: 'Transfer admin of SWAP_ADMIN_ROLE back to ROLE_ADMIN, so TribalCouncil can control' } ], description: ` diff --git a/protocol-configuration/collateralizationOracle.ts b/protocol-configuration/collateralizationOracle.ts index 2d28ae980..d41caebaf 100644 --- a/protocol-configuration/collateralizationOracle.ts +++ b/protocol-configuration/collateralizationOracle.ts @@ -14,7 +14,6 @@ const collateralizationAddresses = { ], lusd: ['rariPool7LusdPCVDeposit', 'bammDeposit', 'lusdPSM'], dai: ['compoundDaiPCVDepositWrapper', 'daiFixedPricePSM', 'dpiToDaiLensDai'], - usd: ['namedStaticPCVDepositWrapper', 'd3poolCurvePCVDeposit', 'd3poolConvexPCVDeposit'], bal: ['balancerDepositBalWeth', 'balancerLensVeBalBal'], cream: ['creamDepositWrapper'], diff --git a/test/integration/proposals_config.ts b/test/integration/proposals_config.ts index 059c4a607..be1e2e029 100644 --- a/test/integration/proposals_config.ts +++ b/test/integration/proposals_config.ts @@ -1,39 +1,9 @@ import { ProposalCategory, ProposalsConfigMap } from '@custom-types/types'; import swap_dpi_to_dai from '@proposals/description/swap_dpi_to_dai'; -import oa_cr_fix from '@proposals/description/oa_cr_fix'; -import withdraw_aave_comp_fei from '@proposals/description/withdraw_aave_comp_fei'; // import fip_xx_proposal from '@proposals/description/fip_xx'; const proposals: ProposalsConfigMap = { - withdraw_aave_comp_fei: { - deploy: true, // deploy flag for whether to run deploy action during e2e tests or use mainnet state - totalValue: 0, // amount of ETH to send to DAO execution - proposal: withdraw_aave_comp_fei, // full proposal file, imported from '@proposals/description/fip_xx.ts' - proposalId: '', - affectedContractSignoff: [''], - deprecatedContractSignoff: [''], - category: ProposalCategory.TC - }, - oa_cr_fix: { - deploy: false, // deploy flag for whether to run deploy action during e2e tests or use mainnet state - totalValue: 0, // amount of ETH to send to DAO execution - proposal: oa_cr_fix, // full proposal file, imported from '@proposals/description/fip_xx.ts' - proposalId: '', - affectedContractSignoff: ['collateralizationOracle', 'balancerLensBpt30Fei70Weth'], - deprecatedContractSignoff: [ - 'balancerLensBpt30Fei70WethOld', - 'rariPool8FeiPCVDepositWrapper', - 'rariPool8DaiPCVDeposit', - 'rariPool8LusdPCVDeposit', - 'rariPool18FeiPCVDepositWrapper', - 'rariPool27FeiPCVDepositWrapper', - 'rariPool90FeiPCVDepositWrapper', - 'rariPool146EthPCVDeposit', - 'convexPoolPCVDepositWrapper' - ], - category: ProposalCategory.OA - }, swap_dpi_to_dai: { deploy: true, proposalId: null, From 11f9a5ea027cee1600d1423bff2422db94628018 Mon Sep 17 00:00:00 2001 From: thomas-waite Date: Mon, 16 May 2022 14:48:26 +0200 Subject: [PATCH 065/274] test: send funds to TC| --- proposals/dao/swap_dpi_to_dai.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/proposals/dao/swap_dpi_to_dai.ts b/proposals/dao/swap_dpi_to_dai.ts index 30c3cf5a8..82d1512d5 100644 --- a/proposals/dao/swap_dpi_to_dai.ts +++ b/proposals/dao/swap_dpi_to_dai.ts @@ -143,7 +143,7 @@ const setup: SetupUpgradeFunc = async (addresses, oldContracts, contracts, loggi console.log('Starting DAI PSM dai balance [M]', (await contracts.compoundDaiPCVDeposit.balance()) / 1e24); - await forceEth(addresses.optimisticTimelock); + await forceEth(addresses.tribalCouncilTimelock); }; // Tears down any changes made in setup() that need to be From ca95f300d074038ffb7ec9555bdc4587b354556b Mon Sep 17 00:00:00 2001 From: thomas-waite Date: Mon, 16 May 2022 15:11:22 +0200 Subject: [PATCH 066/274] refactor: update permissions and block num --- block.txt | 2 +- protocol-configuration/permissions.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/block.txt b/block.txt index 1474b8721..39ed14562 100644 --- a/block.txt +++ b/block.txt @@ -1 +1 @@ -14767945 \ No newline at end of file +14786414 \ No newline at end of file diff --git a/protocol-configuration/permissions.ts b/protocol-configuration/permissions.ts index ca1aaae8c..c5f46d43a 100644 --- a/protocol-configuration/permissions.ts +++ b/protocol-configuration/permissions.ts @@ -31,7 +31,7 @@ export const permissions = { 'opsOptimisticTimelock', 'tribalCouncilTimelock' ], - SWAP_ADMIN_ROLE: ['pcvEquityMinter', 'optimisticTimelock'], + SWAP_ADMIN_ROLE: ['pcvEquityMinter', 'optimisticTimelock', 'tribalCouncilTimelock'], BALANCER_MANAGER_ADMIN_ROLE: [], RATE_LIMITED_MINTER_ADMIN: [], PARAMETER_ADMIN: [], From 32acabdcef0334ec860ffb23b971fc6136631cf9 Mon Sep 17 00:00:00 2001 From: thomas-waite Date: Mon, 16 May 2022 22:00:18 +0200 Subject: [PATCH 067/274] feat: add new address for dai fixed price psm skimmer --- block.txt | 2 +- protocol-configuration/mainnetAddresses.ts | 10 +++--- test/integration/proposals_config.ts | 42 +--------------------- 3 files changed, 7 insertions(+), 47 deletions(-) diff --git a/block.txt b/block.txt index f8f3c141f..39ed14562 100644 --- a/block.txt +++ b/block.txt @@ -1 +1 @@ -14751415 \ No newline at end of file +14786414 \ No newline at end of file diff --git a/protocol-configuration/mainnetAddresses.ts b/protocol-configuration/mainnetAddresses.ts index d22f9ba68..23344bff7 100644 --- a/protocol-configuration/mainnetAddresses.ts +++ b/protocol-configuration/mainnetAddresses.ts @@ -1681,11 +1681,11 @@ const MainnetAddresses: MainnetAddresses = { address: '0xFf419Bc27483edb94b7Ad5c97b7FaB5DB323c7E0', category: AddressCategory.Deprecated }, - // daiFixedPricePSMFeiSkimmer: { - // artifactName: 'FeiSkimmer', - // address: '', - // category: AddressCategory.Peg - // }, + daiFixedPricePSMFeiSkimmer: { + artifactName: 'FeiSkimmer', + address: '0xe49B608663EeB89f1E3AbBe75744e5318F85029C', + category: AddressCategory.Peg + }, daiPSMFeiSkimmer: { artifactName: 'FeiSkimmer', address: '0xf8Ca6c10a794C867497541F5b7A7f96ca2bCd1E8', diff --git a/test/integration/proposals_config.ts b/test/integration/proposals_config.ts index 2dadf133d..29528f165 100644 --- a/test/integration/proposals_config.ts +++ b/test/integration/proposals_config.ts @@ -1,57 +1,17 @@ import { ProposalCategory, ProposalsConfigMap } from '@custom-types/types'; -import withdraw_d3_pool from '@proposals/description/withdraw_d3_pool'; -import withdraw_aave_comp_fei from '@proposals/description/withdraw_aave_comp_fei'; import fip_105 from '@proposals/description/fip_105'; -import oa_cr_fix from '@proposals/description/oa_cr_fix'; // import fip_xx_proposal from '@proposals/description/fip_xx'; const proposals: ProposalsConfigMap = { fip_105: { - deploy: true, // deploy flag for whether to run deploy action during e2e tests or use mainnet state + deploy: false, // deploy flag for whether to run deploy action during e2e tests or use mainnet state totalValue: 0, // amount of ETH to send to DAO execution proposal: fip_105, // full proposal file, imported from '@proposals/description/fip_xx.ts' proposalId: '', affectedContractSignoff: ['daiFixedPricePSMFeiSkimmer', 'core'], deprecatedContractSignoff: [], category: ProposalCategory.DAO - }, - withdraw_d3_pool: { - deploy: false, // deploy flag for whether to run deploy action during e2e tests or use mainnet state - totalValue: 0, // amount of ETH to send to DAO execution - proposal: withdraw_d3_pool, // full proposal file, imported from '@proposals/description/fip_xx.ts' - proposalId: '', - affectedContractSignoff: ['pcvGuardianNew', 'd3poolCurvePCVDeposit', 'd3poolConvexPCVDeposit', 'daiFixedPricePSM'], - deprecatedContractSignoff: [], - category: ProposalCategory.TC - }, - withdraw_aave_comp_fei: { - deploy: true, // deploy flag for whether to run deploy action during e2e tests or use mainnet state - totalValue: 0, // amount of ETH to send to DAO execution - proposal: withdraw_aave_comp_fei, // full proposal file, imported from '@proposals/description/fip_xx.ts' - proposalId: '', - affectedContractSignoff: ['pcvGuardianNew', 'aaveFeiPCVDeposit', 'daiFixedPricePSM'], - deprecatedContractSignoff: [''], - category: ProposalCategory.TC - }, - oa_cr_fix: { - deploy: false, // deploy flag for whether to run deploy action during e2e tests or use mainnet state - totalValue: 0, // amount of ETH to send to DAO execution - proposal: oa_cr_fix, // full proposal file, imported from '@proposals/description/fip_xx.ts' - proposalId: '', - affectedContractSignoff: ['collateralizationOracle', 'balancerLensBpt30Fei70Weth'], - deprecatedContractSignoff: [ - 'balancerLensBpt30Fei70WethOld', - 'rariPool8FeiPCVDepositWrapper', - 'rariPool8DaiPCVDeposit', - 'rariPool8LusdPCVDeposit', - 'rariPool18FeiPCVDepositWrapper', - 'rariPool27FeiPCVDepositWrapper', - 'rariPool90FeiPCVDepositWrapper', - 'rariPool146EthPCVDeposit', - 'convexPoolPCVDepositWrapper' - ], - category: ProposalCategory.OA } }; From b24be6c29803fd68116617d26676612b5c84a5fa Mon Sep 17 00:00:00 2001 From: thomas-waite Date: Mon, 16 May 2022 22:11:22 +0200 Subject: [PATCH 068/274] refactor: update block num --- block.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/block.txt b/block.txt index 39ed14562..b35554cfd 100644 --- a/block.txt +++ b/block.txt @@ -1 +1 @@ -14786414 \ No newline at end of file +14788265 \ No newline at end of file From 7ade496e6dd1c7877e9ed3e63260e622e8281add Mon Sep 17 00:00:00 2001 From: thomas-waite Date: Mon, 16 May 2022 22:17:02 +0200 Subject: [PATCH 069/274] test: unpause in tests --- test/integration/tests/daiFixedPricePSM.ts | 10 ++++++++++ test/integration/tests/psm.ts | 10 ++++++++++ 2 files changed, 20 insertions(+) diff --git a/test/integration/tests/daiFixedPricePSM.ts b/test/integration/tests/daiFixedPricePSM.ts index 69a66271a..551b0fcf3 100644 --- a/test/integration/tests/daiFixedPricePSM.ts +++ b/test/integration/tests/daiFixedPricePSM.ts @@ -122,6 +122,16 @@ describe('e2e-peg-stability-module', function () { beforeEach(async () => { await fei.connect(impersonatedSigners[minterAddress]).mint(userAddress, redeemAmount); await fei.connect(impersonatedSigners[userAddress]).approve(daiPSM.address, redeemAmount); + + const isPaused = await daiPSM.paused(); + if (isPaused) { + await daiPSM.unpause(); + } + + const isRedeemPaused = await daiPSM.redeemPaused(); + if (isRedeemPaused) { + await daiPSM.unpauseRedeem(); + } }); it('exchanges 10,000,000 FEI for DAI', async () => { diff --git a/test/integration/tests/psm.ts b/test/integration/tests/psm.ts index 3d88389b4..944202fc2 100644 --- a/test/integration/tests/psm.ts +++ b/test/integration/tests/psm.ts @@ -325,6 +325,16 @@ describe('e2e-peg-stability-module', function () { beforeEach(async () => { await fei.connect(impersonatedSigners[minterAddress]).mint(userAddress, redeemAmount); await fei.connect(impersonatedSigners[userAddress]).approve(daiFixedPricePSM.address, redeemAmount); + + const isPaused = await daiFixedPricePSM.paused(); + if (isPaused) { + await daiFixedPricePSM.unpause(); + } + + const isRedeemPaused = await daiFixedPricePSM.redeemPaused(); + if (isRedeemPaused) { + await daiFixedPricePSM.unpauseRedeem(); + } }); it('exchanges 500,000 FEI for DAI', async () => { From 57b576bc9d1d1f6f084224a20e926874969ebee1 Mon Sep 17 00:00:00 2001 From: thomas-waite Date: Mon, 16 May 2022 22:52:36 +0200 Subject: [PATCH 070/274] refactor: remove changing of admin --- proposals/description/swap_dpi_to_dai.ts | 20 -------------------- 1 file changed, 20 deletions(-) diff --git a/proposals/description/swap_dpi_to_dai.ts b/proposals/description/swap_dpi_to_dai.ts index e08ed651c..7618b5e0d 100644 --- a/proposals/description/swap_dpi_to_dai.ts +++ b/proposals/description/swap_dpi_to_dai.ts @@ -50,32 +50,12 @@ const swap_dpi_to_dai: ProposalDescription = { ], description: 'Remove DPI Deposit wrapper from CR oracle, as now empty' }, - { - target: 'core', - values: '0', - method: 'createRole(bytes32,bytes32)', - arguments: [ - '0x471cfe1a44bf1b786db7d7104d51e6728ed7b90a35394ad7cc424adf8ed16816', // SWAP_ADMIN_ROLE - '0x899bd46557473cb80307a9dabc297131ced39608330a2d29b2d52b660c03923e' // GOVERN_ROLE - ], - description: 'Transfer admin of SWAP_ADMIN_ROLE to GOVERNOR, so it can be granted to the TribalCouncil' - }, { target: 'core', values: '0', method: 'grantRole(bytes32,address)', arguments: ['0x471cfe1a44bf1b786db7d7104d51e6728ed7b90a35394ad7cc424adf8ed16816', '{tribalCouncilTimelock}'], description: 'Grant TribalCouncilTimelock SWAP_ADMIN_ROLE so it can initiate the LBP swap' - }, - { - target: 'core', - values: '0', - method: 'createRole(bytes32,bytes32)', - arguments: [ - '0x471cfe1a44bf1b786db7d7104d51e6728ed7b90a35394ad7cc424adf8ed16816', - '0x2172861495e7b85edac73e3cd5fbb42dd675baadf627720e687bcfdaca025096' - ], - description: 'Transfer admin of SWAP_ADMIN_ROLE back to ROLE_ADMIN, so TribalCouncil can control' } ], description: ` From 30c1e33c665c897bc07422ce4a36976a0e3c8293 Mon Sep 17 00:00:00 2001 From: Caleb Date: Mon, 16 May 2022 14:25:14 -0700 Subject: [PATCH 071/274] formatting --- scripts/utils/getFuseBadDebt.ts | 27 ++++++++++++++++++--------- 1 file changed, 18 insertions(+), 9 deletions(-) diff --git a/scripts/utils/getFuseBadDebt.ts b/scripts/utils/getFuseBadDebt.ts index 2b29ca205..5f723349c 100644 --- a/scripts/utils/getFuseBadDebt.ts +++ b/scripts/utils/getFuseBadDebt.ts @@ -1,13 +1,10 @@ import hre from 'hardhat'; -import { CTokenFuse } from '@custom-types/contracts'; import { forceEth } from '@test/integration/setup/utils'; import { getAddress } from 'ethers/lib/utils'; -import { BigNumber } from 'ethers'; +import { BigNumber, constants } from 'ethers'; const debtorContractAddress = '0x32075bad9050d4767018084f0cb87b3182d36c45'; -const affectedPoolIds = [8, 18, 27, 127, 144, 146, 156]; - const underlyings = { '0x0000000000000000000000000000000000000000': 'ETH', '0x956f47f50a910163d8bf957cf5846d573e7f87ca': 'FEI', @@ -76,10 +73,10 @@ async function getFuseBadDebt() { DAI: BigNumber.from(0), USDC: BigNumber.from(0), LUSD: BigNumber.from(0), - wstETH: BigNumber.from(0), USTw: BigNumber.from(0), + USDT: BigNumber.from(0), WETH: BigNumber.from(0), - USDT: BigNumber.from(0) + wstETH: BigNumber.from(0) }; const signer = (await hre.ethers.getSigners())[0]; @@ -89,17 +86,29 @@ async function getFuseBadDebt() { const ctoken = await hre.ethers.getContractAt('CTokenFuse', ctokenAddress, signer); const underlyingAddress = (await ctoken.underlying()).toLowerCase(); const debtAmount = await ctoken.callStatic.borrowBalanceCurrent(getAddress(debtorContractAddress)); - const collateralName = underlyings[underlyingAddress]; - debt[collateralName] = debt[collateralName].add(debtAmount); if (!debtAmount.isZero()) { + const collateralName = underlyings[underlyingAddress]; + debt[collateralName] = debt[collateralName].add(debtAmount); console.log(`Added ${collateralName} debt of ${debtAmount} from ${ctokens[ctokenAddress]}`); } } + debt.ETH = debt.ETH.div(constants.WeiPerEther); + debt.FEI = debt.FEI.div(constants.WeiPerEther); + debt.FRAX = debt.FRAX.div(constants.WeiPerEther); + debt.RAI = debt.RAI.div(constants.WeiPerEther); + debt.DAI = debt.DAI.div(constants.WeiPerEther); + debt.USDC = debt.USDC.div(1e6); + debt.LUSD = debt.LUSD.div(constants.WeiPerEther); + debt.USTw = debt.USTw.div(1e6); + debt.USDT = debt.USDT.div(1e6); + console.log(`\nTotal debt as of block ${hre.ethers.provider.blockNumber} for address ${debtorContractAddress}`); console.log(`--------------------------`); for (const key of Object.keys(debt)) { - console.log(`${key}: ${debt[key].toString()}`); + if (!debt[key].isZero()) { + console.log(`${key}: ${Number(debt[key].toString()).toLocaleString()}`); + } } } From 7e614ce8fb3b9255f18b24252d841459baec4630 Mon Sep 17 00:00:00 2001 From: thomas-waite Date: Tue, 17 May 2022 00:13:09 +0200 Subject: [PATCH 072/274] refactor: correct block num --- block.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/block.txt b/block.txt index 76ed873a8..6a23bbc64 100644 --- a/block.txt +++ b/block.txt @@ -1 +1 @@ -14786414 +14788265 From 5a8f4a786155dc40d44c0235ebcf889e8eb65c86 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 17 May 2022 07:22:22 +0000 Subject: [PATCH 073/274] build(deps-dev): bump @types/node from 17.0.32 to 17.0.34 Bumps [@types/node](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/node) from 17.0.32 to 17.0.34. - [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases) - [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/node) --- updated-dependencies: - dependency-name: "@types/node" dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- package-lock.json | 14 +++++++------- package.json | 2 +- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/package-lock.json b/package-lock.json index 03091eac0..b249614ef 100644 --- a/package-lock.json +++ b/package-lock.json @@ -39,7 +39,7 @@ "@typechain/hardhat": "^2.3.0", "@types/chai": "^4.3.1", "@types/mocha": "^9.1.1", - "@types/node": "^17.0.32", + "@types/node": "^17.0.34", "@typescript-eslint/eslint-plugin": "^4.31.2", "@typescript-eslint/parser": "^4.31.2", "chai-bn": "^0.3.1", @@ -4471,9 +4471,9 @@ "dev": true }, "node_modules/@types/node": { - "version": "17.0.32", - "resolved": "https://registry.npmjs.org/@types/node/-/node-17.0.32.tgz", - "integrity": "sha512-eAIcfAvhf/BkHcf4pkLJ7ECpBAhh9kcxRBpip9cTiO+hf+aJrsxYxBeS6OXvOd9WqNAJmavXVpZvY1rBjNsXmw==" + "version": "17.0.34", + "resolved": "https://registry.npmjs.org/@types/node/-/node-17.0.34.tgz", + "integrity": "sha512-XImEz7XwTvDBtzlTnm8YvMqGW/ErMWBsKZ+hMTvnDIjGCKxwK5Xpc+c/oQjOauwq8M4OS11hEkpjX8rrI/eEgA==" }, "node_modules/@types/node-fetch": { "version": "2.6.1", @@ -32393,9 +32393,9 @@ "dev": true }, "@types/node": { - "version": "17.0.32", - "resolved": "https://registry.npmjs.org/@types/node/-/node-17.0.32.tgz", - "integrity": "sha512-eAIcfAvhf/BkHcf4pkLJ7ECpBAhh9kcxRBpip9cTiO+hf+aJrsxYxBeS6OXvOd9WqNAJmavXVpZvY1rBjNsXmw==" + "version": "17.0.34", + "resolved": "https://registry.npmjs.org/@types/node/-/node-17.0.34.tgz", + "integrity": "sha512-XImEz7XwTvDBtzlTnm8YvMqGW/ErMWBsKZ+hMTvnDIjGCKxwK5Xpc+c/oQjOauwq8M4OS11hEkpjX8rrI/eEgA==" }, "@types/node-fetch": { "version": "2.6.1", diff --git a/package.json b/package.json index 7bd5ebe34..85f47a796 100644 --- a/package.json +++ b/package.json @@ -79,7 +79,7 @@ "@typechain/hardhat": "^2.3.0", "@types/chai": "^4.3.1", "@types/mocha": "^9.1.1", - "@types/node": "^17.0.32", + "@types/node": "^17.0.34", "@typescript-eslint/eslint-plugin": "^4.31.2", "@typescript-eslint/parser": "^4.31.2", "chai-bn": "^0.3.1", From 02eef7cafd7e876e1faf8accecdc54c75cb3f3dd Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 17 May 2022 07:23:17 +0000 Subject: [PATCH 074/274] build(deps): bump @gnosis.pm/safe-deployments from 1.12.0 to 1.14.0 Bumps [@gnosis.pm/safe-deployments](https://github.com/gnosis/safe-deployments) from 1.12.0 to 1.14.0. - [Release notes](https://github.com/gnosis/safe-deployments/releases) - [Commits](https://github.com/gnosis/safe-deployments/compare/v1.12.0...v1.14.0) --- updated-dependencies: - dependency-name: "@gnosis.pm/safe-deployments" dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- package-lock.json | 14 +++++++------- package.json | 2 +- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/package-lock.json b/package-lock.json index 03091eac0..b9efe1641 100644 --- a/package-lock.json +++ b/package-lock.json @@ -12,7 +12,7 @@ "@balancer-labs/v2-pool-weighted": "^2.0.1", "@chainlink/contracts": "^0.1.7", "@gnosis.pm/safe-core-sdk": "^2.1.0", - "@gnosis.pm/safe-deployments": "^1.12.0", + "@gnosis.pm/safe-deployments": "^1.14.0", "@gnosis.pm/safe-ethers-lib": "^1.1.0", "@nomiclabs/hardhat-waffle": "^2.0.3", "@openzeppelin/contracts": "4.6.0", @@ -1599,9 +1599,9 @@ } }, "node_modules/@gnosis.pm/safe-deployments": { - "version": "1.12.0", - "resolved": "https://registry.npmjs.org/@gnosis.pm/safe-deployments/-/safe-deployments-1.12.0.tgz", - "integrity": "sha512-fNwQqTdBushxlkqp8WpgXVP9HTePa/VFWM9VYPzbSsdqYqSUnXYDDOMyHH3H6eNltwRV8RVp/cxqUZLrvQ3YPg==" + "version": "1.14.0", + "resolved": "https://registry.npmjs.org/@gnosis.pm/safe-deployments/-/safe-deployments-1.14.0.tgz", + "integrity": "sha512-KbuKppBkEAVmnvI9R6212Ne9paBzoDPGb2yye7BSFuhiVTMRSJftZAZXQoENqj+jA5r53d/t0DVjiPx0RE8/IQ==" }, "node_modules/@gnosis.pm/safe-ethers-lib": { "version": "1.1.0", @@ -29844,9 +29844,9 @@ } }, "@gnosis.pm/safe-deployments": { - "version": "1.12.0", - "resolved": "https://registry.npmjs.org/@gnosis.pm/safe-deployments/-/safe-deployments-1.12.0.tgz", - "integrity": "sha512-fNwQqTdBushxlkqp8WpgXVP9HTePa/VFWM9VYPzbSsdqYqSUnXYDDOMyHH3H6eNltwRV8RVp/cxqUZLrvQ3YPg==" + "version": "1.14.0", + "resolved": "https://registry.npmjs.org/@gnosis.pm/safe-deployments/-/safe-deployments-1.14.0.tgz", + "integrity": "sha512-KbuKppBkEAVmnvI9R6212Ne9paBzoDPGb2yye7BSFuhiVTMRSJftZAZXQoENqj+jA5r53d/t0DVjiPx0RE8/IQ==" }, "@gnosis.pm/safe-ethers-lib": { "version": "1.1.0", diff --git a/package.json b/package.json index 7bd5ebe34..bc367fd63 100644 --- a/package.json +++ b/package.json @@ -52,7 +52,7 @@ "@balancer-labs/v2-pool-weighted": "^2.0.1", "@chainlink/contracts": "^0.1.7", "@gnosis.pm/safe-core-sdk": "^2.1.0", - "@gnosis.pm/safe-deployments": "^1.12.0", + "@gnosis.pm/safe-deployments": "^1.14.0", "@gnosis.pm/safe-ethers-lib": "^1.1.0", "@nomiclabs/hardhat-waffle": "^2.0.3", "@openzeppelin/contracts": "4.6.0", From d6615ce5f314d5ace0a19d4c415f40d8c52c3f9f Mon Sep 17 00:00:00 2001 From: Erwan Beauvois Date: Tue, 17 May 2022 13:13:39 +0200 Subject: [PATCH 075/274] add setter for balancerMinter & use params --- contracts/metagov/BalancerGaugeStaker.sol | 44 ++++++++++++++++----- proposals/dao/balancer_gauge_fix.ts | 12 ++++-- proposals/description/balancer_gauge_fix.ts | 14 +++++-- protocol-configuration/mainnetAddresses.ts | 5 +++ 4 files changed, 59 insertions(+), 16 deletions(-) diff --git a/contracts/metagov/BalancerGaugeStaker.sol b/contracts/metagov/BalancerGaugeStaker.sol index fe49fd6e1..57ca9ff94 100644 --- a/contracts/metagov/BalancerGaugeStaker.sol +++ b/contracts/metagov/BalancerGaugeStaker.sol @@ -11,18 +11,41 @@ import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; contract BalancerGaugeStaker is PCVDeposit, LiquidityGaugeManager { using SafeERC20 for IERC20; - address public constant BALANCER_GAUGE_CONTROLLER = 0xC128468b7Ce63eA702C1f104D55A2566b13D3ABD; - address public constant BALANCER_MINTER = 0x239e55F427D44C3cc793f49bFB507ebe76638a2b; - address public constant BAL = 0xba100000625a3754423978a60c9317c58a424e3D; + event BalancerMinterChanged(address indexed oldMinter, address indexed newMinter); + + address private constant BAL = 0xba100000625a3754423978a60c9317c58a424e3D; + + address public balancerMinter; /// @notice Balancer gauge staker /// @param _core Fei Core for reference - constructor(address _core) CoreRef(_core) LiquidityGaugeManager(BALANCER_GAUGE_CONTROLLER) {} + constructor( + address _core, + address _gaugeController, + address _balancerMinter + ) CoreRef(_core) LiquidityGaugeManager(_gaugeController) { + balancerMinter = _balancerMinter; + } - function initialize(address _core) external { + function initialize( + address _core, + address _gaugeController, + address _balancerMinter + ) external { require(gaugeController == address(0), "BalancerGaugeStaker: initialized"); CoreRef._initialize(_core); - gaugeController = BALANCER_GAUGE_CONTROLLER; + gaugeController = _gaugeController; + balancerMinter = _balancerMinter; + } + + /// @notice Set the balancer minter used to mint BAL + /// @param newMinter the new minter address + function setBalancerMinter(address newMinter) public onlyTribeRole(TribeRoles.METAGOVERNANCE_GAUGE_ADMIN) { + address currentMinter = balancerMinter; // cache to save 1 sload + require(currentMinter != newMinter, "BalancerGaugeStaker: same minter"); + + emit BalancerMinterChanged(currentMinter, newMinter); + balancerMinter = newMinter; } /// @notice returns total balance of PCV in the Deposit @@ -76,15 +99,16 @@ contract BalancerGaugeStaker is PCVDeposit, LiquidityGaugeManager { /// @notice Mint everything which belongs to this contract in the given gauge /// @param token whose gauge should be claimed - function mint(address token) external whenNotPaused returns (uint256) { + function mintGaugeRewards(address token) external whenNotPaused returns (uint256) { // fetch gauge address from internal mapping to avoid this permissionless // call to mint on any arbitrary gauge. address gaugeAddress = tokenToGauge[token]; require(gaugeAddress != address(0), "BalancerGaugeStaker: token has no gauge configured"); - // emit the same event as Gauge rewards claiming for offline indexing - uint256 minted = IBalancerMinter(BALANCER_MINTER).mint(gaugeAddress); - emit GaugeRewardsClaimed(gaugeAddress, BAL, minted); + // emit the Deposit event because accounting is performed in BAL + // and that is what is claimed from the minter. + uint256 minted = IBalancerMinter(balancerMinter).mint(gaugeAddress); + emit Deposit(msg.sender, minted); return minted; } diff --git a/proposals/dao/balancer_gauge_fix.ts b/proposals/dao/balancer_gauge_fix.ts index b8e3bbf56..669e30350 100644 --- a/proposals/dao/balancer_gauge_fix.ts +++ b/proposals/dao/balancer_gauge_fix.ts @@ -20,7 +20,9 @@ const deploy: DeployUpgradeFunc = async (deployAddress: string, addresses: Named // Deploy balancer gauge staker implementation const balancerGaugeStakerFactory = await ethers.getContractFactory('BalancerGaugeStaker'); const balancerGaugeStakerImplementation = await balancerGaugeStakerFactory.deploy( - addresses.core // address _core + addresses.core, // address _core + addresses.balancerGaugeController, // address _gaugeController + addresses.balancerMinter // address _balancerMinter ); await balancerGaugeStakerImplementation.deployTransaction.wait(); logging && console.log('balancerGaugeStakerImplementation: ', balancerGaugeStakerImplementation.address); @@ -37,7 +39,11 @@ const deploy: DeployUpgradeFunc = async (deployAddress: string, addresses: Named logging && console.log('balancerGaugeStaker: ', balancerGaugeStaker.address); // initialize proxy state - await balancerGaugeStaker.initialize(addresses.core); + await balancerGaugeStaker.initialize( + addresses.core, // address _core + addresses.balancerGaugeController, // address _gaugeController + addresses.balancerMinter // address _balancerMinter + ); // Deploy lens to report the B-30FEI-70WETH staked in gauge const gaugeLensFactory = await ethers.getContractFactory('CurveGaugeLens'); @@ -119,7 +125,7 @@ const validate: ValidateUpgradeFunc = async (addresses, oldContracts, contracts, console.log('claim rewards...'); await time.increase('86400'); console.log('BAL balance before claim', (await contracts.bal.balanceOf(addresses.balancerGaugeStaker)) / 1e18); - await contracts.balancerGaugeStaker.mint(addresses.balancerFeiWethPool); + await contracts.balancerGaugeStaker.mintGaugeRewards(addresses.balancerFeiWethPool); console.log('BAL balance after claim ', (await contracts.bal.balanceOf(addresses.balancerGaugeStaker)) / 1e18); console.log('balancerGaugeStaker.balance() ', (await contracts.balancerGaugeStaker.balance()) / 1e18); diff --git a/proposals/description/balancer_gauge_fix.ts b/proposals/description/balancer_gauge_fix.ts index a5a8cd473..0d03ac299 100644 --- a/proposals/description/balancer_gauge_fix.ts +++ b/proposals/description/balancer_gauge_fix.ts @@ -10,6 +10,7 @@ import { ProposalDescription } from '@custom-types/types'; // to the balancerDepositFeiWeth, where part of them will // possibly be redeemed to reduce the amount of liquidity. const bpt30Fei70WethBalance = '1000000000000000000000'; +//const bpt30Fei70WethBalance = '252865858892972812879565'; const fip_x: ProposalDescription = { title: 'Balancer Gauge Staker', @@ -49,7 +50,7 @@ const fip_x: ProposalDescription = { '{balancerDepositFeiWeth}', // address pcvDeposit '{balancerGaugeStaker}', // address safeAddress '{bpt30Fei70Weth}', // address token - '1000000000000000000000', // uint256 amount + bpt30Fei70WethBalance, // uint256 amount false, // bool pauseAfter false // bool depositAfter ], @@ -61,7 +62,7 @@ const fip_x: ProposalDescription = { method: 'stakeInGauge(address,uint256)', arguments: [ '{bpt30Fei70Weth}', // token - '1000000000000000000000' // amount + bpt30Fei70WethBalance // amount ], description: 'Stake all B-30FEI-70WETH in gauge' }, @@ -71,7 +72,14 @@ const fip_x: ProposalDescription = { method: 'swapDeposit(address,address)', arguments: ['{balancerLensBpt30Fei70WethOld}', '{balancerLensBpt30Fei70Weth}'], description: 'Add new FEI/WETH Lens to CR oracle & swap out the old one' - } + } /*, + { + target: 'collateralizationOracle', + values: '0', + method: 'addDeposit(address)', + arguments: ['{balancerGaugeStaker}'], + description: 'Count farmed BAL in the CR Oracle' + }*/ ], description: 'Migrate liquidity to a new Balancer Gauge Staker which is able to claim BAL rewards.' }; diff --git a/protocol-configuration/mainnetAddresses.ts b/protocol-configuration/mainnetAddresses.ts index eae3e7f57..da17438f8 100644 --- a/protocol-configuration/mainnetAddresses.ts +++ b/protocol-configuration/mainnetAddresses.ts @@ -376,6 +376,11 @@ const MainnetAddresses: MainnetAddresses = { address: '0x90291319F1D4eA3ad4dB0Dd8fe9E12BAF749E845', category: AddressCategory.External }, + balancerMinter: { + artifactName: 'IBalancerMinter', + address: '0x239e55F427D44C3cc793f49bFB507ebe76638a2b', + category: AddressCategory.External + }, balancerGaugeController: { artifactName: 'ILiquidityGaugeController', address: '0xC128468b7Ce63eA702C1f104D55A2566b13D3ABD', From f12cc96ba98d8eb61075e3db6c6d60df5e5a018b Mon Sep 17 00:00:00 2001 From: Erwan Beauvois Date: Tue, 17 May 2022 14:26:08 +0200 Subject: [PATCH 076/274] implement checks in validation step --- block.txt | 2 +- proposals/dao/balancer_gauge_fix.ts | 52 ++++++--------------- proposals/description/balancer_gauge_fix.ts | 10 ++-- 3 files changed, 20 insertions(+), 44 deletions(-) diff --git a/block.txt b/block.txt index 6a23bbc64..d5f20e48f 100644 --- a/block.txt +++ b/block.txt @@ -1 +1 @@ -14788265 +14792230 diff --git a/proposals/dao/balancer_gauge_fix.ts b/proposals/dao/balancer_gauge_fix.ts index 669e30350..0bc17920e 100644 --- a/proposals/dao/balancer_gauge_fix.ts +++ b/proposals/dao/balancer_gauge_fix.ts @@ -91,15 +91,6 @@ const setup: SetupUpgradeFunc = async (addresses, oldContracts, contracts, loggi const ethPrice = (await contracts.chainlinkEthUsdOracleWrapper.read())[0].toString() / 1e10; await overwriteChainlinkAggregator(addresses.chainlinkEthUsdOracle, Math.round(ethPrice), '8'); - // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - // assume non-zero B-70WETH-30FEI were unstaked & moved to the PCVDeposit - // before this proposal's execution. - // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - const lpTokenHolder = '0x4f9463405f5bc7b4c1304222c1df76efbd81a407'; - const lpTokenSigner = await getImpersonatedSigner(lpTokenHolder); - await forceEth(lpTokenHolder); - await contracts.balancerFeiWethPool.connect(lpTokenSigner).transfer(addresses.balancerDepositFeiWeth, `1000${e18}`); - // read pcvStats before proposal execution pcvStatsBefore = await contracts.collateralizationOracle.pcvStats(); }; @@ -114,57 +105,44 @@ const teardown: TeardownUpgradeFunc = async (addresses, oldContracts, contracts, // IE check balances, check state of contracts, etc. const validate: ValidateUpgradeFunc = async (addresses, oldContracts, contracts, logging) => { // check the new staking contract has staked in gauge - console.log('---------------------------------------------------------------'); - console.log( - 'BPTs staked in the gauge by the new contract', - (await contracts.balancerGaugeBpt30Fei70Weth.balanceOf(addresses.balancerGaugeStaker)) / 1e18 + expect(await contracts.balancerGaugeBpt30Fei70Weth.balanceOf(addresses.balancerGaugeStaker)).to.be.equal( + '252865858892972812879565' ); // check rewards can be claimed - console.log('---------------------------------------------------------------'); - console.log('claim rewards...'); await time.increase('86400'); - console.log('BAL balance before claim', (await contracts.bal.balanceOf(addresses.balancerGaugeStaker)) / 1e18); + const balBalanceBefore = await contracts.bal.balanceOf(addresses.balancerGaugeStaker); await contracts.balancerGaugeStaker.mintGaugeRewards(addresses.balancerFeiWethPool); - console.log('BAL balance after claim ', (await contracts.bal.balanceOf(addresses.balancerGaugeStaker)) / 1e18); - console.log('balancerGaugeStaker.balance() ', (await contracts.balancerGaugeStaker.balance()) / 1e18); + const balBalanceAfter = await contracts.bal.balanceOf(addresses.balancerGaugeStaker); + expect(balBalanceAfter.sub(balBalanceBefore)).to.be.at.least(`1${e18}`); // check collateralization oracle reports the LP tokens staked - console.log('---------------------------------------------------------------'); - console.log('checking presence in CR oracle'); expect(await contracts.collateralizationOracle.depositToToken(addresses.balancerLensBpt30Fei70Weth)).to.be.equal( addresses.weth ); expect(await contracts.collateralizationOracle.depositToToken(addresses.balancerLensBpt30Fei70WethOld)).to.be.equal( ethers.constants.AddressZero ); - console.log('checking resistant balance and fei'); const resistantBalanceAndFei = await contracts.balancerLensBpt30Fei70Weth.resistantBalanceAndFei(); - console.log('resistantBalanceAndFei[0]', resistantBalanceAndFei[0] / 1e18); - console.log('resistantBalanceAndFei[1]', resistantBalanceAndFei[1] / 1e18); + expect(resistantBalanceAndFei[0]).to.be.at.least(`14000${e18}`); + expect(resistantBalanceAndFei[0]).to.be.at.most(`18000${e18}`); + expect(resistantBalanceAndFei[1]).to.be.at.least(`13000000${e18}`); + expect(resistantBalanceAndFei[1]).to.be.at.most(`19000000${e18}`); // check withdraw() can move BAL - console.log('---------------------------------------------------------------'); - console.log('withdraw(feiDAOTimelock, 1e18)'); - const withdrawAmount = '1000000000000000000'; + const withdrawAmount = `1${e18}`; const sourceBalanceBefore = await contracts.bal.balanceOf(addresses.balancerGaugeStaker); const targetBalanceBefore = await contracts.bal.balanceOf(addresses.feiDAOTimelock); - console.log('BAL balance before withdraw [source]', sourceBalanceBefore / 1e18); - console.log('BAL balance before withdraw [target]', targetBalanceBefore / 1e18); await contracts.balancerGaugeStaker.withdraw(addresses.feiDAOTimelock, withdrawAmount); const sourceBalanceAfter = await contracts.bal.balanceOf(addresses.balancerGaugeStaker); const targetBalanceAfter = await contracts.bal.balanceOf(addresses.feiDAOTimelock); - console.log('BAL balance after withdraw [source]', sourceBalanceAfter / 1e18); - console.log('BAL balance after withdraw [target]', targetBalanceAfter / 1e18); + expect(sourceBalanceBefore.sub(sourceBalanceAfter)).to.be.equal(withdrawAmount); + expect(targetBalanceAfter.sub(targetBalanceBefore)).to.be.equal(withdrawAmount); // check withdrawERC20() can unstake gauge & move LP tokens - console.log('---------------------------------------------------------------'); - console.log('withdrawERC20(bpt30Fei70Weth, feiDAOTimelock, 1e18)'); - const lpWithdrawAmount = '1000000000000000000'; + const lpWithdrawAmount = `1${e18}`; const sourceLpBalanceBefore = await contracts.balancerGaugeBpt30Fei70Weth.balanceOf(addresses.balancerGaugeStaker); const targetLpBalanceBefore = await contracts.bpt30Fei70Weth.balanceOf(addresses.feiDAOTimelock); - console.log('LP balance before withdraw [source]', sourceLpBalanceBefore / 1e18); - console.log('LP balance before withdraw [target]', targetLpBalanceBefore / 1e18); await contracts.balancerGaugeStaker.withdrawERC20( addresses.bpt30Fei70Weth, addresses.feiDAOTimelock, @@ -172,8 +150,8 @@ const validate: ValidateUpgradeFunc = async (addresses, oldContracts, contracts, ); const sourceLpBalanceAfter = await contracts.balancerGaugeBpt30Fei70Weth.balanceOf(addresses.balancerGaugeStaker); const targetLpBalanceAfter = await contracts.bpt30Fei70Weth.balanceOf(addresses.feiDAOTimelock); - console.log('LP balance after withdraw [source]', sourceLpBalanceAfter / 1e18); - console.log('LP balance after withdraw [target]', targetLpBalanceAfter / 1e18); + expect(sourceLpBalanceBefore.sub(sourceLpBalanceAfter)).to.be.equal(lpWithdrawAmount); + expect(targetLpBalanceAfter.sub(targetLpBalanceBefore)).to.be.equal(lpWithdrawAmount); // display pcvStats console.log('----------------------------------------------------'); diff --git a/proposals/description/balancer_gauge_fix.ts b/proposals/description/balancer_gauge_fix.ts index 0d03ac299..406c7b514 100644 --- a/proposals/description/balancer_gauge_fix.ts +++ b/proposals/description/balancer_gauge_fix.ts @@ -9,8 +9,6 @@ import { ProposalDescription } from '@custom-types/types'; // the OA Timelock, and the Guardian will move these BPTs // to the balancerDepositFeiWeth, where part of them will // possibly be redeemed to reduce the amount of liquidity. -const bpt30Fei70WethBalance = '1000000000000000000000'; -//const bpt30Fei70WethBalance = '252865858892972812879565'; const fip_x: ProposalDescription = { title: 'Balancer Gauge Staker', @@ -50,7 +48,7 @@ const fip_x: ProposalDescription = { '{balancerDepositFeiWeth}', // address pcvDeposit '{balancerGaugeStaker}', // address safeAddress '{bpt30Fei70Weth}', // address token - bpt30Fei70WethBalance, // uint256 amount + '252865858892972812879565', // uint256 amount false, // bool pauseAfter false // bool depositAfter ], @@ -62,7 +60,7 @@ const fip_x: ProposalDescription = { method: 'stakeInGauge(address,uint256)', arguments: [ '{bpt30Fei70Weth}', // token - bpt30Fei70WethBalance // amount + '252865858892972812879565' // amount ], description: 'Stake all B-30FEI-70WETH in gauge' }, @@ -72,14 +70,14 @@ const fip_x: ProposalDescription = { method: 'swapDeposit(address,address)', arguments: ['{balancerLensBpt30Fei70WethOld}', '{balancerLensBpt30Fei70Weth}'], description: 'Add new FEI/WETH Lens to CR oracle & swap out the old one' - } /*, + }, { target: 'collateralizationOracle', values: '0', method: 'addDeposit(address)', arguments: ['{balancerGaugeStaker}'], description: 'Count farmed BAL in the CR Oracle' - }*/ + } ], description: 'Migrate liquidity to a new Balancer Gauge Staker which is able to claim BAL rewards.' }; From 14dcf27c0703d68c102a9baa68600bffbc8ba4e1 Mon Sep 17 00:00:00 2001 From: Erwan Beauvois Date: Tue, 17 May 2022 14:39:09 +0200 Subject: [PATCH 077/274] fix collateralizationOracle & permissions protocol conf --- protocol-configuration/collateralizationOracle.ts | 2 +- protocol-configuration/permissions.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/protocol-configuration/collateralizationOracle.ts b/protocol-configuration/collateralizationOracle.ts index d41caebaf..61ebc4241 100644 --- a/protocol-configuration/collateralizationOracle.ts +++ b/protocol-configuration/collateralizationOracle.ts @@ -15,7 +15,7 @@ const collateralizationAddresses = { lusd: ['rariPool7LusdPCVDeposit', 'bammDeposit', 'lusdPSM'], dai: ['compoundDaiPCVDepositWrapper', 'daiFixedPricePSM', 'dpiToDaiLensDai'], usd: ['namedStaticPCVDepositWrapper', 'd3poolCurvePCVDeposit', 'd3poolConvexPCVDeposit'], - bal: ['balancerDepositBalWeth', 'balancerLensVeBalBal'], + bal: ['balancerDepositBalWeth', 'balancerLensVeBalBal', 'balancerGaugeStaker'], cream: ['creamDepositWrapper'], weth: [ 'ethLidoPCVDepositWrapper', diff --git a/protocol-configuration/permissions.ts b/protocol-configuration/permissions.ts index 33293e5bc..d5f940bbf 100644 --- a/protocol-configuration/permissions.ts +++ b/protocol-configuration/permissions.ts @@ -44,7 +44,7 @@ export const permissions = { PCV_SAFE_MOVER_ROLE: ['tribalCouncilTimelock'], METAGOVERNANCE_VOTE_ADMIN: ['feiDAOTimelock', 'opsOptimisticTimelock', 'tribalCouncilTimelock'], METAGOVERNANCE_TOKEN_STAKING: ['feiDAOTimelock', 'opsOptimisticTimelock'], - METAGOVERNANCE_GAUGE_ADMIN: ['feiDAOTimelock', 'optimisticTimelock'], + METAGOVERNANCE_GAUGE_ADMIN: ['feiDAOTimelock', 'optimisticTimelock', 'tribalCouncilTimelock'], ROLE_ADMIN: ['feiDAOTimelock', 'tribalCouncilTimelock'], POD_METADATA_REGISTER_ROLE: ['tribalCouncilSafe'], FEI_MINT_ADMIN: ['feiDAOTimelock', 'tribalCouncilTimelock'], From 9fdde5649c1beeae1c170627bb40984022ca2021 Mon Sep 17 00:00:00 2001 From: Erwan Beauvois Date: Tue, 17 May 2022 15:37:07 +0200 Subject: [PATCH 078/274] Add e2e tests for BalancerGaugeStaker --- contracts/metagov/BalancerGaugeStaker.sol | 10 +- .../tests/metagov/BalancerGaugeStaker.ts | 181 ++++++++++++++++++ 2 files changed, 189 insertions(+), 2 deletions(-) create mode 100644 test/integration/tests/metagov/BalancerGaugeStaker.ts diff --git a/contracts/metagov/BalancerGaugeStaker.sol b/contracts/metagov/BalancerGaugeStaker.sol index 57ca9ff94..da9f0bb82 100644 --- a/contracts/metagov/BalancerGaugeStaker.sol +++ b/contracts/metagov/BalancerGaugeStaker.sol @@ -68,7 +68,7 @@ contract BalancerGaugeStaker is PCVDeposit, LiquidityGaugeManager { /// @notice withdraw BAL held to another address /// the BAL rewards accrue on this PCVDeposit when Gauge rewards are claimed. - function withdraw(address to, uint256 amount) external override onlyPCVController whenNotPaused { + function withdraw(address to, uint256 amount) public override onlyPCVController whenNotPaused { IERC20(BAL).safeTransfer(to, amount); emit Withdrawal(msg.sender, to, amount); } @@ -94,7 +94,13 @@ contract BalancerGaugeStaker is PCVDeposit, LiquidityGaugeManager { ILiquidityGauge(gaugeAddress).withdraw(amount, false); } - _withdrawERC20(token, to, amount); + // emit the right event if the withdrawn token + // is the one used in accounting. + if (token == BAL) { + withdraw(to, amount); + } else { + _withdrawERC20(token, to, amount); + } } /// @notice Mint everything which belongs to this contract in the given gauge diff --git a/test/integration/tests/metagov/BalancerGaugeStaker.ts b/test/integration/tests/metagov/BalancerGaugeStaker.ts new file mode 100644 index 000000000..df21ffaa9 --- /dev/null +++ b/test/integration/tests/metagov/BalancerGaugeStaker.ts @@ -0,0 +1,181 @@ +import chai, { expect } from 'chai'; +import CBN from 'chai-bn'; +import { solidity } from 'ethereum-waffle'; +import { ethers } from 'hardhat'; +import { NamedContracts } from '@custom-types/types'; +import proposals from '@test/integration/proposals_config'; +import { TestEndtoEndCoordinator } from '@test/integration/setup'; +import { getImpersonatedSigner, expectRevert, expectEvent } from '@test/helpers'; +import { forceEth } from '@test/integration/setup/utils'; +import { BalancerGaugeStaker } from '@custom-types/contracts'; + +const e18 = '000000000000000000'; + +describe('e2e-metagov', function () { + let deployAddress: string; + let contracts: NamedContracts; + let e2eCoord: TestEndtoEndCoordinator; + const logging = Boolean(process.env.LOGGING); + + before(async () => { + chai.use(CBN(ethers.BigNumber)); + chai.use(solidity); + }); + + before(async function () { + deployAddress = (await ethers.getSigners())[0].address; + const config = { + logging, + deployAddress, + version: 1 + }; + e2eCoord = new TestEndtoEndCoordinator(config, proposals); + ({ contracts } = await e2eCoord.loadEnvironment()); + }); + + describe('BalancerGaugeStaker.sol', function () { + let staker: BalancerGaugeStaker; + let daoSigner: any; + let randomSigner: any; + + before(async function () { + // Create the contract + const factory = await ethers.getContractFactory('BalancerGaugeStaker'); + staker = await factory.deploy( + contracts.core.address, + contracts.balancerGaugeController.address, + contracts.balancerMinter.address + ); + await staker.deployTransaction.wait(); + + // get signer for a random address + randomSigner = await getImpersonatedSigner('0x6ef71cA9cD708883E129559F5edBFb9d9D5C6148'); + await forceEth(randomSigner.address); + + // seed the staker with some LP tokens + const lpTokenHolder = '0x4f9463405f5bc7b4c1304222c1df76efbd81a407'; + const lpTokenSigner = await getImpersonatedSigner(lpTokenHolder); + await forceEth(lpTokenHolder); + await contracts.balancerFeiWethPool.connect(lpTokenSigner).transfer(staker.address, `1000${e18}`); + + // also airdrop some BAL so that balance is not zero + const balTokenHolder = '0xBA12222222228d8Ba445958a75a0704d566BF2C8'; + const balTokenSigner = await getImpersonatedSigner(balTokenHolder); + await forceEth(balTokenHolder); + await contracts.bal.connect(balTokenSigner).transfer(staker.address, '10000'); + + // grant role to dao and initialize dao signer + await forceEth(contracts.feiDAOTimelock.address); + daoSigner = await getImpersonatedSigner(contracts.feiDAOTimelock.address); + await contracts.core + .connect(daoSigner) + .grantRole(ethers.utils.id('METAGOVERNANCE_GAUGE_ADMIN'), daoSigner.address); + }); + + it('init', async function () { + expect(await staker.balanceReportedIn()).to.be.equal(contracts.bal.address); + expect(await staker.balance()).to.be.equal('10000'); + expect((await staker.resistantBalanceAndFei())[0]).to.be.equal('10000'); + expect((await staker.resistantBalanceAndFei())[1]).to.be.equal('0'); + }); + + describe('setBalancerMinter()', function () { + it('should revert if user has no role', async function () { + await expectRevert(staker.setBalancerMinter(contracts.balancerMinter.address), 'UNAUTHORIZED'); + }); + + it('should work if user has METAGOVERNANCE_GAUGE_ADMIN role', async function () { + expect(await staker.balancerMinter()).to.be.equal(contracts.balancerMinter.address); + await staker.connect(daoSigner).setBalancerMinter(deployAddress); + expect(await staker.balancerMinter()).to.be.equal(deployAddress); + await staker.connect(daoSigner).setBalancerMinter(contracts.balancerMinter.address); + expect(await staker.balancerMinter()).to.be.equal(contracts.balancerMinter.address); + }); + }); + + describe('withdraw()', function () { + it('should revert if user has no role', async function () { + await expectRevert( + staker.connect(randomSigner).withdraw(daoSigner.address, '10'), + 'CoreRef: Caller is not a PCV controller' + ); + }); + + it('should revert if contract is paused', async function () { + await staker.connect(daoSigner).pause(); + await expectRevert(staker.withdraw(daoSigner.address, '10'), 'Pausable: paused'); + await staker.connect(daoSigner).unpause(); + }); + + it('should work if user has PCV_CONTROLLER_ROLE role', async function () { + const balanceBefore = await contracts.bal.balanceOf(daoSigner.address); + await staker.connect(daoSigner).withdraw(daoSigner.address, '10'); + const balanceAfter = await contracts.bal.balanceOf(daoSigner.address); + expect(balanceAfter.sub(balanceBefore)).to.be.equal('10'); + expect(await staker.balance()).to.be.equal('9990'); + }); + }); + + describe('mintGaugeRewards()', function () { + it('should revert for gauges that are not configured', async function () { + await expectRevert( + staker.mintGaugeRewards(contracts.bal.address), + 'BalancerGaugeStaker: token has no gauge configured' + ); + }); + + it('should be able to mint BAL', async function () { + // set gauge and stake a bunch of tokens + await staker + .connect(daoSigner) + .setTokenToGauge(contracts.bpt30Fei70Weth.address, contracts.balancerGaugeBpt30Fei70Weth.address); + await staker.connect(daoSigner).stakeAllInGauge(contracts.bpt30Fei70Weth.address); + + staker.mintGaugeRewards(contracts.bpt30Fei70Weth.address); + expect(await staker.balance()).to.be.at.least('9991'); + expect((await staker.resistantBalanceAndFei())[0]).to.be.at.least('9991'); + expect((await staker.resistantBalanceAndFei())[1]).to.be.equal('0'); + }); + }); + + describe('withdrawERC20()', function () { + it('should revert if user has no role', async function () { + await expectRevert( + staker.connect(randomSigner).withdraw(daoSigner.address, '10'), + 'CoreRef: Caller is not a PCV controller' + ); + }); + + it('should revert if contract is paused', async function () { + await staker.connect(daoSigner).pause(); + await expectRevert(staker.withdraw(daoSigner.address, '10'), 'Pausable: paused'); + await staker.connect(daoSigner).unpause(); + }); + + describe('should work if user has PCV_CONTROLLER_ROLE role', function () { + it('should emit Withdrawal if token is BAL', async function () { + const balanceBefore = await contracts.bal.balanceOf(daoSigner.address); + expectEvent( + await staker.connect(daoSigner).withdrawERC20(contracts.bal.address, daoSigner.address, '10'), + staker, + 'Withdrawal', + [daoSigner.address, daoSigner.address, '10'] + ); + const balanceAfter = await contracts.bal.balanceOf(daoSigner.address); + expect(balanceAfter.sub(balanceBefore)).to.be.equal('10'); + }); + it('should unstake from gauge and emit WithdrawERC20 otherwise', async function () { + const balanceBefore = await contracts.bpt30Fei70Weth.balanceOf(daoSigner.address); + expectEvent( + await staker.connect(daoSigner).withdrawERC20(contracts.bpt30Fei70Weth.address, daoSigner.address, '10'), + staker, + 'WithdrawERC20', + [daoSigner.address, contracts.bpt30Fei70Weth.address, daoSigner.address, '10'] + ); + const balanceAfter = await contracts.bpt30Fei70Weth.balanceOf(daoSigner.address); + expect(balanceAfter.sub(balanceBefore)).to.be.equal('10'); + }); + }); + }); + }); +}); From 68cc3a56eecc1944abd80d9b69d7af1d94ac16ba Mon Sep 17 00:00:00 2001 From: Erwan Beauvois Date: Tue, 17 May 2022 15:47:02 +0200 Subject: [PATCH 079/274] remove todo comments --- proposals/description/balancer_gauge_fix.ts | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/proposals/description/balancer_gauge_fix.ts b/proposals/description/balancer_gauge_fix.ts index 406c7b514..fa1ec7ece 100644 --- a/proposals/description/balancer_gauge_fix.ts +++ b/proposals/description/balancer_gauge_fix.ts @@ -1,15 +1,5 @@ import { ProposalDescription } from '@custom-types/types'; -// TODO: -// put here the amout of B-70WETH-30FEI BPTs to move that -// are on the balancerDepositFeiWeth and that should be -// staked in the gauge. -// As of 13/05, the BPTs are still staked in the gauge, but -// there is a transaction for unstaking that is pending in -// the OA Timelock, and the Guardian will move these BPTs -// to the balancerDepositFeiWeth, where part of them will -// possibly be redeemed to reduce the amount of liquidity. - const fip_x: ProposalDescription = { title: 'Balancer Gauge Staker', commands: [ From 79b03d2b001a2226aa1c6662b8002474620350bb Mon Sep 17 00:00:00 2001 From: thomas-waite Date: Tue, 17 May 2022 15:18:15 +0100 Subject: [PATCH 080/274] fix: invert the oracle price in correct order --- contracts/refs/OracleRef.sol | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/contracts/refs/OracleRef.sol b/contracts/refs/OracleRef.sol index 63a9757fc..64e037030 100644 --- a/contracts/refs/OracleRef.sol +++ b/contracts/refs/OracleRef.sol @@ -92,6 +92,11 @@ abstract contract OracleRef is IOracleRef, CoreRef { } require(valid, "OracleRef: oracle invalid"); + // Invert the oracle price if necessary + if (doInvert) { + _peg = invert(_peg); + } + // Scale the oracle price by token decimals delta if necessary uint256 scalingFactor; if (decimalsNormalizer < 0) { @@ -102,10 +107,6 @@ abstract contract OracleRef is IOracleRef, CoreRef { _peg = _peg.mul(scalingFactor); } - // Invert the oracle price if necessary - if (doInvert) { - _peg = invert(_peg); - } return _peg; } From a6576ba72ceb6842fbf08900461ea505e4f426b4 Mon Sep 17 00:00:00 2001 From: Caleb Date: Tue, 17 May 2022 13:18:05 -0700 Subject: [PATCH 081/274] fuse-fixer --- contracts/external/fuse/CToken.sol | 2 + contracts/utils/FuseFixer.sol | 122 +++++++++++++++++++++++++++++ 2 files changed, 124 insertions(+) create mode 100644 contracts/utils/FuseFixer.sol diff --git a/contracts/external/fuse/CToken.sol b/contracts/external/fuse/CToken.sol index 91ea49d7f..bcc29866e 100644 --- a/contracts/external/fuse/CToken.sol +++ b/contracts/external/fuse/CToken.sol @@ -15,4 +15,6 @@ abstract contract CTokenFuse { function underlying() external view virtual returns (address); function borrowBalanceCurrent(address debtor) external virtual returns (uint256); + + function repayBorrowBehalf(address borrower, uint256 repayAmount) external payable virtual returns (uint256); } diff --git a/contracts/utils/FuseFixer.sol b/contracts/utils/FuseFixer.sol new file mode 100644 index 000000000..55e52b1eb --- /dev/null +++ b/contracts/utils/FuseFixer.sol @@ -0,0 +1,122 @@ +// SPDX-License-Identifier: GPL-3.0-or-later +pragma solidity ^0.8.0; + +import {PCVDeposit} from "../pcv/PCVDeposit.sol"; +import {CTokenFuse} from "../external/fuse/CToken.sol"; +import {CoreRef} from "../refs/CoreRef.sol"; +import {TribeRoles} from "../core/TribeRoles.sol"; + +/// @title base class for a Compound PCV Deposit +/// @author Fei Protocol +contract FuseFixer is PCVDeposit { + address constant DEBTOR = address(0x32075bAd9050d4767018084F0Cb87b3182D36C45); + + address constant FEI = address(0x956F47F50A910163D8BF957Cf5846D573E7f87CA); + address constant FRAX = address(0x853d955aCEf822Db058eb8505911ED77F175b99e); + address constant RAI = address(0x03ab458634910AaD20eF5f1C8ee96F1D6ac54919); + address constant DAI = address(0x6B175474E89094C44Da98b954EedeAC495271d0F); + address constant USDC = address(0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48); + address constant LUSD = address(0x5f98805A4E8be255a32880FDeC7F6728C6568bA0); + address constant wstETH = address(0x7f39C581F595B53c5cb19bD0b3f8dA6c935E2Ca0); + address constant USTw = address(0xa693B19d2931d498c5B318dF961919BB4aee87a5); + address constant WETH = address(0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2); + address constant USDT = address(0xdAC17F958D2ee523a2206206994597C13D831ec7); + + address[] CTOKENS = [ + address(0xd8553552f8868C1Ef160eEdf031cF0BCf9686945), // Pool 8: FEI + address(0xbB025D470162CC5eA24daF7d4566064EE7f5F111), // Pool 8: ETH + address(0x7e9cE3CAa9910cc048590801e64174957Ed41d43), // Pool 8: DAI + address(0x7259eE19D6B5e755e7c65cECfd2466C09E251185), // Pool 8: wstETH + address(0x647A36d421183a0a9Fa62717a64B664a24E469C7), // Pool 8: LUSD + address(0xFA1057d02A0C1a4885851e3F4fD496Ee7D38F56e), // Pool 18: ETH + address(0x8E4E0257A4759559B4B1AC087fe8d80c63f20D19), // Pool 18: DAI + address(0x6f95d4d251053483f41c8718C30F4F3C404A8cf2), // Pool 18: USDC + address(0x3E5C122Ffa75A9Fe16ec0c69F7E9149203EA1A5d), // Pool 18: FRAX + address(0x17b1A2E012cC4C31f83B90FF11d3942857664efc), // Pool 18: FEI + address(0x51fF03410a0dA915082Af444274C381bD1b4cDB1), // Pool 18: RAI + address(0xB7FE5f277058b3f9eABf6e0655991f10924BFA54), // Pool 18: USTw + address(0x9de558FCE4F289b305E38ABe2169b75C626c114e), // Pool 27: FRAX + address(0xda396c927e3e6BEf77A98f372CE431b49EdEc43D), // Pool 27: FEI + address(0xF148cDEc066b94410d403aC5fe1bb17EC75c5851), // Pool 27: ETH + address(0x0C402F06C11c6e6A6616C98868A855448d4CfE65), // Pool 27: USTw + address(0x26267e41CeCa7C8E0f143554Af707336f27Fa051), // Pool 127: ETH + address(0xEbE0d1cb6A0b8569929e062d67bfbC07608f0A47), // Pool 127: USDC + address(0x4B68ef5AB32261082DF1A6C9C6a89FFD5eF168B1), // Pool 127: DAI + address(0xe097783483D1b7527152eF8B150B99B9B2700c8d), // Pool 127: USDT + address(0x0F0d710911FB37038b3AD88FC43DDAd4Edbe16A5), // Pool 127: USTw + address(0x8922C1147E141C055fdDfc0ED5a119f3378c8ef8), // Pool 127: FRAX + address(0x7DBC3aF9251756561Ce755fcC11c754184Af71F7), // Pool 144: ETH + address(0x3a2804ec0Ff521374aF654D8D0daA1d1aE1ee900), // Pool 144: FEI + address(0xA54c548d11792b3d26aD74F5f899e12CDfD64Fd6), // Pool 144: FRAX + address(0xA6C25548dF506d84Afd237225B5B34F2Feb1aa07), // Pool 144: DAI + address(0xfbD8Aaf46Ab3C2732FA930e5B343cd67cEA5054C), // Pool 146: ETH + address(0x49dA42a1EcA4AC6cA0C6943d9E5dc64e4641e0E3), // Pool 146: wstETH + address(0xe14c2e156A3f310d41240Ce8760eB3cb8a0dDBE3), // Pool 156: USTw + address(0x001E407f497e024B9fb1CB93ef841F43D645CA4F), // Pool 156: FEI + address(0x5CaDc2a04921213DE60B237688776e0F1A7155E6), // Pool 156: FRAX + address(0x9CD060A4855290bf0c5aeD266aBe119FF3b01966), // Pool 156: DAI + address(0x74897C0061ADeec84D292e8900c7BDD00b3388e4), // Pool 156: LUSD + address(0x88d3557eB6280CC084cA36e425d6BC52d0A04429), // Pool 156: USDC + address(0xe92a3db67e4b6AC86114149F522644b34264f858) // Pool 156: ETH + ]; + + constructor(address core) CoreRef(core) {} + + function repay(address underlying, uint256 maximum) public onlyGovernor { + require(getTotalDebt(underlying) < maximum, "Total debt is greater than maximum"); + + if (underlying == address(0)) { + _repayETH(underlying); + } else { + _repayERC20(underlying); + } + } + + /* Helper Functions */ + function _repayETH(address underlying) internal { + for (uint256 i = 0; i < CTOKENS.length; i++) { + CTokenFuse token = CTokenFuse(CTOKENS[i]); + if (token.underlying() == underlying) { + uint256 debtAmount = token.borrowBalanceCurrent(DEBTOR); + token.repayBorrowBehalf{value: debtAmount}(DEBTOR, debtAmount); + } + } + } + + function _repayERC20(address underlying) internal { + for (uint256 i = 0; i < CTOKENS.length; i++) { + CTokenFuse token = CTokenFuse(CTOKENS[i]); + if (token.underlying() == underlying) { + uint256 debtAmount = token.borrowBalanceCurrent(DEBTOR); + token.repayBorrowBehalf(DEBTOR, debtAmount); + } + } + } + + function getTotalDebt(address underlying) public returns (uint256 debt) { + for (uint256 i = 0; i < CTOKENS.length; i++) { + CTokenFuse token = CTokenFuse(CTOKENS[i]); + if (token.underlying() == underlying) { + debt += CTokenFuse(CTOKENS[i]).borrowBalanceCurrent(DEBTOR); + } + } + } + + /* Required Functions from PCVDeposit */ + + function deposit() external override { + // no-op + } + + function withdraw(address to, uint256 amount) external { + // no-op, use withdrawERC20 or withdrawETH + } + + function balance() public view virtual override returns (uint256) { + return 0; + } + + function balanceReportedIn() public view virtual override returns (address) { + return address(0); + } +} From de48ce86b725b0c7701066fe2244db284df8b303 Mon Sep 17 00:00:00 2001 From: Caleb Date: Tue, 17 May 2022 13:20:25 -0700 Subject: [PATCH 082/274] natspec --- contracts/utils/FuseFixer.sol | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/contracts/utils/FuseFixer.sol b/contracts/utils/FuseFixer.sol index 55e52b1eb..d39c132a6 100644 --- a/contracts/utils/FuseFixer.sol +++ b/contracts/utils/FuseFixer.sol @@ -62,6 +62,10 @@ contract FuseFixer is PCVDeposit { constructor(address core) CoreRef(core) {} + /// @dev Repay the underlying asset on all ctokens up to the maximum provide + /// @notice reverts if the total bad debt is beyond the provided maximum + /// @param underlying the asset to repay in + /// @param maximum the maximum amount of underlying asset to repay function repay(address underlying, uint256 maximum) public onlyGovernor { require(getTotalDebt(underlying) < maximum, "Total debt is greater than maximum"); From 63c54a9df997c99591f220e3088b933c2d349e15 Mon Sep 17 00:00:00 2001 From: Caleb Date: Tue, 17 May 2022 13:25:03 -0700 Subject: [PATCH 083/274] remove debtamount for _repayETH --- contracts/utils/FuseFixer.sol | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contracts/utils/FuseFixer.sol b/contracts/utils/FuseFixer.sol index d39c132a6..532aa148d 100644 --- a/contracts/utils/FuseFixer.sol +++ b/contracts/utils/FuseFixer.sol @@ -82,7 +82,7 @@ contract FuseFixer is PCVDeposit { CTokenFuse token = CTokenFuse(CTOKENS[i]); if (token.underlying() == underlying) { uint256 debtAmount = token.borrowBalanceCurrent(DEBTOR); - token.repayBorrowBehalf{value: debtAmount}(DEBTOR, debtAmount); + token.repayBorrowBehalf{value: debtAmount}(DEBTOR); } } } From dab83e51750cc97af8fb2f22eafeda78b5eed1c5 Mon Sep 17 00:00:00 2001 From: Caleb Date: Tue, 17 May 2022 13:26:25 -0700 Subject: [PATCH 084/274] add cetherfuse --- contracts/external/fuse/CToken.sol | 12 +++++++++++- contracts/utils/FuseFixer.sol | 4 ++-- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/contracts/external/fuse/CToken.sol b/contracts/external/fuse/CToken.sol index bcc29866e..6535878e7 100644 --- a/contracts/external/fuse/CToken.sol +++ b/contracts/external/fuse/CToken.sol @@ -16,5 +16,15 @@ abstract contract CTokenFuse { function borrowBalanceCurrent(address debtor) external virtual returns (uint256); - function repayBorrowBehalf(address borrower, uint256 repayAmount) external payable virtual returns (uint256); + function repayBorrowBehalf(address borrower, uint256 repayAmount) external virtual returns (uint256); +} + +abstract contract CEtherFuse { + function getCash() external view virtual returns (uint256); + + function underlying() external view virtual returns (address); + + function borrowBalanceCurrent(address debtor) external virtual returns (uint256); + + function repayBorrowBehalf(address borrower) external payable virtual returns (uint256); } diff --git a/contracts/utils/FuseFixer.sol b/contracts/utils/FuseFixer.sol index 532aa148d..7a1a67dae 100644 --- a/contracts/utils/FuseFixer.sol +++ b/contracts/utils/FuseFixer.sol @@ -2,7 +2,7 @@ pragma solidity ^0.8.0; import {PCVDeposit} from "../pcv/PCVDeposit.sol"; -import {CTokenFuse} from "../external/fuse/CToken.sol"; +import {CTokenFuse, CEtherFuse} from "../external/fuse/CToken.sol"; import {CoreRef} from "../refs/CoreRef.sol"; import {TribeRoles} from "../core/TribeRoles.sol"; @@ -79,7 +79,7 @@ contract FuseFixer is PCVDeposit { /* Helper Functions */ function _repayETH(address underlying) internal { for (uint256 i = 0; i < CTOKENS.length; i++) { - CTokenFuse token = CTokenFuse(CTOKENS[i]); + CEtherFuse token = CEtherFuse(CTOKENS[i]); if (token.underlying() == underlying) { uint256 debtAmount = token.borrowBalanceCurrent(DEBTOR); token.repayBorrowBehalf{value: debtAmount}(DEBTOR); From 3370d0ed595957f185263d63237ac52305b6dc3a Mon Sep 17 00:00:00 2001 From: Caleb Date: Tue, 17 May 2022 13:27:21 -0700 Subject: [PATCH 085/274] add comment --- contracts/utils/FuseFixer.sol | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/contracts/utils/FuseFixer.sol b/contracts/utils/FuseFixer.sol index 7a1a67dae..e7020e223 100644 --- a/contracts/utils/FuseFixer.sol +++ b/contracts/utils/FuseFixer.sol @@ -77,6 +77,7 @@ contract FuseFixer is PCVDeposit { } /* Helper Functions */ + function _repayETH(address underlying) internal { for (uint256 i = 0; i < CTOKENS.length; i++) { CEtherFuse token = CEtherFuse(CTOKENS[i]); @@ -97,7 +98,8 @@ contract FuseFixer is PCVDeposit { } } - function getTotalDebt(address underlying) public returns (uint256 debt) { + // Must be non-view since this updates a state var + function getTotalDebt(address underlying) internal returns (uint256 debt) { for (uint256 i = 0; i < CTOKENS.length; i++) { CTokenFuse token = CTokenFuse(CTOKENS[i]); if (token.underlying() == underlying) { From e0a6ed7bc940c85bab6ca9ac9e3a122cc9a80e83 Mon Sep 17 00:00:00 2001 From: Caleb Date: Tue, 17 May 2022 13:28:06 -0700 Subject: [PATCH 086/274] comment out unused constants --- contracts/utils/FuseFixer.sol | 2 ++ 1 file changed, 2 insertions(+) diff --git a/contracts/utils/FuseFixer.sol b/contracts/utils/FuseFixer.sol index e7020e223..6d5d4534a 100644 --- a/contracts/utils/FuseFixer.sol +++ b/contracts/utils/FuseFixer.sol @@ -11,6 +11,7 @@ import {TribeRoles} from "../core/TribeRoles.sol"; contract FuseFixer is PCVDeposit { address constant DEBTOR = address(0x32075bAd9050d4767018084F0Cb87b3182D36C45); + /* Addresses for reference only. address constant FEI = address(0x956F47F50A910163D8BF957Cf5846D573E7f87CA); address constant FRAX = address(0x853d955aCEf822Db058eb8505911ED77F175b99e); address constant RAI = address(0x03ab458634910AaD20eF5f1C8ee96F1D6ac54919); @@ -21,6 +22,7 @@ contract FuseFixer is PCVDeposit { address constant USTw = address(0xa693B19d2931d498c5B318dF961919BB4aee87a5); address constant WETH = address(0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2); address constant USDT = address(0xdAC17F958D2ee523a2206206994597C13D831ec7); + */ address[] CTOKENS = [ address(0xd8553552f8868C1Ef160eEdf031cF0BCf9686945), // Pool 8: FEI From 961c82d7d07b827cf93b3124d10739c579c6a33a Mon Sep 17 00:00:00 2001 From: Caleb Date: Tue, 17 May 2022 13:59:49 -0700 Subject: [PATCH 087/274] tc proposal code --- contracts/utils/FuseFixer.sol | 80 ++++++++++++------- proposals/dao/{ => old}/fip_82b.ts | 0 .../dao/{ => old}/withdraw_aave_comp_fei.ts | 0 proposals/dao/repay_fuse_bad_debt.ts | 45 +++++++++++ proposals/description/{ => old}/fip_82b.ts | 0 proposals/description/repay_fuse_bad_debt.ts | 17 ++++ .../description/withdraw_aave_comp_fei.ts | 24 ------ test/integration/proposals_config.ts | 8 +- 8 files changed, 118 insertions(+), 56 deletions(-) rename proposals/dao/{ => old}/fip_82b.ts (100%) rename proposals/dao/{ => old}/withdraw_aave_comp_fei.ts (100%) create mode 100644 proposals/dao/repay_fuse_bad_debt.ts rename proposals/description/{ => old}/fip_82b.ts (100%) create mode 100644 proposals/description/repay_fuse_bad_debt.ts delete mode 100644 proposals/description/withdraw_aave_comp_fei.ts diff --git a/contracts/utils/FuseFixer.sol b/contracts/utils/FuseFixer.sol index 6d5d4534a..cf0115c0e 100644 --- a/contracts/utils/FuseFixer.sol +++ b/contracts/utils/FuseFixer.sol @@ -11,20 +11,20 @@ import {TribeRoles} from "../core/TribeRoles.sol"; contract FuseFixer is PCVDeposit { address constant DEBTOR = address(0x32075bAd9050d4767018084F0Cb87b3182D36C45); - /* Addresses for reference only. - address constant FEI = address(0x956F47F50A910163D8BF957Cf5846D573E7f87CA); - address constant FRAX = address(0x853d955aCEf822Db058eb8505911ED77F175b99e); - address constant RAI = address(0x03ab458634910AaD20eF5f1C8ee96F1D6ac54919); - address constant DAI = address(0x6B175474E89094C44Da98b954EedeAC495271d0F); - address constant USDC = address(0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48); - address constant LUSD = address(0x5f98805A4E8be255a32880FDeC7F6728C6568bA0); - address constant wstETH = address(0x7f39C581F595B53c5cb19bD0b3f8dA6c935E2Ca0); - address constant USTw = address(0xa693B19d2931d498c5B318dF961919BB4aee87a5); - address constant WETH = address(0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2); - address constant USDT = address(0xdAC17F958D2ee523a2206206994597C13D831ec7); - */ - - address[] CTOKENS = [ + address[] internal UNDERLYINGS = [ + address(0x0000000000000000000000000000000000000000), // ETH + address(0x956F47F50A910163D8BF957Cf5846D573E7f87CA), // FEI + address(0x853d955aCEf822Db058eb8505911ED77F175b99e), // FRAX + address(0x03ab458634910AaD20eF5f1C8ee96F1D6ac54919), // RAI + address(0x6B175474E89094C44Da98b954EedeAC495271d0F), // DAI + address(0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48), // USDC + address(0x5f98805A4E8be255a32880FDeC7F6728C6568bA0), // LUSD + address(0x7f39C581F595B53c5cb19bD0b3f8dA6c935E2Ca0), // wstETH + address(0xa693B19d2931d498c5B318dF961919BB4aee87a5), // USTw + address(0xdAC17F958D2ee523a2206206994597C13D831ec7) // USDT + ]; + + address[] internal CTOKENS = [ address(0xd8553552f8868C1Ef160eEdf031cF0BCf9686945), // Pool 8: FEI address(0xbB025D470162CC5eA24daF7d4566064EE7f5F111), // Pool 8: ETH address(0x7e9cE3CAa9910cc048590801e64174957Ed41d43), // Pool 8: DAI @@ -62,7 +62,23 @@ contract FuseFixer is PCVDeposit { address(0xe92a3db67e4b6AC86114149F522644b34264f858) // Pool 156: ETH ]; - constructor(address core) CoreRef(core) {} + mapping(address => address[]) internal underlyingsToCTokens; + + constructor(address core) CoreRef(core) { + _buildCTokenMapping(); + + // @todo add some asserts here to check ctoken mappings + } + + /// @dev Repay all debt + function repayAll() public onlyGovernor { + _repayETH(); + + // we skip index 0 because that's ETH + for (uint256 i = 1; i < UNDERLYINGS.length; i++) { + _repayERC20(UNDERLYINGS[i]); + } + } /// @dev Repay the underlying asset on all ctokens up to the maximum provide /// @notice reverts if the total bad debt is beyond the provided maximum @@ -72,7 +88,7 @@ contract FuseFixer is PCVDeposit { require(getTotalDebt(underlying) < maximum, "Total debt is greater than maximum"); if (underlying == address(0)) { - _repayETH(underlying); + _repayETH(); } else { _repayERC20(underlying); } @@ -80,23 +96,31 @@ contract FuseFixer is PCVDeposit { /* Helper Functions */ - function _repayETH(address underlying) internal { + function _buildCTokenMapping() internal { for (uint256 i = 0; i < CTOKENS.length; i++) { - CEtherFuse token = CEtherFuse(CTOKENS[i]); - if (token.underlying() == underlying) { - uint256 debtAmount = token.borrowBalanceCurrent(DEBTOR); - token.repayBorrowBehalf{value: debtAmount}(DEBTOR); - } + address token = CTOKENS[i]; + address underlying = CTokenFuse(token).underlying(); + underlyingsToCTokens[underlying].push(token); + } + } + + function _repayETH() internal { + address[] memory cEtherTokens = underlyingsToCTokens[address(0)]; + + for (uint256 i = 0; i < cEtherTokens.length; i++) { + CEtherFuse token = CEtherFuse(cEtherTokens[i]); + uint256 debtAmount = token.borrowBalanceCurrent(DEBTOR); + token.repayBorrowBehalf{value: debtAmount}(DEBTOR); } } function _repayERC20(address underlying) internal { - for (uint256 i = 0; i < CTOKENS.length; i++) { - CTokenFuse token = CTokenFuse(CTOKENS[i]); - if (token.underlying() == underlying) { - uint256 debtAmount = token.borrowBalanceCurrent(DEBTOR); - token.repayBorrowBehalf(DEBTOR, debtAmount); - } + address[] memory cERC20Tokens = underlyingsToCTokens[underlying]; + + for (uint256 i = 0; i < cERC20Tokens.length; i++) { + CTokenFuse token = CTokenFuse(cERC20Tokens[i]); + uint256 debtAmount = token.borrowBalanceCurrent(DEBTOR); + token.repayBorrowBehalf(DEBTOR, debtAmount); } } diff --git a/proposals/dao/fip_82b.ts b/proposals/dao/old/fip_82b.ts similarity index 100% rename from proposals/dao/fip_82b.ts rename to proposals/dao/old/fip_82b.ts diff --git a/proposals/dao/withdraw_aave_comp_fei.ts b/proposals/dao/old/withdraw_aave_comp_fei.ts similarity index 100% rename from proposals/dao/withdraw_aave_comp_fei.ts rename to proposals/dao/old/withdraw_aave_comp_fei.ts diff --git a/proposals/dao/repay_fuse_bad_debt.ts b/proposals/dao/repay_fuse_bad_debt.ts new file mode 100644 index 000000000..a85c476a3 --- /dev/null +++ b/proposals/dao/repay_fuse_bad_debt.ts @@ -0,0 +1,45 @@ +import hre, { ethers, artifacts } from 'hardhat'; +import { expect } from 'chai'; +import { + DeployUpgradeFunc, + NamedAddresses, + SetupUpgradeFunc, + TeardownUpgradeFunc, + ValidateUpgradeFunc +} from '@custom-types/types'; +import { BigNumber } from 'ethers'; +import { forceEth } from '@test/integration/setup/utils'; + +/* +Withdraw FEI from Aave and Compound +*/ + +const fipNumber = 'repay_fuse_bad_debt'; // Change me! + +// Do any deployments +// This should exclusively include new contract deployments +const deploy: DeployUpgradeFunc = async (deployAddress: string, addresses: NamedAddresses, logging: boolean) => { + console.log(`No deploy actions for fip${fipNumber}`); + return {}; +}; + +// Do any setup necessary for running the test. +// This could include setting up Hardhat to impersonate accounts, +// ensuring contracts have a specific state, etc. +const setup: SetupUpgradeFunc = async (addresses, oldContracts, contracts, logging) => { + console.log(`No actions to complete in setup for fip${fipNumber}`); +}; + +// Tears down any changes made in setup() that need to be +// cleaned up before doing any validation checks. +const teardown: TeardownUpgradeFunc = async (addresses, oldContracts, contracts, logging) => { + console.log(`No actions to complete in teardown for fip${fipNumber}`); +}; + +// Run any validations required on the fip using mocha or console logging +// IE check balances, check state of contracts, etc. +const validate: ValidateUpgradeFunc = async (addresses, oldContracts, contracts, logging) => { + console.log(`No actions to complete in validate for fip${fipNumber}`); +}; + +export { deploy, setup, teardown, validate }; diff --git a/proposals/description/fip_82b.ts b/proposals/description/old/fip_82b.ts similarity index 100% rename from proposals/description/fip_82b.ts rename to proposals/description/old/fip_82b.ts diff --git a/proposals/description/repay_fuse_bad_debt.ts b/proposals/description/repay_fuse_bad_debt.ts new file mode 100644 index 000000000..28574e399 --- /dev/null +++ b/proposals/description/repay_fuse_bad_debt.ts @@ -0,0 +1,17 @@ +import { ProposalDescription } from '@custom-types/types'; + +const repay_fuse_bad_debt: ProposalDescription = { + title: 'Repay Fuse Bad Debt', + commands: [ + { + target: 'fuseFixer', + values: '0', + method: 'repayAll()', + arguments: [], + description: 'Repay all bad debt in Fuse pools 8, 18, 27, 127, 144, 146, 156' + } + ], + description: 'Repay all bad debt in Fuse pools 8, 18, 27, 127, 144, 146, 156' +}; + +export default repay_fuse_bad_debt; diff --git a/proposals/description/withdraw_aave_comp_fei.ts b/proposals/description/withdraw_aave_comp_fei.ts deleted file mode 100644 index 493bcca93..000000000 --- a/proposals/description/withdraw_aave_comp_fei.ts +++ /dev/null @@ -1,24 +0,0 @@ -import { ProposalDescription } from '@custom-types/types'; - -const fip_x: ProposalDescription = { - title: 'Withdraw Fei from Aave and Compound', - commands: [ - { - target: 'pcvGuardianNew', - values: '0', - method: 'withdrawToSafeAddress(address,address,uint256,bool,bool)', - arguments: ['{aaveFeiPCVDeposit}', '{daiFixedPricePSM}', '6400000000000000000000000', false, false], - description: 'Withdraw 6.4M Fei from Aave to the DAI PSM' - }, - { - target: 'pcvGuardianNew', - values: '0', - method: 'withdrawToSafeAddress(address,address,uint256,bool,bool)', - arguments: ['{compoundFeiPCVDeposit}', '{daiFixedPricePSM}', '3000000000000000000000000', false, false], - description: 'Withdraw 3M Fei from Compound to the DAI PSM' - } - ], - description: 'Withdraw 6.4M FEI from Aave and 3M FEI from Compound to the DAI PSM' -}; - -export default fip_x; diff --git a/test/integration/proposals_config.ts b/test/integration/proposals_config.ts index 8c87408e7..87759cdbf 100644 --- a/test/integration/proposals_config.ts +++ b/test/integration/proposals_config.ts @@ -1,12 +1,12 @@ import { ProposalCategory, ProposalsConfigMap } from '@custom-types/types'; -import withdraw_aave_comp_fei from '@proposals/description/withdraw_aave_comp_fei'; +import repay_fuse_bad_debt from '@proposals/description/repay_fuse_bad_debt'; const proposals: ProposalsConfigMap = { - withdraw_aave_comp_fei: { - deploy: true, // deploy flag for whether to run deploy action during e2e tests or use mainnet state + repay_fuse_bad_debt: { + deploy: false, // deploy flag for whether to run deploy action during e2e tests or use mainnet state totalValue: 0, // amount of ETH to send to DAO execution - proposal: withdraw_aave_comp_fei, // full proposal file, imported from '@proposals/description/fip_xx.ts' + proposal: repay_fuse_bad_debt, // full proposal file, imported from '@proposals/description/fip_xx.ts' proposalId: '', affectedContractSignoff: [''], deprecatedContractSignoff: [''], From 802d1ca7bfc6094263705457f4a067f573c2f270 Mon Sep 17 00:00:00 2001 From: thomas-waite Date: Tue, 17 May 2022 22:05:02 +0100 Subject: [PATCH 088/274] wip --- hardhat.config.ts | 3 +- proposals/dao/fip_105.ts | 144 +++++++++++++++++- proposals/dao/swap_dpi_to_dai.ts | 178 ----------------------- proposals/description/fip_105.ts | 68 ++++++++- proposals/description/swap_dpi_to_dai.ts | 69 --------- test/integration/proposals_config.ts | 22 ++- test/integration/tests/pcv.ts | 2 +- 7 files changed, 220 insertions(+), 266 deletions(-) delete mode 100644 proposals/dao/swap_dpi_to_dai.ts delete mode 100644 proposals/description/swap_dpi_to_dai.ts diff --git a/hardhat.config.ts b/hardhat.config.ts index 6a68d2c71..b741a76d4 100644 --- a/hardhat.config.ts +++ b/hardhat.config.ts @@ -23,6 +23,7 @@ const runAllTests = process.env.RUN_ALL_TESTS; const useJSONTestReporter = process.env.REPORT_TEST_RESULTS_AS_JSON; const etherscanKey = process.env.ETHERSCAN_API_KEY; const forkBlock = process.env.FORK_BLOCK; +const mainnetRpcURL = process.env.MAINNET_RPC_URL; if (!(process.env.NODE_OPTIONS && process.env.NODE_OPTIONS.includes('max-old-space-size'))) { throw new Error( @@ -73,7 +74,7 @@ export default { }, mainnet: { - url: `https://eth-mainnet.alchemyapi.io/v2/${mainnetAlchemyApiKey}`, + url: mainnetRpcURL, accounts: privateKey ? [privateKey] : [], gasPrice: 70000000000 } diff --git a/proposals/dao/fip_105.ts b/proposals/dao/fip_105.ts index 301cc594f..312dbc152 100644 --- a/proposals/dao/fip_105.ts +++ b/proposals/dao/fip_105.ts @@ -7,6 +7,11 @@ import { TeardownUpgradeFunc, ValidateUpgradeFunc } from '@custom-types/types'; +import { forceEth } from '@test/integration/setup/utils'; +import { TransactionResponse } from '@ethersproject/providers'; +import { getImpersonatedSigner, overwriteChainlinkAggregator, time } from '@test/helpers'; + +const toBN = ethers.BigNumber.from; /* @@ -15,11 +20,19 @@ DAO Proposal #105 Description: Deploy a Fei skimmer for the DAI PSM */ +// LBP Swapper config +const LBP_FREQUENCY = 86400 * 14; // 2 weeks in seconds +const MIN_LBP_SIZE = ethers.constants.WeiPerEther.mul(10_000); // 10k +let poolId; // auction pool id + +const daiSeedAmount = toBN('187947000000000000000000'); +const dpiSeedAmount = toBN('37888449801955370645659'); + const fipNumber = '105'; const skimThreshold = ethers.constants.WeiPerEther.mul(20_000_000); const deploy: DeployUpgradeFunc = async (deployAddress: string, addresses: NamedAddresses, logging: boolean) => { - // 1. Deploy a Fei Skimmer for the DAI PSM + ///////// 1. Deploy a Fei Skimmer for the DAI PSM const daiPSMFeiSkimmerFactory = await ethers.getContractFactory('FeiSkimmer'); const daiFixedPricePSMFeiSkimmer = await daiPSMFeiSkimmerFactory.deploy( addresses.core, @@ -28,8 +41,89 @@ const deploy: DeployUpgradeFunc = async (deployAddress: string, addresses: Named ); await daiFixedPricePSMFeiSkimmer.deployed(); logging && console.log('DAI PSM Fei Skimmer deployed at', daiFixedPricePSMFeiSkimmer.address); + + /////////// 2. Deploy the Balancer LBP swapper + // // Amounts: + // DPI: 37888449801955370645659 (95%), 37k DPI, $3,758,957.86 + // DAI: 187947000000000000000000 (5%), 187k DAI, $187,947.89 + const BalancerLBPSwapperFactory = await ethers.getContractFactory('BalancerLBPSwapper'); + const dpiToDaiSwapper = await BalancerLBPSwapperFactory.deploy( + addresses.core, + { + _oracle: addresses.chainlinkDpiUsdOracleWrapper, + _backupOracle: ethers.constants.AddressZero, + _invertOraclePrice: true, + _decimalsNormalizer: 0 + }, + LBP_FREQUENCY, + '50000000000000000', // small weight 5% + '950000000000000000', // large weight 95% + addresses.dpi, + addresses.dai, + addresses.compoundDaiPCVDeposit, // send DAI to Compound DAI deposit, where it can then be dripped to PSM + MIN_LBP_SIZE // minimum size of a pool which the swapper is used against + ); + + await dpiToDaiSwapper.deployed(); + logging && console.log('DPI to DAI swapper deployed to: ', dpiToDaiSwapper.address); + + // 2. Create a liquidity bootstrapping pool between DPI and DAI + const lbpFactory = await ethers.getContractAt( + 'ILiquidityBootstrappingPoolFactory', + addresses.balancerLBPoolFactoryNoFee + ); + + const tx: TransactionResponse = await lbpFactory.create( + 'DPI->DAI Auction Pool', // pool name + 'apDPI-DAI', // lbp token symbol + [addresses.dpi, addresses.dai], // pool contains [DPI, DAI] + [ethers.constants.WeiPerEther.mul(95).div(100), ethers.constants.WeiPerEther.mul(5).div(100)], // initial weights 5%/95% + ethers.constants.WeiPerEther.mul(30).div(10_000), // 0.3% swap fees + dpiToDaiSwapper.address, // pool owner = fei protocol swapper + true + ); + + const txReceipt = await tx.wait(); + const { logs: rawLogs } = txReceipt; + const noFeeDpiDaiLBPAddress = `0x${rawLogs[rawLogs.length - 1].topics[1].slice(-40)}`; + poolId = rawLogs[1].topics[1]; + + logging && console.log('LBP Pool deployed to: ', noFeeDpiDaiLBPAddress); + logging && console.log('LBP Pool Id: ', poolId); + + // 3. Initialise the LBP swapper with the pool address + const tx2 = await dpiToDaiSwapper.init(noFeeDpiDaiLBPAddress); + await tx2.wait(); + + // 4. Deploy a lens to report the swapper value + const BPTLensFactory = await ethers.getContractFactory('BPTLens'); + const dpiToDaiLensDai = await BPTLensFactory.deploy( + addresses.dai, // token reported in + noFeeDpiDaiLBPAddress, // pool address + addresses.chainlinkDaiUsdOracleWrapper, // reportedOracle - DAI + addresses.chainlinkDpiUsdOracleWrapper, // otherOracle - DPI + false, // feiIsReportedIn + false // feiIsOther + ); + await dpiToDaiLensDai.deployTransaction.wait(); + + logging && console.log('BPTLens for DPI in swapper pool: ', dpiToDaiLensDai.address); + + const dpiToDaiLensDpi = await BPTLensFactory.deploy( + addresses.dpi, // token reported in + noFeeDpiDaiLBPAddress, // pool address + addresses.chainlinkDpiUsdOracleWrapper, // reportedOracle - DPI + addresses.chainlinkDaiUsdOracleWrapper, // otherOracle - DAI + false, // feiIsReportedIn + false // feiIsOther + ); + + logging && console.log('BPTLens for DAI in swapper pool: ', dpiToDaiLensDpi.address); return { - daiFixedPricePSMFeiSkimmer + daiFixedPricePSMFeiSkimmer, + dpiToDaiSwapper, + dpiToDaiLensDai, + dpiToDaiLensDpi }; }; @@ -37,7 +131,32 @@ const deploy: DeployUpgradeFunc = async (deployAddress: string, addresses: Named // This could include setting up Hardhat to impersonate accounts, // ensuring contracts have a specific state, etc. const setup: SetupUpgradeFunc = async (addresses, oldContracts, contracts, logging) => { - console.log(`No actions to complete in setup for fip${fipNumber}`); + // overwrite chainlink ETH/USD oracle + await overwriteChainlinkAggregator(addresses.chainlinkEthUsdOracle, '250000000000', '8'); + + // invariant checks + expect(await contracts.dpiToDaiSwapper.tokenSpent()).to.be.equal(addresses.dpi); + expect(await contracts.dpiToDaiSwapper.tokenReceived()).to.be.equal(addresses.dai); + expect(await contracts.dpiToDaiSwapper.tokenReceivingAddress()).to.be.equal(addresses.compoundDaiPCVDeposit); + const poolTokens = await contracts.balancerVault.getPoolTokens(poolId); + expect(poolTokens.tokens[0]).to.be.equal(addresses.dpi); + expect(poolTokens.tokens[1]).to.be.equal(addresses.dai); + + // LBP swapper should be empty + expect(poolTokens.balances[0]).to.be.equal('0'); + expect(poolTokens.balances[1]).to.be.equal('0'); + + // Lenses should report 0 because LBP is empty + expect(await contracts.dpiToDaiLensDai.balance()).to.be.equal('0'); + expect(await contracts.dpiToDaiLensDpi.balance()).to.be.equal('0'); + + // Swapper should hold no tokens + expect(await contracts.dpi.balanceOf(contracts.dpiToDaiSwapper.address)).to.be.equal('0'); + expect(await contracts.dai.balanceOf(contracts.dpiToDaiSwapper.address)).to.be.equal('0'); + + console.log('Starting DAI PSM dai balance [M]', (await contracts.compoundDaiPCVDeposit.balance()) / 1e24); + + await forceEth(addresses.tribalCouncilTimelock); }; // Tears down any changes made in setup() that need to be @@ -49,6 +168,7 @@ const teardown: TeardownUpgradeFunc = async (addresses, oldContracts, contracts, // Run any validations required on the fip using mocha or console logging // IE check balances, check state of contracts, etc. const validate: ValidateUpgradeFunc = async (addresses, oldContracts, contracts, logging) => { + //////////// 1. DAI FEI SKIMMER ////////////// const daiFixedPricePSMFeiSkimmer = contracts.daiFixedPricePSMFeiSkimmer; const core = contracts.core; @@ -58,6 +178,24 @@ const validate: ValidateUpgradeFunc = async (addresses, oldContracts, contracts, // Validate skimmer contract admin role is set to PCV_MINOR_PARAM_ROLE expect(await daiFixedPricePSMFeiSkimmer.CONTRACT_ADMIN_ROLE()).to.be.equal(ethers.utils.id('PCV_MINOR_PARAM_ROLE')); + + ///////////// 2. DPI LBP //////////////// + // By this point, the DAO has moved funds to the LBP swapper and the auction should be active + console.log('Final DAI PSM dai balance [M]', (await contracts.compoundDaiPCVDeposit.balance()) / 1e24); + + expect(await contracts.dpi.balanceOf(contracts.dpiToDaiSwapper.address)).to.be.equal(dpiSeedAmount); + expect(await contracts.dai.balanceOf(contracts.dpiToDaiSwapper.address)).to.be.equal(daiSeedAmount); + + await time.increase(await contracts.dpiToDaiSwapper.remainingTime()); + expect(await contracts.dpiToDaiSwapper.isTimeEnded()).to.be.true; + + // Validate SWAP_ADMIN_ROLE is under ROLE_ADMIN and that TribalCouncilTimelock has the role + expect(await core.hasRole(ethers.utils.id('SWAP_ADMIN_ROLE'), addresses.tribalCouncilTimelock)).to.be.true; + expect(await core.getRoleAdmin(ethers.utils.id('SWAP_ADMIN_ROLE'))).to.be.equal(ethers.utils.id('ROLE_ADMIN')); + + const signer = await getImpersonatedSigner(addresses.tribalCouncilTimelock); // TODO: TribalCouncil should grant itself SWAP_ADMIN_ROLE + await contracts.dpiToDaiSwapper.connect(signer).swap(); + expect(await contracts.dpiToDaiSwapper.isTimeEnded()).to.be.false; }; export { deploy, setup, teardown, validate }; diff --git a/proposals/dao/swap_dpi_to_dai.ts b/proposals/dao/swap_dpi_to_dai.ts deleted file mode 100644 index 82d1512d5..000000000 --- a/proposals/dao/swap_dpi_to_dai.ts +++ /dev/null @@ -1,178 +0,0 @@ -import { ethers } from 'hardhat'; -import { expect } from 'chai'; -import { TransactionResponse } from '@ethersproject/providers'; -import { - DeployUpgradeFunc, - NamedAddresses, - SetupUpgradeFunc, - TeardownUpgradeFunc, - ValidateUpgradeFunc -} from '@custom-types/types'; -import { getImpersonatedSigner, overwriteChainlinkAggregator, time } from '@test/helpers'; -import { forceEth } from '@test/integration/setup/utils'; - -const toBN = ethers.BigNumber.from; - -/* -Swap DPI for DAI using an LBP Swapper -*/ - -const fipNumber = 'swap_dpi_to_dai'; - -// LBP Swapper config -const LBP_FREQUENCY = 86400 * 14; // 2 weeks in seconds -const MIN_LBP_SIZE = ethers.constants.WeiPerEther.mul(10_000); // 10k -let poolId; // auction pool id - -const daiSeedAmount = toBN('187947000000000000000000'); -const dpiSeedAmount = toBN('37888449801955370645659'); - -const deploy: DeployUpgradeFunc = async (deployAddress: string, addresses: NamedAddresses, logging: boolean) => { - // Amounts: - // DPI: 37888449801955370645659 (95%), 37k DPI, $3,758,957.86 - // DAI: 187947000000000000000000 (5%), 187k DAI, $187,947.89 - - // 1. Deploy the Balancer LBP swapper - const BalancerLBPSwapperFactory = await ethers.getContractFactory('BalancerLBPSwapper'); - const dpiToDaiSwapper = await BalancerLBPSwapperFactory.deploy( - addresses.core, - { - _oracle: addresses.chainlinkDpiUsdOracleWrapper, - _backupOracle: ethers.constants.AddressZero, - _invertOraclePrice: true, - _decimalsNormalizer: 0 - }, - LBP_FREQUENCY, - '50000000000000000', // small weight 5% - '950000000000000000', // large weight 95% - addresses.dpi, - addresses.dai, - addresses.compoundDaiPCVDeposit, // send DAI to Compound DAI deposit, where it can then be dripped to PSM - MIN_LBP_SIZE // minimum size of a pool which the swapper is used against - ); - - await dpiToDaiSwapper.deployed(); - logging && console.log('DPI to DAI swapper deployed to: ', dpiToDaiSwapper.address); - - // 2. Create a liquidity bootstrapping pool between DPI and DAI - const lbpFactory = await ethers.getContractAt( - 'ILiquidityBootstrappingPoolFactory', - addresses.balancerLBPoolFactoryNoFee - ); - - const tx: TransactionResponse = await lbpFactory.create( - 'DPI->DAI Auction Pool', // pool name - 'apDPI-DAI', // lbp token symbol - [addresses.dpi, addresses.dai], // pool contains [DPI, DAI] - [ethers.constants.WeiPerEther.mul(95).div(100), ethers.constants.WeiPerEther.mul(5).div(100)], // initial weights 5%/95% - ethers.constants.WeiPerEther.mul(30).div(10_000), // 0.3% swap fees - dpiToDaiSwapper.address, // pool owner = fei protocol swapper - true - ); - - const txReceipt = await tx.wait(); - const { logs: rawLogs } = txReceipt; - const noFeeDpiDaiLBPAddress = `0x${rawLogs[rawLogs.length - 1].topics[1].slice(-40)}`; - poolId = rawLogs[1].topics[1]; - - logging && console.log('LBP Pool deployed to: ', noFeeDpiDaiLBPAddress); - logging && console.log('LBP Pool Id: ', poolId); - - // 3. Initialise the LBP swapper with the pool address - const tx2 = await dpiToDaiSwapper.init(noFeeDpiDaiLBPAddress); - await tx2.wait(); - - // 4. Deploy a lens to report the swapper value - const BPTLensFactory = await ethers.getContractFactory('BPTLens'); - const dpiToDaiLensDai = await BPTLensFactory.deploy( - addresses.dai, // token reported in - noFeeDpiDaiLBPAddress, // pool address - addresses.chainlinkDaiUsdOracleWrapper, // reportedOracle - DAI - addresses.chainlinkDpiUsdOracleWrapper, // otherOracle - DPI - false, // feiIsReportedIn - false // feiIsOther - ); - await dpiToDaiLensDai.deployTransaction.wait(); - - logging && console.log('BPTLens for DPI in swapper pool: ', dpiToDaiLensDai.address); - - const dpiToDaiLensDpi = await BPTLensFactory.deploy( - addresses.dpi, // token reported in - noFeeDpiDaiLBPAddress, // pool address - addresses.chainlinkDpiUsdOracleWrapper, // reportedOracle - DPI - addresses.chainlinkDaiUsdOracleWrapper, // otherOracle - DAI - false, // feiIsReportedIn - false // feiIsOther - ); - - logging && console.log('BPTLens for DAI in swapper pool: ', dpiToDaiLensDpi.address); - - return { - dpiToDaiSwapper, - dpiToDaiLensDai, - dpiToDaiLensDpi - }; -}; - -// Do any setup necessary for running the test. -// This could include setting up Hardhat to impersonate accounts, -// ensuring contracts have a specific state, etc. -const setup: SetupUpgradeFunc = async (addresses, oldContracts, contracts, logging) => { - // overwrite chainlink ETH/USD oracle - await overwriteChainlinkAggregator(addresses.chainlinkEthUsdOracle, '250000000000', '8'); - - // invariant checks - expect(await contracts.dpiToDaiSwapper.tokenSpent()).to.be.equal(addresses.dpi); - expect(await contracts.dpiToDaiSwapper.tokenReceived()).to.be.equal(addresses.dai); - expect(await contracts.dpiToDaiSwapper.tokenReceivingAddress()).to.be.equal(addresses.compoundDaiPCVDeposit); - const poolTokens = await contracts.balancerVault.getPoolTokens(poolId); - expect(poolTokens.tokens[0]).to.be.equal(addresses.dpi); - expect(poolTokens.tokens[1]).to.be.equal(addresses.dai); - - // LBP swapper should be empty - expect(poolTokens.balances[0]).to.be.equal('0'); - expect(poolTokens.balances[1]).to.be.equal('0'); - - // Lenses should report 0 because LBP is empty - expect(await contracts.dpiToDaiLensDai.balance()).to.be.equal('0'); - expect(await contracts.dpiToDaiLensDpi.balance()).to.be.equal('0'); - - // Swapper should hold no tokens - expect(await contracts.dpi.balanceOf(contracts.dpiToDaiSwapper.address)).to.be.equal('0'); - expect(await contracts.dai.balanceOf(contracts.dpiToDaiSwapper.address)).to.be.equal('0'); - - console.log('Starting DAI PSM dai balance [M]', (await contracts.compoundDaiPCVDeposit.balance()) / 1e24); - - await forceEth(addresses.tribalCouncilTimelock); -}; - -// Tears down any changes made in setup() that need to be -// cleaned up before doing any validation checks. -const teardown: TeardownUpgradeFunc = async (addresses, oldContracts, contracts, logging) => { - console.log(`No actions to complete in teardown for fip${fipNumber}`); -}; - -// Run any validations required on the fip using mocha or console logging -// IE check balances, check state of contracts, etc. -const validate: ValidateUpgradeFunc = async (addresses, oldContracts, contracts, logging) => { - const core = contracts.core; - - // By this point, the DAO has moved funds to the LBP swapper and the auction should be active - console.log('Final DAI PSM dai balance [M]', (await contracts.compoundDaiPCVDeposit.balance()) / 1e24); - - expect(await contracts.dpi.balanceOf(contracts.dpiToDaiSwapper.address)).to.be.equal(dpiSeedAmount); - expect(await contracts.dai.balanceOf(contracts.dpiToDaiSwapper.address)).to.be.equal(daiSeedAmount); - - await time.increase(await contracts.dpiToDaiSwapper.remainingTime()); - expect(await contracts.dpiToDaiSwapper.isTimeEnded()).to.be.true; - - // Validate SWAP_ADMIN_ROLE is under ROLE_ADMIN and that TribalCouncilTimelock has the role - expect(await core.hasRole(ethers.utils.id('SWAP_ADMIN_ROLE'), addresses.tribalCouncilTimelock)).to.be.true; - expect(await core.getRoleAdmin(ethers.utils.id('SWAP_ADMIN_ROLE'))).to.be.equal(ethers.utils.id('ROLE_ADMIN')); - - const signer = await getImpersonatedSigner(addresses.tribalCouncilTimelock); // TODO: TribalCouncil should grant itself SWAP_ADMIN_ROLE - await contracts.dpiToDaiSwapper.connect(signer).swap(); - expect(await contracts.dpiToDaiSwapper.isTimeEnded()).to.be.false; -}; - -export { deploy, setup, teardown, validate }; diff --git a/proposals/description/fip_105.ts b/proposals/description/fip_105.ts index 39b881b73..5a2efd497 100644 --- a/proposals/description/fip_105.ts +++ b/proposals/description/fip_105.ts @@ -1,7 +1,7 @@ import { ProposalDescription } from '@custom-types/types'; const fip_105: ProposalDescription = { - title: 'FIP-105: Grant DAI PSM skimmer PCV_CONTROLLER_ROLE', + title: 'FIP-105: Reinforce PCV by consolidating assets and performing technical maintenance', commands: [ { target: 'core', @@ -9,9 +9,73 @@ const fip_105: ProposalDescription = { method: 'grantRole(bytes32,address)', arguments: ['0x0866eae1216ed05a11636a648003f3f62921eb97ccb05acc30636f62958a8bd6', '{daiFixedPricePSMFeiSkimmer}'], description: 'Grant the new DAI PSM Skimmer the PCV_CONTROLLER_ROLE' + }, + { + target: 'dpi', + values: '0', + method: 'transfer(address,uint256)', + arguments: ['{dpiToDaiSwapper}', '37888449801955370645659'], + description: 'Transfer DPI from DAO timelock to the LBP pool' + }, + { + target: 'compoundDaiPCVDeposit', + values: '0', + method: 'withdraw(address,uint256)', + arguments: ['{dpiToDaiSwapper}', '187947000000000000000000'], + description: 'Withdraw Use the PCVGuardian to transfer DAI from the CompoundPCVDeposit to the LBP pool' + }, + { + target: 'collateralizationOracle', + values: '0', + method: 'addDeposit(address)', + arguments: ['{dpiToDaiLensDai}'], + description: 'Add DAI swapper lens to the CR oracle' + }, + { + target: 'collateralizationOracle', + values: '0', + method: 'addDeposit(address)', + arguments: ['{dpiToDaiLensDpi}'], + description: 'Add DPI swapper lens to the CR oracle' + }, + { + target: 'collateralizationOracle', + values: '0', + method: 'removeDeposits(address[])', + arguments: [ + [ + '{dpiDepositWrapper}', + '{rariPool31FeiPCVDepositWrapper}', + '{rariPool25FeiPCVDepositWrapper}', + '{rariPool9RaiPCVDepositWrapper}', + '{aaveRaiPCVDepositWrapper}', + '{rariPool19DpiPCVDepositWrapper}', + '{liquityFusePoolLusdPCVDeposit}', + '{rariPool72FeiPCVDepositWrapper}', + '{raiDepositWrapper}' + ] + ], + description: 'Remove DPI Deposit wrapper from CR oracle, as now empty' + }, + { + target: 'core', + values: '0', + method: 'grantRole(bytes32,address)', + arguments: ['0x471cfe1a44bf1b786db7d7104d51e6728ed7b90a35394ad7cc424adf8ed16816', '{tribalCouncilTimelock}'], + description: 'Grant TribalCouncilTimelock SWAP_ADMIN_ROLE so it can initiate the LBP swap' } ], - description: 'Configure a new Fei Skimmer to burn excess DAI from the DAI PSM' + description: ` + FIP-105: Reinforce PCV by consolidating assets and performing technical maintenance + + + Transfer DPI and DAI to the LBP swapper. This will be used over the course of a month + to swap DPI for DAI. + + The DAI received will be sent to the Compound DAI deposit, where it can then be dripped to PSM. + + Configure a new Fei Skimmer to burn excess DAI from the DAI PSM + ` }; export default fip_105; diff --git a/proposals/description/swap_dpi_to_dai.ts b/proposals/description/swap_dpi_to_dai.ts deleted file mode 100644 index 7618b5e0d..000000000 --- a/proposals/description/swap_dpi_to_dai.ts +++ /dev/null @@ -1,69 +0,0 @@ -import { ProposalDescription } from '@custom-types/types'; - -const swap_dpi_to_dai: ProposalDescription = { - title: 'Swap DPI to DAI', - commands: [ - { - target: 'dpi', - values: '0', - method: 'transfer(address,uint256)', - arguments: ['{dpiToDaiSwapper}', '37888449801955370645659'], - description: 'Transfer DPI from DAO timelock to the LBP pool' - }, - { - target: 'compoundDaiPCVDeposit', - values: '0', - method: 'withdraw(address,uint256)', - arguments: ['{dpiToDaiSwapper}', '187947000000000000000000'], - description: 'Withdraw Use the PCVGuardian to transfer DAI from the CompoundPCVDeposit to the LBP pool' - }, - { - target: 'collateralizationOracle', - values: '0', - method: 'addDeposit(address)', - arguments: ['{dpiToDaiLensDai}'], - description: 'Add DAI swapper lens to the CR oracle' - }, - { - target: 'collateralizationOracle', - values: '0', - method: 'addDeposit(address)', - arguments: ['{dpiToDaiLensDpi}'], - description: 'Add DPI swapper lens to the CR oracle' - }, - { - target: 'collateralizationOracle', - values: '0', - method: 'removeDeposits(address[])', - arguments: [ - [ - '{dpiDepositWrapper}', - '{rariPool31FeiPCVDepositWrapper}', - '{rariPool25FeiPCVDepositWrapper}', - '{rariPool9RaiPCVDepositWrapper}', - '{aaveRaiPCVDepositWrapper}', - '{rariPool19DpiPCVDepositWrapper}', - '{liquityFusePoolLusdPCVDeposit}', - '{rariPool72FeiPCVDepositWrapper}', - '{raiDepositWrapper}' - ] - ], - description: 'Remove DPI Deposit wrapper from CR oracle, as now empty' - }, - { - target: 'core', - values: '0', - method: 'grantRole(bytes32,address)', - arguments: ['0x471cfe1a44bf1b786db7d7104d51e6728ed7b90a35394ad7cc424adf8ed16816', '{tribalCouncilTimelock}'], - description: 'Grant TribalCouncilTimelock SWAP_ADMIN_ROLE so it can initiate the LBP swap' - } - ], - description: ` - Transfer DPI and DAI to the LBP swapper. This will be used over the course of a month - to swap DPI for DAI. - - The DAI received will be sent to the Compound DAI deposit, where it can then be dripped to PSM. - ` -}; - -export default swap_dpi_to_dai; diff --git a/test/integration/proposals_config.ts b/test/integration/proposals_config.ts index 7dc28d4be..f10ee0602 100644 --- a/test/integration/proposals_config.ts +++ b/test/integration/proposals_config.ts @@ -1,7 +1,6 @@ import { ProposalCategory, ProposalsConfigMap } from '@custom-types/types'; import fip_105 from '@proposals/description/fip_105'; -import swap_dpi_to_dai from '@proposals/description/swap_dpi_to_dai'; // import fip_xx_proposal from '@proposals/description/fip_xx'; const proposals: ProposalsConfigMap = { @@ -10,14 +9,15 @@ const proposals: ProposalsConfigMap = { totalValue: 0, // amount of ETH to send to DAO execution proposal: fip_105, // full proposal file, imported from '@proposals/description/fip_xx.ts' proposalId: '', - affectedContractSignoff: ['daiFixedPricePSMFeiSkimmer', 'core'], - deprecatedContractSignoff: [], - category: ProposalCategory.DAO - }, - swap_dpi_to_dai: { - deploy: true, - proposalId: null, - affectedContractSignoff: ['dpi', 'compoundDaiPCVDeposit', 'dpiToDaiSwapper', 'dpiToDaiLensDai', 'dpiToDaiLensDpi'], + affectedContractSignoff: [ + 'daiFixedPricePSMFeiSkimmer', + 'core', + 'dpi', + 'compoundDaiPCVDeposit', + 'dpiToDaiSwapper', + 'dpiToDaiLensDai', + 'dpiToDaiLensDpi' + ], deprecatedContractSignoff: [ 'rariPool31FeiPCVDepositWrapper', 'rariPool25FeiPCVDepositWrapper', @@ -35,9 +35,7 @@ const proposals: ProposalsConfigMap = { 'rariPool72FeiPCVDeposit', 'dpiDepositWrapper' ], - category: ProposalCategory.DAO, - totalValue: 0, - proposal: swap_dpi_to_dai + category: ProposalCategory.DAO } }; diff --git a/test/integration/tests/pcv.ts b/test/integration/tests/pcv.ts index 0e0ff263a..d7d1da822 100644 --- a/test/integration/tests/pcv.ts +++ b/test/integration/tests/pcv.ts @@ -54,7 +54,7 @@ describe('e2e-pcv', function () { }); describe('BAMM', function () { - it('should be able to withdraw LUSD from B.AMM', async function () { + it.only('should be able to withdraw LUSD from B.AMM', async function () { // set Chainlink ETHUSD to a fixed 4,000$ value await overwriteChainlinkAggregator(contractAddresses.chainlinkEthUsdOracle, '400000000000', '8'); From de52e2a2d83be595a3e251c0580618cbc9ad483f Mon Sep 17 00:00:00 2001 From: Caleb Date: Tue, 17 May 2022 14:10:24 -0700 Subject: [PATCH 089/274] add in token approvals --- contracts/utils/FuseFixer.sol | 29 ++++++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) diff --git a/contracts/utils/FuseFixer.sol b/contracts/utils/FuseFixer.sol index cf0115c0e..ba9a6aecc 100644 --- a/contracts/utils/FuseFixer.sol +++ b/contracts/utils/FuseFixer.sol @@ -3,6 +3,7 @@ pragma solidity ^0.8.0; import {PCVDeposit} from "../pcv/PCVDeposit.sol"; import {CTokenFuse, CEtherFuse} from "../external/fuse/CToken.sol"; +import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import {CoreRef} from "../refs/CoreRef.sol"; import {TribeRoles} from "../core/TribeRoles.sol"; @@ -67,7 +68,20 @@ contract FuseFixer is PCVDeposit { constructor(address core) CoreRef(core) { _buildCTokenMapping(); - // @todo add some asserts here to check ctoken mappings + // check mappings lengths - hand calculated + assert(underlyingsToCTokens[UNDERLYINGS[0]].length == 7); + assert(underlyingsToCTokens[UNDERLYINGS[1]].length == 5); + assert(underlyingsToCTokens[UNDERLYINGS[2]].length == 5); + assert(underlyingsToCTokens[UNDERLYINGS[3]].length == 1); + assert(underlyingsToCTokens[UNDERLYINGS[4]].length == 5); + assert(underlyingsToCTokens[UNDERLYINGS[5]].length == 3); + assert(underlyingsToCTokens[UNDERLYINGS[6]].length == 2); + assert(underlyingsToCTokens[UNDERLYINGS[7]].length == 2); + assert(underlyingsToCTokens[UNDERLYINGS[8]].length == 4); + assert(underlyingsToCTokens[UNDERLYINGS[9]].length == 1); + + // send out token approvals + _approveCTokens(); } /// @dev Repay all debt @@ -104,6 +118,19 @@ contract FuseFixer is PCVDeposit { } } + function _approveCTokens() internal { + // UNDERLYINGS[0] == ETH, so we skip that one + for (uint256 i = 1; i < UNDERLYINGS.length; i++) { + address underlying = UNDERLYINGS[i]; + address[] memory ctokens = underlyingsToCTokens[underlying]; + + for (uint256 j = 0; j < ctokens.length; j++) { + address ctoken = ctokens[j]; + IERC20(underlying).approve(ctoken, type(uint256).max); + } + } + } + function _repayETH() internal { address[] memory cEtherTokens = underlyingsToCTokens[address(0)]; From 3a8e0be54325fc4de1a16ee644308a91f66d6946 Mon Sep 17 00:00:00 2001 From: thomas-waite Date: Tue, 17 May 2022 22:34:10 +0100 Subject: [PATCH 090/274] feat: add LBP mainnet addresses --- protocol-configuration/mainnetAddresses.ts | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/protocol-configuration/mainnetAddresses.ts b/protocol-configuration/mainnetAddresses.ts index c9daf4ff3..2fb6479bb 100644 --- a/protocol-configuration/mainnetAddresses.ts +++ b/protocol-configuration/mainnetAddresses.ts @@ -176,6 +176,26 @@ const MainnetAddresses: MainnetAddresses = { address: '0x2A188F9EB761F70ECEa083bA6c2A40145078dfc2', category: AddressCategory.Peg }, + dpiToDaiLBPSwapper: { + artifactName: 'BalancerLBPSwapper', + address: '0x05FD907528cf725C6F6d1D28E14619A313513Ba8', + category: AddressCategory.Core + }, + dpiBPTLens: { + artifactName: 'BPTLens', + address: '0x3AA57FAf7114a9ebEbda73a997A35eAE06008A7B', + category: AddressCategory.PCV + }, + daiBptLens: { + artifactName: 'BPTLens', + address: '0xaDdB7eBdCA3fa3b72D2e57c8e660C90ec00af7Cc', + category: AddressCategory.PCV + }, + dpiToDaiLBPPool: { + artifactName: 'ILiquidityBootstrappingPoolFactory', + address: '0xd10386804959a121a8a487e49f45aa9f5a2eb2a0', + category: AddressCategory.PCV + }, aaveEthPCVDeposit: { artifactName: 'AavePCVDeposit', address: '0x5B86887e171bAE0C2C826e87E34Df8D558C079B9', From 8a6e8895cf04abe5a37bea34cd7029d88501e834 Mon Sep 17 00:00:00 2001 From: thomas-waite Date: Tue, 17 May 2022 23:56:47 +0100 Subject: [PATCH 091/274] refactor: complete DAO script --- proposals/dao/fip_105.ts | 12 +++++++--- proposals/description/fip_105.ts | 27 +++++++++++++++++----- protocol-configuration/mainnetAddresses.ts | 4 ++-- 3 files changed, 32 insertions(+), 11 deletions(-) diff --git a/proposals/dao/fip_105.ts b/proposals/dao/fip_105.ts index 312dbc152..1d5d6cf15 100644 --- a/proposals/dao/fip_105.ts +++ b/proposals/dao/fip_105.ts @@ -47,12 +47,15 @@ const deploy: DeployUpgradeFunc = async (deployAddress: string, addresses: Named // DPI: 37888449801955370645659 (95%), 37k DPI, $3,758,957.86 // DAI: 187947000000000000000000 (5%), 187k DAI, $187,947.89 const BalancerLBPSwapperFactory = await ethers.getContractFactory('BalancerLBPSwapper'); + + // Oracle reports DPI price in terms of USD, so should not be inverted + // Specifically reports: 101258471470000000000, which is $101. As expected const dpiToDaiSwapper = await BalancerLBPSwapperFactory.deploy( addresses.core, { _oracle: addresses.chainlinkDpiUsdOracleWrapper, _backupOracle: ethers.constants.AddressZero, - _invertOraclePrice: true, + _invertOraclePrice: false, _decimalsNormalizer: 0 }, LBP_FREQUENCY, @@ -107,7 +110,7 @@ const deploy: DeployUpgradeFunc = async (deployAddress: string, addresses: Named ); await dpiToDaiLensDai.deployTransaction.wait(); - logging && console.log('BPTLens for DPI in swapper pool: ', dpiToDaiLensDai.address); + logging && console.log('BPTLens for DAI in swapper pool: ', dpiToDaiLensDai.address); const dpiToDaiLensDpi = await BPTLensFactory.deploy( addresses.dpi, // token reported in @@ -118,7 +121,7 @@ const deploy: DeployUpgradeFunc = async (deployAddress: string, addresses: Named false // feiIsOther ); - logging && console.log('BPTLens for DAI in swapper pool: ', dpiToDaiLensDpi.address); + logging && console.log('BPTLens for DPI in swapper pool: ', dpiToDaiLensDpi.address); return { daiFixedPricePSMFeiSkimmer, dpiToDaiSwapper, @@ -180,6 +183,9 @@ const validate: ValidateUpgradeFunc = async (addresses, oldContracts, contracts, expect(await daiFixedPricePSMFeiSkimmer.CONTRACT_ADMIN_ROLE()).to.be.equal(ethers.utils.id('PCV_MINOR_PARAM_ROLE')); ///////////// 2. DPI LBP //////////////// + // Verify that Oracle inversion was correctly set + expect(await contracts.dpiToDaiSwapper.doInvert()).to.be.equal(false); + // By this point, the DAO has moved funds to the LBP swapper and the auction should be active console.log('Final DAI PSM dai balance [M]', (await contracts.compoundDaiPCVDeposit.balance()) / 1e24); diff --git a/proposals/description/fip_105.ts b/proposals/description/fip_105.ts index 5a2efd497..eaeb3de07 100644 --- a/proposals/description/fip_105.ts +++ b/proposals/description/fip_105.ts @@ -3,6 +3,7 @@ import { ProposalDescription } from '@custom-types/types'; const fip_105: ProposalDescription = { title: 'FIP-105: Reinforce PCV by consolidating assets and performing technical maintenance', commands: [ + ///////// DAI PSM Skimmer ////////////// { target: 'core', values: '0', @@ -10,6 +11,15 @@ const fip_105: ProposalDescription = { arguments: ['0x0866eae1216ed05a11636a648003f3f62921eb97ccb05acc30636f62958a8bd6', '{daiFixedPricePSMFeiSkimmer}'], description: 'Grant the new DAI PSM Skimmer the PCV_CONTROLLER_ROLE' }, + + //////// DPI LBP //////// + { + target: 'dpiToDaiSwapper', + values: '0', + method: 'setDoInvert(bool)', + arguments: [false], + description: 'Correctly disable inversion in the Swapper DPI to Usd oracle' + }, { target: 'dpi', values: '0', @@ -68,13 +78,18 @@ const fip_105: ProposalDescription = { description: ` FIP-105: Reinforce PCV by consolidating assets and performing technical maintenance - - Transfer DPI and DAI to the LBP swapper. This will be used over the course of a month - to swap DPI for DAI. - - The DAI received will be sent to the Compound DAI deposit, where it can then be dripped to PSM. + This FIP implements part of the PCV reinforcement proposal that was approved in this snapshot: + https://snapshot.fei.money/#/proposal/0x2fd5bdda0067098f6c0520fe309dfe90ca403758f0ce98c1854a00bf38999674 + and discussed in this forum post: https://tribe.fei.money/t/fip-104-fei-pcv-reinforcement-proposal/4162?page=2 + + It liquidates the protocol's DPI holdings to DAI using a Balancer LBP. - Configure a new Fei Skimmer to burn excess DAI from the DAI PSM + In addition, the FIP introduces several technical maintenance tasks: + - Add and remove the relevant PCV deposits from the Collaterization Oracle + - Grant the TribalCouncil the role required to initiate the LBP auction + - Grant a new skimmer contract the role necessary to skim excess Fei from the DAI PSM + - Fix a bug in the NopeDAO configuration that previously set the voting period to 22 months rather than the + expected 4 days ` }; diff --git a/protocol-configuration/mainnetAddresses.ts b/protocol-configuration/mainnetAddresses.ts index 2fb6479bb..b1d10261c 100644 --- a/protocol-configuration/mainnetAddresses.ts +++ b/protocol-configuration/mainnetAddresses.ts @@ -181,12 +181,12 @@ const MainnetAddresses: MainnetAddresses = { address: '0x05FD907528cf725C6F6d1D28E14619A313513Ba8', category: AddressCategory.Core }, - dpiBPTLens: { + daiBPTLens: { artifactName: 'BPTLens', address: '0x3AA57FAf7114a9ebEbda73a997A35eAE06008A7B', category: AddressCategory.PCV }, - daiBptLens: { + dpiBptLens: { artifactName: 'BPTLens', address: '0xaDdB7eBdCA3fa3b72D2e57c8e660C90ec00af7Cc', category: AddressCategory.PCV From e7e2e710a894d6a64acad534aa847830047a0ebe Mon Sep 17 00:00:00 2001 From: thomas-waite Date: Wed, 18 May 2022 00:21:20 +0100 Subject: [PATCH 092/274] refactor: update block num, adjust nopeDAO voting period --- block.txt | 2 +- contracts/dao/nopeDAO/NopeDAO.sol | 2 +- proposals/dao/fip_105.ts | 58 +++++++++++++--------- proposals/description/fip_105.ts | 27 +++++----- protocol-configuration/mainnetAddresses.ts | 2 +- test/integration/proposals_config.ts | 6 +-- 6 files changed, 54 insertions(+), 43 deletions(-) diff --git a/block.txt b/block.txt index 6a23bbc64..81aa07f32 100644 --- a/block.txt +++ b/block.txt @@ -1 +1 @@ -14788265 +14795456 \ No newline at end of file diff --git a/contracts/dao/nopeDAO/NopeDAO.sol b/contracts/dao/nopeDAO/NopeDAO.sol index f2b6576f1..7eb0eba6a 100644 --- a/contracts/dao/nopeDAO/NopeDAO.sol +++ b/contracts/dao/nopeDAO/NopeDAO.sol @@ -28,7 +28,7 @@ contract NopeDAO is Governor("NopeDAO") GovernorSettings( 0, /* 0 blocks */ - 4 days, + 26585, /* 4 days measured in blocks. Assumed 13s block time */ 0 ) GovernorVotesComp(_tribe) diff --git a/proposals/dao/fip_105.ts b/proposals/dao/fip_105.ts index 1d5d6cf15..8d87a3b68 100644 --- a/proposals/dao/fip_105.ts +++ b/proposals/dao/fip_105.ts @@ -17,7 +17,9 @@ const toBN = ethers.BigNumber.from; DAO Proposal #105 -Description: Deploy a Fei skimmer for the DAI PSM +1. Deploy Fei Skimmer and grant it PCV_CONTROLLER +2. Deploy Balancer LBP and initialise auction of DPI for DAI +3. Fix NopeDAO voting period */ // LBP Swapper config @@ -55,7 +57,7 @@ const deploy: DeployUpgradeFunc = async (deployAddress: string, addresses: Named { _oracle: addresses.chainlinkDpiUsdOracleWrapper, _backupOracle: ethers.constants.AddressZero, - _invertOraclePrice: false, + _invertOraclePrice: true, _decimalsNormalizer: 0 }, LBP_FREQUENCY, @@ -100,7 +102,7 @@ const deploy: DeployUpgradeFunc = async (deployAddress: string, addresses: Named // 4. Deploy a lens to report the swapper value const BPTLensFactory = await ethers.getContractFactory('BPTLens'); - const dpiToDaiLensDai = await BPTLensFactory.deploy( + const daiBPTLens = await BPTLensFactory.deploy( addresses.dai, // token reported in noFeeDpiDaiLBPAddress, // pool address addresses.chainlinkDaiUsdOracleWrapper, // reportedOracle - DAI @@ -108,11 +110,11 @@ const deploy: DeployUpgradeFunc = async (deployAddress: string, addresses: Named false, // feiIsReportedIn false // feiIsOther ); - await dpiToDaiLensDai.deployTransaction.wait(); + await daiBPTLens.deployTransaction.wait(); - logging && console.log('BPTLens for DAI in swapper pool: ', dpiToDaiLensDai.address); + logging && console.log('BPTLens for DAI in swapper pool: ', daiBPTLens.address); - const dpiToDaiLensDpi = await BPTLensFactory.deploy( + const dpiBPTLens = await BPTLensFactory.deploy( addresses.dpi, // token reported in noFeeDpiDaiLBPAddress, // pool address addresses.chainlinkDpiUsdOracleWrapper, // reportedOracle - DPI @@ -120,13 +122,14 @@ const deploy: DeployUpgradeFunc = async (deployAddress: string, addresses: Named false, // feiIsReportedIn false // feiIsOther ); + await dpiBPTLens.deployTransaction.wait(); - logging && console.log('BPTLens for DPI in swapper pool: ', dpiToDaiLensDpi.address); + logging && console.log('BPTLens for DPI in swapper pool: ', dpiBPTLens.address); return { daiFixedPricePSMFeiSkimmer, dpiToDaiSwapper, - dpiToDaiLensDai, - dpiToDaiLensDpi + daiBPTLens, + dpiBPTLens }; }; @@ -134,13 +137,16 @@ const deploy: DeployUpgradeFunc = async (deployAddress: string, addresses: Named // This could include setting up Hardhat to impersonate accounts, // ensuring contracts have a specific state, etc. const setup: SetupUpgradeFunc = async (addresses, oldContracts, contracts, logging) => { + poolId = '0xd10386804959a121a8a487e49f45aa9f5a2eb2a00002000000000000000001f1'; // overwrite chainlink ETH/USD oracle + const dpiToDaiLBPSwapper = contracts.dpiToDaiLBPSwapper; await overwriteChainlinkAggregator(addresses.chainlinkEthUsdOracle, '250000000000', '8'); // invariant checks - expect(await contracts.dpiToDaiSwapper.tokenSpent()).to.be.equal(addresses.dpi); - expect(await contracts.dpiToDaiSwapper.tokenReceived()).to.be.equal(addresses.dai); - expect(await contracts.dpiToDaiSwapper.tokenReceivingAddress()).to.be.equal(addresses.compoundDaiPCVDeposit); + expect(await dpiToDaiLBPSwapper.tokenSpent()).to.be.equal(addresses.dpi); + expect(await dpiToDaiLBPSwapper.tokenReceived()).to.be.equal(addresses.dai); + expect(await dpiToDaiLBPSwapper.tokenReceivingAddress()).to.be.equal(addresses.compoundDaiPCVDeposit); + const poolTokens = await contracts.balancerVault.getPoolTokens(poolId); expect(poolTokens.tokens[0]).to.be.equal(addresses.dpi); expect(poolTokens.tokens[1]).to.be.equal(addresses.dai); @@ -150,12 +156,12 @@ const setup: SetupUpgradeFunc = async (addresses, oldContracts, contracts, loggi expect(poolTokens.balances[1]).to.be.equal('0'); // Lenses should report 0 because LBP is empty - expect(await contracts.dpiToDaiLensDai.balance()).to.be.equal('0'); - expect(await contracts.dpiToDaiLensDpi.balance()).to.be.equal('0'); + expect(await contracts.daiBPTLens.balance()).to.be.equal('0'); + expect(await contracts.dpiBPTLens.balance()).to.be.equal('0'); // Swapper should hold no tokens - expect(await contracts.dpi.balanceOf(contracts.dpiToDaiSwapper.address)).to.be.equal('0'); - expect(await contracts.dai.balanceOf(contracts.dpiToDaiSwapper.address)).to.be.equal('0'); + expect(await contracts.dpi.balanceOf(dpiToDaiLBPSwapper.address)).to.be.equal('0'); + expect(await contracts.dai.balanceOf(dpiToDaiLBPSwapper.address)).to.be.equal('0'); console.log('Starting DAI PSM dai balance [M]', (await contracts.compoundDaiPCVDeposit.balance()) / 1e24); @@ -171,8 +177,10 @@ const teardown: TeardownUpgradeFunc = async (addresses, oldContracts, contracts, // Run any validations required on the fip using mocha or console logging // IE check balances, check state of contracts, etc. const validate: ValidateUpgradeFunc = async (addresses, oldContracts, contracts, logging) => { + poolId = '0xd10386804959a121a8a487e49f45aa9f5a2eb2a00002000000000000000001f1'; //////////// 1. DAI FEI SKIMMER ////////////// const daiFixedPricePSMFeiSkimmer = contracts.daiFixedPricePSMFeiSkimmer; + const dpiToDaiLBPSwapper = contracts.dpiToDaiLBPSwapper; const core = contracts.core; expect(await daiFixedPricePSMFeiSkimmer.threshold()).to.be.equal(skimThreshold); @@ -183,25 +191,27 @@ const validate: ValidateUpgradeFunc = async (addresses, oldContracts, contracts, expect(await daiFixedPricePSMFeiSkimmer.CONTRACT_ADMIN_ROLE()).to.be.equal(ethers.utils.id('PCV_MINOR_PARAM_ROLE')); ///////////// 2. DPI LBP //////////////// - // Verify that Oracle inversion was correctly set - expect(await contracts.dpiToDaiSwapper.doInvert()).to.be.equal(false); + expect(await dpiToDaiLBPSwapper.doInvert()).to.be.equal(true); // By this point, the DAO has moved funds to the LBP swapper and the auction should be active console.log('Final DAI PSM dai balance [M]', (await contracts.compoundDaiPCVDeposit.balance()) / 1e24); - expect(await contracts.dpi.balanceOf(contracts.dpiToDaiSwapper.address)).to.be.equal(dpiSeedAmount); - expect(await contracts.dai.balanceOf(contracts.dpiToDaiSwapper.address)).to.be.equal(daiSeedAmount); + expect(await contracts.dpi.balanceOf(dpiToDaiLBPSwapper.address)).to.be.equal(dpiSeedAmount); + expect(await contracts.dai.balanceOf(dpiToDaiLBPSwapper.address)).to.be.equal(daiSeedAmount); - await time.increase(await contracts.dpiToDaiSwapper.remainingTime()); - expect(await contracts.dpiToDaiSwapper.isTimeEnded()).to.be.true; + await time.increase(await dpiToDaiLBPSwapper.remainingTime()); + expect(await dpiToDaiLBPSwapper.isTimeEnded()).to.be.true; // Validate SWAP_ADMIN_ROLE is under ROLE_ADMIN and that TribalCouncilTimelock has the role expect(await core.hasRole(ethers.utils.id('SWAP_ADMIN_ROLE'), addresses.tribalCouncilTimelock)).to.be.true; expect(await core.getRoleAdmin(ethers.utils.id('SWAP_ADMIN_ROLE'))).to.be.equal(ethers.utils.id('ROLE_ADMIN')); const signer = await getImpersonatedSigner(addresses.tribalCouncilTimelock); // TODO: TribalCouncil should grant itself SWAP_ADMIN_ROLE - await contracts.dpiToDaiSwapper.connect(signer).swap(); - expect(await contracts.dpiToDaiSwapper.isTimeEnded()).to.be.false; + await dpiToDaiLBPSwapper.connect(signer).swap(); + expect(await dpiToDaiLBPSwapper.isTimeEnded()).to.be.false; + + //////// 3. Nope DAO Voting Period fix ///////////// + expect(await contracts.nopeDAO.votingPeriod()).to.be.equal(26585); }; export { deploy, setup, teardown, validate }; diff --git a/proposals/description/fip_105.ts b/proposals/description/fip_105.ts index eaeb3de07..b0bffa1ae 100644 --- a/proposals/description/fip_105.ts +++ b/proposals/description/fip_105.ts @@ -13,39 +13,32 @@ const fip_105: ProposalDescription = { }, //////// DPI LBP //////// - { - target: 'dpiToDaiSwapper', - values: '0', - method: 'setDoInvert(bool)', - arguments: [false], - description: 'Correctly disable inversion in the Swapper DPI to Usd oracle' - }, { target: 'dpi', values: '0', method: 'transfer(address,uint256)', - arguments: ['{dpiToDaiSwapper}', '37888449801955370645659'], + arguments: ['{dpiToDaiLBPSwapper}', '37888449801955370645659'], description: 'Transfer DPI from DAO timelock to the LBP pool' }, { target: 'compoundDaiPCVDeposit', values: '0', method: 'withdraw(address,uint256)', - arguments: ['{dpiToDaiSwapper}', '187947000000000000000000'], + arguments: ['{dpiToDaiLBPSwapper}', '187947000000000000000000'], description: 'Withdraw Use the PCVGuardian to transfer DAI from the CompoundPCVDeposit to the LBP pool' }, { target: 'collateralizationOracle', values: '0', method: 'addDeposit(address)', - arguments: ['{dpiToDaiLensDai}'], + arguments: ['{daiBPTLens}'], description: 'Add DAI swapper lens to the CR oracle' }, { target: 'collateralizationOracle', values: '0', method: 'addDeposit(address)', - arguments: ['{dpiToDaiLensDpi}'], + arguments: ['{dpiBPTLens}'], description: 'Add DPI swapper lens to the CR oracle' }, { @@ -54,7 +47,6 @@ const fip_105: ProposalDescription = { method: 'removeDeposits(address[])', arguments: [ [ - '{dpiDepositWrapper}', '{rariPool31FeiPCVDepositWrapper}', '{rariPool25FeiPCVDepositWrapper}', '{rariPool9RaiPCVDepositWrapper}', @@ -62,7 +54,8 @@ const fip_105: ProposalDescription = { '{rariPool19DpiPCVDepositWrapper}', '{liquityFusePoolLusdPCVDeposit}', '{rariPool72FeiPCVDepositWrapper}', - '{raiDepositWrapper}' + '{raiDepositWrapper}', + '{dpiDepositWrapper}' ] ], description: 'Remove DPI Deposit wrapper from CR oracle, as now empty' @@ -73,6 +66,14 @@ const fip_105: ProposalDescription = { method: 'grantRole(bytes32,address)', arguments: ['0x471cfe1a44bf1b786db7d7104d51e6728ed7b90a35394ad7cc424adf8ed16816', '{tribalCouncilTimelock}'], description: 'Grant TribalCouncilTimelock SWAP_ADMIN_ROLE so it can initiate the LBP swap' + }, + /////////// Nope DAO ///////// + { + target: 'nopeDAO', + values: '0', + method: 'setVotingPeriod(uint256)', + arguments: ['26585'], // (86400 * 4) / 13 seconds (assumed 13s block time) + description: 'Set the voting period for the NopeDAO to 4 days' } ], description: ` diff --git a/protocol-configuration/mainnetAddresses.ts b/protocol-configuration/mainnetAddresses.ts index b1d10261c..19cb812d9 100644 --- a/protocol-configuration/mainnetAddresses.ts +++ b/protocol-configuration/mainnetAddresses.ts @@ -186,7 +186,7 @@ const MainnetAddresses: MainnetAddresses = { address: '0x3AA57FAf7114a9ebEbda73a997A35eAE06008A7B', category: AddressCategory.PCV }, - dpiBptLens: { + dpiBPTLens: { artifactName: 'BPTLens', address: '0xaDdB7eBdCA3fa3b72D2e57c8e660C90ec00af7Cc', category: AddressCategory.PCV diff --git a/test/integration/proposals_config.ts b/test/integration/proposals_config.ts index f10ee0602..b05aaaf35 100644 --- a/test/integration/proposals_config.ts +++ b/test/integration/proposals_config.ts @@ -14,9 +14,9 @@ const proposals: ProposalsConfigMap = { 'core', 'dpi', 'compoundDaiPCVDeposit', - 'dpiToDaiSwapper', - 'dpiToDaiLensDai', - 'dpiToDaiLensDpi' + 'dpiToDaiLBPSwapper', + 'daiBPTLens', + 'dpiBPTLens' ], deprecatedContractSignoff: [ 'rariPool31FeiPCVDepositWrapper', From 629e63f2638476e276babe33b0a7353b50c3a1fb Mon Sep 17 00:00:00 2001 From: thomas-waite Date: Wed, 18 May 2022 01:12:27 +0100 Subject: [PATCH 093/274] feat: transfer CREAM to TC --- hardhat.config.ts | 3 +-- proposals/dao/fip_105.ts | 5 +++++ proposals/description/fip_105.ts | 11 ++++++++++- test/integration/tests/pcv.ts | 2 +- 4 files changed, 17 insertions(+), 4 deletions(-) diff --git a/hardhat.config.ts b/hardhat.config.ts index b741a76d4..6a68d2c71 100644 --- a/hardhat.config.ts +++ b/hardhat.config.ts @@ -23,7 +23,6 @@ const runAllTests = process.env.RUN_ALL_TESTS; const useJSONTestReporter = process.env.REPORT_TEST_RESULTS_AS_JSON; const etherscanKey = process.env.ETHERSCAN_API_KEY; const forkBlock = process.env.FORK_BLOCK; -const mainnetRpcURL = process.env.MAINNET_RPC_URL; if (!(process.env.NODE_OPTIONS && process.env.NODE_OPTIONS.includes('max-old-space-size'))) { throw new Error( @@ -74,7 +73,7 @@ export default { }, mainnet: { - url: mainnetRpcURL, + url: `https://eth-mainnet.alchemyapi.io/v2/${mainnetAlchemyApiKey}`, accounts: privateKey ? [privateKey] : [], gasPrice: 70000000000 } diff --git a/proposals/dao/fip_105.ts b/proposals/dao/fip_105.ts index 8d87a3b68..5a124f015 100644 --- a/proposals/dao/fip_105.ts +++ b/proposals/dao/fip_105.ts @@ -20,6 +20,7 @@ DAO Proposal #105 1. Deploy Fei Skimmer and grant it PCV_CONTROLLER 2. Deploy Balancer LBP and initialise auction of DPI for DAI 3. Fix NopeDAO voting period +4. Transfer CREAM to TribalCouncil multisig, where it will then be sold to ETH */ // LBP Swapper config @@ -212,6 +213,10 @@ const validate: ValidateUpgradeFunc = async (addresses, oldContracts, contracts, //////// 3. Nope DAO Voting Period fix ///////////// expect(await contracts.nopeDAO.votingPeriod()).to.be.equal(26585); + + /////// 4. CREAM transferred to TribalCouncil multisig //////// + const creamAmount = '31780370000000000000000'; + expect(await contracts.cream.balanceOf(addresses.tribalCouncilSafe)).to.be.equal(toBN(creamAmount)); }; export { deploy, setup, teardown, validate }; diff --git a/proposals/description/fip_105.ts b/proposals/description/fip_105.ts index b0bffa1ae..11ffe32ed 100644 --- a/proposals/description/fip_105.ts +++ b/proposals/description/fip_105.ts @@ -74,6 +74,14 @@ const fip_105: ProposalDescription = { method: 'setVotingPeriod(uint256)', arguments: ['26585'], // (86400 * 4) / 13 seconds (assumed 13s block time) description: 'Set the voting period for the NopeDAO to 4 days' + }, + //////// Transfer CREAM to TribalCouncil Multisig ///////// + { + target: 'cream', + values: '0', + method: 'transfer(address,uint256)', + arguments: ['{tribalCouncilSafe}', '31780370000000000000000'], + description: 'Transfer CREAM to TribalCouncil multisig where it will then be swapped' } ], description: ` @@ -83,7 +91,8 @@ const fip_105: ProposalDescription = { https://snapshot.fei.money/#/proposal/0x2fd5bdda0067098f6c0520fe309dfe90ca403758f0ce98c1854a00bf38999674 and discussed in this forum post: https://tribe.fei.money/t/fip-104-fei-pcv-reinforcement-proposal/4162?page=2 - It liquidates the protocol's DPI holdings to DAI using a Balancer LBP. + Specifically, it liquidates the protocol's DPI holdings to DAI using a Balancer LBP and it transfers the protocol's + CREAM holdings to the TribalCouncil multisig. The TribalCouncil will then be able to liquidate the position on a DEX. In addition, the FIP introduces several technical maintenance tasks: - Add and remove the relevant PCV deposits from the Collaterization Oracle diff --git a/test/integration/tests/pcv.ts b/test/integration/tests/pcv.ts index d7d1da822..0e0ff263a 100644 --- a/test/integration/tests/pcv.ts +++ b/test/integration/tests/pcv.ts @@ -54,7 +54,7 @@ describe('e2e-pcv', function () { }); describe('BAMM', function () { - it.only('should be able to withdraw LUSD from B.AMM', async function () { + it('should be able to withdraw LUSD from B.AMM', async function () { // set Chainlink ETHUSD to a fixed 4,000$ value await overwriteChainlinkAggregator(contractAddresses.chainlinkEthUsdOracle, '400000000000', '8'); From 74615f8dea1a7aa8261117383d9bef6651118a8d Mon Sep 17 00:00:00 2001 From: thomas-waite Date: Wed, 18 May 2022 01:33:17 +0100 Subject: [PATCH 094/274] refactor: fund council with 10 eth --- contracts/test/unit/governance/NopeDAO.t.sol | 2 +- proposals/dao/fip_105.ts | 24 ++++++++++++-------- proposals/description/fip_105.ts | 21 ++++++++++++----- protocol-configuration/mainnetAddresses.ts | 4 ++-- test/integration/proposals_config.ts | 4 ++-- 5 files changed, 34 insertions(+), 21 deletions(-) diff --git a/contracts/test/unit/governance/NopeDAO.t.sol b/contracts/test/unit/governance/NopeDAO.t.sol index 04443b976..4b705ec54 100644 --- a/contracts/test/unit/governance/NopeDAO.t.sol +++ b/contracts/test/unit/governance/NopeDAO.t.sol @@ -77,7 +77,7 @@ contract NopeDAOTest is DSTest { assertEq(votingDelay, 0); uint256 votingPeriod = nopeDAO.votingPeriod(); - uint256 fourDays = 86400 * 4; + uint256 fourDays = 26585; // (86400 * 4) / 13 assertEq(votingPeriod, fourDays); uint256 proposalThreshold = nopeDAO.proposalThreshold(); diff --git a/proposals/dao/fip_105.ts b/proposals/dao/fip_105.ts index 5a124f015..cae8fec8c 100644 --- a/proposals/dao/fip_105.ts +++ b/proposals/dao/fip_105.ts @@ -103,7 +103,7 @@ const deploy: DeployUpgradeFunc = async (deployAddress: string, addresses: Named // 4. Deploy a lens to report the swapper value const BPTLensFactory = await ethers.getContractFactory('BPTLens'); - const daiBPTLens = await BPTLensFactory.deploy( + const dpiToDaiLensDai = await BPTLensFactory.deploy( addresses.dai, // token reported in noFeeDpiDaiLBPAddress, // pool address addresses.chainlinkDaiUsdOracleWrapper, // reportedOracle - DAI @@ -111,11 +111,11 @@ const deploy: DeployUpgradeFunc = async (deployAddress: string, addresses: Named false, // feiIsReportedIn false // feiIsOther ); - await daiBPTLens.deployTransaction.wait(); + await dpiToDaiLensDai.deployTransaction.wait(); - logging && console.log('BPTLens for DAI in swapper pool: ', daiBPTLens.address); + logging && console.log('BPTLens for DAI in swapper pool: ', dpiToDaiLensDai.address); - const dpiBPTLens = await BPTLensFactory.deploy( + const dpiToDaiLensDpi = await BPTLensFactory.deploy( addresses.dpi, // token reported in noFeeDpiDaiLBPAddress, // pool address addresses.chainlinkDpiUsdOracleWrapper, // reportedOracle - DPI @@ -123,14 +123,14 @@ const deploy: DeployUpgradeFunc = async (deployAddress: string, addresses: Named false, // feiIsReportedIn false // feiIsOther ); - await dpiBPTLens.deployTransaction.wait(); + await dpiToDaiLensDpi.deployTransaction.wait(); - logging && console.log('BPTLens for DPI in swapper pool: ', dpiBPTLens.address); + logging && console.log('BPTLens for DPI in swapper pool: ', dpiToDaiLensDpi.address); return { daiFixedPricePSMFeiSkimmer, dpiToDaiSwapper, - daiBPTLens, - dpiBPTLens + dpiToDaiLensDai, + dpiToDaiLensDpi }; }; @@ -157,8 +157,8 @@ const setup: SetupUpgradeFunc = async (addresses, oldContracts, contracts, loggi expect(poolTokens.balances[1]).to.be.equal('0'); // Lenses should report 0 because LBP is empty - expect(await contracts.daiBPTLens.balance()).to.be.equal('0'); - expect(await contracts.dpiBPTLens.balance()).to.be.equal('0'); + expect(await contracts.dpiToDaiLensDai.balance()).to.be.equal('0'); + expect(await contracts.dpiToDaiLensDpi.balance()).to.be.equal('0'); // Swapper should hold no tokens expect(await contracts.dpi.balanceOf(dpiToDaiLBPSwapper.address)).to.be.equal('0'); @@ -217,6 +217,10 @@ const validate: ValidateUpgradeFunc = async (addresses, oldContracts, contracts, /////// 4. CREAM transferred to TribalCouncil multisig //////// const creamAmount = '31780370000000000000000'; expect(await contracts.cream.balanceOf(addresses.tribalCouncilSafe)).to.be.equal(toBN(creamAmount)); + + /////// 5. Fund TribalCouncil with 10 Eth ////////// + const provider = contracts.tribalCouncilSafe.provider; + expect(await provider.getBalance(addresses.tribalCouncilSafe)).to.be.equal(ethers.utils.parseEther('10')); }; export { deploy, setup, teardown, validate }; diff --git a/proposals/description/fip_105.ts b/proposals/description/fip_105.ts index 11ffe32ed..e22d66c45 100644 --- a/proposals/description/fip_105.ts +++ b/proposals/description/fip_105.ts @@ -31,14 +31,14 @@ const fip_105: ProposalDescription = { target: 'collateralizationOracle', values: '0', method: 'addDeposit(address)', - arguments: ['{daiBPTLens}'], + arguments: ['{dpiToDaiLensDai}'], description: 'Add DAI swapper lens to the CR oracle' }, { target: 'collateralizationOracle', values: '0', method: 'addDeposit(address)', - arguments: ['{dpiBPTLens}'], + arguments: ['{dpiToDaiLensDpi}'], description: 'Add DPI swapper lens to the CR oracle' }, { @@ -82,24 +82,33 @@ const fip_105: ProposalDescription = { method: 'transfer(address,uint256)', arguments: ['{tribalCouncilSafe}', '31780370000000000000000'], description: 'Transfer CREAM to TribalCouncil multisig where it will then be swapped' + }, + //////// Fund Council ////////// + { + target: 'compoundEthPCVDepositWrapper', + values: '0', + method: 'withdraw(address,uint256)', + arguments: ['{tribalCouncilSafe}', '10000000000000000000'], + description: 'Fund TribalCouncil with 10 Eth' } ], description: ` - FIP-105: Reinforce PCV by consolidating assets and performing technical maintenance + FIP-105: Reinforce PCV by consolidating assets and performing technical maintenance. - This FIP implements part of the PCV reinforcement proposal that was approved in this snapshot: + This FIP implements parts of the PCV reinforcement proposal that was approved in this snapshot: https://snapshot.fei.money/#/proposal/0x2fd5bdda0067098f6c0520fe309dfe90ca403758f0ce98c1854a00bf38999674 and discussed in this forum post: https://tribe.fei.money/t/fip-104-fei-pcv-reinforcement-proposal/4162?page=2 Specifically, it liquidates the protocol's DPI holdings to DAI using a Balancer LBP and it transfers the protocol's CREAM holdings to the TribalCouncil multisig. The TribalCouncil will then be able to liquidate the position on a DEX. - In addition, the FIP introduces several technical maintenance tasks: + In addition, the FIP performs several technical maintenance tasks: - Add and remove the relevant PCV deposits from the Collaterization Oracle - - Grant the TribalCouncil the role required to initiate the LBP auction + - Grant the TribalCouncil the role required to initiate the DPI LBP auction - Grant a new skimmer contract the role necessary to skim excess Fei from the DAI PSM - Fix a bug in the NopeDAO configuration that previously set the voting period to 22 months rather than the expected 4 days + - Fund the TribalCouncil with 10 eth ` }; diff --git a/protocol-configuration/mainnetAddresses.ts b/protocol-configuration/mainnetAddresses.ts index 19cb812d9..24e00ab99 100644 --- a/protocol-configuration/mainnetAddresses.ts +++ b/protocol-configuration/mainnetAddresses.ts @@ -181,12 +181,12 @@ const MainnetAddresses: MainnetAddresses = { address: '0x05FD907528cf725C6F6d1D28E14619A313513Ba8', category: AddressCategory.Core }, - daiBPTLens: { + dpiToDaiLensDai: { artifactName: 'BPTLens', address: '0x3AA57FAf7114a9ebEbda73a997A35eAE06008A7B', category: AddressCategory.PCV }, - dpiBPTLens: { + dpiToDaiLensDpi: { artifactName: 'BPTLens', address: '0xaDdB7eBdCA3fa3b72D2e57c8e660C90ec00af7Cc', category: AddressCategory.PCV diff --git a/test/integration/proposals_config.ts b/test/integration/proposals_config.ts index b05aaaf35..ce3bcee9b 100644 --- a/test/integration/proposals_config.ts +++ b/test/integration/proposals_config.ts @@ -15,8 +15,8 @@ const proposals: ProposalsConfigMap = { 'dpi', 'compoundDaiPCVDeposit', 'dpiToDaiLBPSwapper', - 'daiBPTLens', - 'dpiBPTLens' + 'dpiToDaiLensDai', + 'dpiToDaiLensDpi' ], deprecatedContractSignoff: [ 'rariPool31FeiPCVDepositWrapper', From c56553ac59213cf39199f93b29f395dd762d0439 Mon Sep 17 00:00:00 2001 From: thomas-waite Date: Wed, 18 May 2022 02:11:23 +0100 Subject: [PATCH 095/274] refactor: sort dependencies --- proposals/dao/fip_105.ts | 6 +- proposals/description/fip_105.ts | 2 +- protocol-configuration/dependencies.ts | 78 +++------------------- protocol-configuration/mainnetAddresses.ts | 2 +- test/integration/proposals_config.ts | 8 ++- 5 files changed, 23 insertions(+), 73 deletions(-) diff --git a/proposals/dao/fip_105.ts b/proposals/dao/fip_105.ts index cae8fec8c..8122eaa7c 100644 --- a/proposals/dao/fip_105.ts +++ b/proposals/dao/fip_105.ts @@ -219,8 +219,10 @@ const validate: ValidateUpgradeFunc = async (addresses, oldContracts, contracts, expect(await contracts.cream.balanceOf(addresses.tribalCouncilSafe)).to.be.equal(toBN(creamAmount)); /////// 5. Fund TribalCouncil with 10 Eth ////////// - const provider = contracts.tribalCouncilSafe.provider; - expect(await provider.getBalance(addresses.tribalCouncilSafe)).to.be.equal(ethers.utils.parseEther('10')); + const ethersSigner = (await ethers.getSigners())[0]; + expect(await ethersSigner.provider.getBalance(addresses.tribalCouncilSafe)).to.be.equal( + ethers.utils.parseEther('10') + ); }; export { deploy, setup, teardown, validate }; diff --git a/proposals/description/fip_105.ts b/proposals/description/fip_105.ts index e22d66c45..d2087b315 100644 --- a/proposals/description/fip_105.ts +++ b/proposals/description/fip_105.ts @@ -85,7 +85,7 @@ const fip_105: ProposalDescription = { }, //////// Fund Council ////////// { - target: 'compoundEthPCVDepositWrapper', + target: 'compoundEthPCVDeposit', values: '0', method: 'withdraw(address,uint256)', arguments: ['{tribalCouncilSafe}', '10000000000000000000'], diff --git a/protocol-configuration/dependencies.ts b/protocol-configuration/dependencies.ts index 8247a6c49..423105767 100644 --- a/protocol-configuration/dependencies.ts +++ b/protocol-configuration/dependencies.ts @@ -35,6 +35,7 @@ const dependencies: DependencyMap = { 'collateralizationOracleGuardian', 'fei', 'feiTribeLBPSwapper', + 'dpiToDaiLBPSwapper', 'optimisticMinter', 'pcvEquityMinter', 'pcvGuardianNew', @@ -56,7 +57,6 @@ const dependencies: DependencyMap = { 'tribeReserveStabilizer', 'aaveEthPCVDeposit', 'aaveFeiPCVDeposit', - 'aaveRaiPCVDeposit', 'agEurAngleUniswapPCVDeposit', 'agEurUniswapPCVDeposit', 'balancerDepositBalWeth', @@ -70,28 +70,22 @@ const dependencies: DependencyMap = { 'indexCoopFusePoolDpiPCVDeposit', 'indexCoopFusePoolFeiPCVDeposit', 'indexDelegator', - 'liquityFusePoolLusdPCVDeposit', 'poolPartyFeiPCVDeposit', 'rariTimelock', 'rariPool18FeiPCVDeposit', - 'rariPool19DpiPCVDeposit', 'rariPool19FeiPCVDeposit', 'rariPool22FeiPCVDeposit', 'rariPool24FeiPCVDeposit', - 'rariPool25FeiPCVDeposit', 'rariPool26FeiPCVDeposit', 'rariPool27FeiPCVDeposit', - 'rariPool31FeiPCVDeposit', 'rariPool54FeiPCVDeposit', 'rariPool6FeiPCVDeposit', - 'rariPool72FeiPCVDeposit', 'rariPool79FeiPCVDeposit', 'rariPool7FeiPCVDeposit', 'rariPool7LusdPCVDeposit', 'rariPool8FeiPCVDeposit', 'rariPool91FeiPCVDeposit', 'rariPool9FeiPCVDeposit', - 'rariPool9RaiPCVDeposit', 'reflexerStableAssetFusePoolRaiPCVDeposit', 'tokeTokemakPCVDeposit', 'uniswapPCVDeposit', @@ -158,13 +152,10 @@ const dependencies: DependencyMap = { 'rariPool19FeiPCVDeposit', 'rariPool22FeiPCVDeposit', 'rariPool24FeiPCVDeposit', - 'rariPool25FeiPCVDeposit', 'rariPool26FeiPCVDeposit', 'rariPool27FeiPCVDeposit', - 'rariPool31FeiPCVDeposit', 'rariPool54FeiPCVDeposit', 'rariPool6FeiPCVDeposit', - 'rariPool72FeiPCVDeposit', 'rariPool79FeiPCVDeposit', 'rariPool7FeiPCVDeposit', 'rariPool8FeiPCVDeposit', @@ -203,7 +194,6 @@ const dependencies: DependencyMap = { 'daiFixedPricePSM', 'compoundEthPCVDeposit', 'aaveEthPCVDeposit', - 'aaveRaiPCVDeposit', 'raiPriceBoundPSM' ] }, @@ -253,8 +243,6 @@ const dependencies: DependencyMap = { 'proxyAdmin', 'creamDepositWrapper', 'wethDepositWrapper', - 'dpiDepositWrapper', - 'raiDepositWrapper', 'agEurDepositWrapper', 'aaveTribeIncentivesController', 'tribeMinter', @@ -302,7 +290,7 @@ const dependencies: DependencyMap = { contractDependencies: ['core', 'fei', 'daiFixedPricePSM', 'compoundDaiPCVDeposit'] }, raiPCVDripController: { - contractDependencies: ['core', 'fei', 'aaveRaiPCVDeposit', 'raiPriceBoundPSM'] + contractDependencies: ['core', 'fei', 'raiPriceBoundPSM'] }, daiFixedPricePSM: { contractDependencies: [ @@ -355,9 +343,6 @@ const dependencies: DependencyMap = { aaveFeiPCVDeposit: { contractDependencies: ['core', 'fei'] }, - aaveRaiPCVDeposit: { - contractDependencies: ['core', 'pcvGuardianNew', 'raiPCVDripController'] - }, agEurAngleUniswapPCVDeposit: { contractDependencies: ['core', 'fei', 'chainlinkEurUsdOracleWrapper'] }, @@ -397,9 +382,6 @@ const dependencies: DependencyMap = { indexDelegator: { contractDependencies: ['core'] }, - liquityFusePoolLusdPCVDeposit: { - contractDependencies: ['core'] - }, poolPartyFeiPCVDeposit: { contractDependencies: ['core', 'fei'] }, @@ -415,9 +397,6 @@ const dependencies: DependencyMap = { rariPool18FeiPCVDeposit: { contractDependencies: ['core', 'fei'] }, - rariPool19DpiPCVDeposit: { - contractDependencies: ['core'] - }, rariPool19FeiPCVDeposit: { contractDependencies: ['core', 'fei'] }, @@ -427,27 +406,18 @@ const dependencies: DependencyMap = { rariPool24FeiPCVDeposit: { contractDependencies: ['core', 'fei'] }, - rariPool25FeiPCVDeposit: { - contractDependencies: ['core', 'fei'] - }, rariPool26FeiPCVDeposit: { contractDependencies: ['core', 'fei'] }, rariPool27FeiPCVDeposit: { contractDependencies: ['core', 'fei'] }, - rariPool31FeiPCVDeposit: { - contractDependencies: ['core', 'fei', 'rariPool31FeiPCVDepositWrapper'] - }, rariPool54FeiPCVDeposit: { contractDependencies: ['core', 'fei'] }, rariPool6FeiPCVDeposit: { contractDependencies: ['core', 'fei'] }, - rariPool72FeiPCVDeposit: { - contractDependencies: ['core', 'fei', 'rariPool72FeiPCVDepositWrapper'] - }, rariPool79FeiPCVDeposit: { contractDependencies: ['core', 'fei', 'rariPool79FeiPCVDepositWrapper'] }, @@ -466,9 +436,6 @@ const dependencies: DependencyMap = { rariPool9FeiPCVDeposit: { contractDependencies: ['core', 'fei'] }, - rariPool9RaiPCVDeposit: { - contractDependencies: ['core'] - }, reflexerStableAssetFusePoolRaiPCVDeposit: { contractDependencies: ['core'] }, @@ -484,9 +451,6 @@ const dependencies: DependencyMap = { aaveFeiPCVDepositWrapper: { contractDependencies: ['collateralizationOracle'] }, - aaveRaiPCVDepositWrapper: { - contractDependencies: ['collateralizationOracle'] - }, collateralizationOracle: { contractDependencies: [ 'core', @@ -503,27 +467,19 @@ const dependencies: DependencyMap = { 'zeroConstantOracle', 'aaveEthPCVDepositWrapper', 'aaveFeiPCVDepositWrapper', - 'aaveRaiPCVDepositWrapper', 'compoundDaiPCVDepositWrapper', 'compoundEthPCVDepositWrapper', 'creamDepositWrapper', 'wethDepositWrapper', - 'dpiDepositWrapper', - 'raiDepositWrapper', 'agEurDepositWrapper', 'ethLidoPCVDepositWrapper', 'feiBuybackLens', 'feiLusdLens', 'feiOATimelockWrapper', - 'rariPool19DpiPCVDepositWrapper', 'rariPool19FeiPCVDepositWrapper', 'rariPool24FeiPCVDepositWrapper', - 'rariPool25FeiPCVDepositWrapper', - 'rariPool31FeiPCVDepositWrapper', 'rariPool6FeiPCVDepositWrapper', - 'rariPool9RaiPCVDepositWrapper', 'rariPool79FeiPCVDepositWrapper', - 'rariPool72FeiPCVDepositWrapper', 'rariPool128FeiPCVDepositWrapper', 'rariPool22FeiPCVDepositWrapper', 'voltFusePCVDeposit', @@ -559,12 +515,6 @@ const dependencies: DependencyMap = { wethDepositWrapper: { contractDependencies: ['feiDAOTimelock', 'collateralizationOracle'] }, - dpiDepositWrapper: { - contractDependencies: ['feiDAOTimelock', 'collateralizationOracle'] - }, - raiDepositWrapper: { - contractDependencies: ['feiDAOTimelock', 'collateralizationOracle'] - }, agEurDepositWrapper: { contractDependencies: ['feiDAOTimelock', 'collateralizationOracle'] }, @@ -580,30 +530,18 @@ const dependencies: DependencyMap = { feiOATimelockWrapper: { contractDependencies: ['collateralizationOracle'] }, - rariPool19DpiPCVDepositWrapper: { - contractDependencies: ['collateralizationOracle'] - }, rariPool19FeiPCVDepositWrapper: { contractDependencies: ['collateralizationOracle'] }, rariPool24FeiPCVDepositWrapper: { contractDependencies: ['collateralizationOracle'] }, - rariPool25FeiPCVDepositWrapper: { - contractDependencies: ['collateralizationOracle'] - }, - rariPool31FeiPCVDepositWrapper: { - contractDependencies: ['collateralizationOracle', 'rariPool31FeiPCVDeposit'] - }, rariPool6FeiPCVDepositWrapper: { contractDependencies: ['collateralizationOracle'] }, rariPool79FeiPCVDepositWrapper: { contractDependencies: ['collateralizationOracle', 'rariPool79FeiPCVDeposit'] }, - rariPool72FeiPCVDepositWrapper: { - contractDependencies: ['collateralizationOracle', 'rariPool72FeiPCVDeposit'] - }, rariPool128FeiPCVDeposit: { contractDependencies: ['rariPool128FeiPCVDepositWrapper'] }, @@ -613,9 +551,6 @@ const dependencies: DependencyMap = { rariPool22FeiPCVDepositWrapper: { contractDependencies: ['collateralizationOracle', 'rariPool22FeiPCVDeposit'] }, - rariPool9RaiPCVDepositWrapper: { - contractDependencies: ['collateralizationOracle'] - }, namedStaticPCVDepositWrapper: { contractDependencies: ['core', 'optimisticTimelock'] }, @@ -1041,6 +976,15 @@ const dependencies: DependencyMap = { }, daiFixedPricePSMFeiSkimmer: { contractDependencies: ['core'] + }, + dpiToDaiLBPSwapper: { + contractDependencies: ['core'] + }, + dpiToDaiLensDai: { + contractDependencies: [] + }, + dpiToDaiLensDpi: { + contractDependencies: [] } }; diff --git a/protocol-configuration/mainnetAddresses.ts b/protocol-configuration/mainnetAddresses.ts index 24e00ab99..e40562f8f 100644 --- a/protocol-configuration/mainnetAddresses.ts +++ b/protocol-configuration/mainnetAddresses.ts @@ -194,7 +194,7 @@ const MainnetAddresses: MainnetAddresses = { dpiToDaiLBPPool: { artifactName: 'ILiquidityBootstrappingPoolFactory', address: '0xd10386804959a121a8a487e49f45aa9f5a2eb2a0', - category: AddressCategory.PCV + category: AddressCategory.External }, aaveEthPCVDeposit: { artifactName: 'AavePCVDeposit', diff --git a/test/integration/proposals_config.ts b/test/integration/proposals_config.ts index ce3bcee9b..0ec5b887b 100644 --- a/test/integration/proposals_config.ts +++ b/test/integration/proposals_config.ts @@ -12,11 +12,15 @@ const proposals: ProposalsConfigMap = { affectedContractSignoff: [ 'daiFixedPricePSMFeiSkimmer', 'core', - 'dpi', 'compoundDaiPCVDeposit', 'dpiToDaiLBPSwapper', 'dpiToDaiLensDai', - 'dpiToDaiLensDpi' + 'dpiToDaiLensDpi', + 'collateralizationOracle', + 'tribalCouncilTimelock', + 'tribalCouncilSafe', + 'nopeDAO', + 'compoundEthPCVDeposit' ], deprecatedContractSignoff: [ 'rariPool31FeiPCVDepositWrapper', From 9621995d3d749819e4db89bf0fc71fc2d7e437e6 Mon Sep 17 00:00:00 2001 From: thomas-waite Date: Wed, 18 May 2022 02:17:22 +0100 Subject: [PATCH 096/274] docs: minor comment fixes --- contracts/test/unit/governance/NopeDAO.t.sol | 2 +- proposals/dao/fip_105.ts | 2 +- proposals/description/fip_105.ts | 8 ++++---- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/contracts/test/unit/governance/NopeDAO.t.sol b/contracts/test/unit/governance/NopeDAO.t.sol index 4b705ec54..e35d5e30c 100644 --- a/contracts/test/unit/governance/NopeDAO.t.sol +++ b/contracts/test/unit/governance/NopeDAO.t.sol @@ -77,7 +77,7 @@ contract NopeDAOTest is DSTest { assertEq(votingDelay, 0); uint256 votingPeriod = nopeDAO.votingPeriod(); - uint256 fourDays = 26585; // (86400 * 4) / 13 + uint256 fourDays = 26585; // (86400 * 4) / 13 assertEq(votingPeriod, fourDays); uint256 proposalThreshold = nopeDAO.proposalThreshold(); diff --git a/proposals/dao/fip_105.ts b/proposals/dao/fip_105.ts index 8122eaa7c..21bf852c9 100644 --- a/proposals/dao/fip_105.ts +++ b/proposals/dao/fip_105.ts @@ -207,7 +207,7 @@ const validate: ValidateUpgradeFunc = async (addresses, oldContracts, contracts, expect(await core.hasRole(ethers.utils.id('SWAP_ADMIN_ROLE'), addresses.tribalCouncilTimelock)).to.be.true; expect(await core.getRoleAdmin(ethers.utils.id('SWAP_ADMIN_ROLE'))).to.be.equal(ethers.utils.id('ROLE_ADMIN')); - const signer = await getImpersonatedSigner(addresses.tribalCouncilTimelock); // TODO: TribalCouncil should grant itself SWAP_ADMIN_ROLE + const signer = await getImpersonatedSigner(addresses.tribalCouncilTimelock); await dpiToDaiLBPSwapper.connect(signer).swap(); expect(await dpiToDaiLBPSwapper.isTimeEnded()).to.be.false; diff --git a/proposals/description/fip_105.ts b/proposals/description/fip_105.ts index d2087b315..499620e3f 100644 --- a/proposals/description/fip_105.ts +++ b/proposals/description/fip_105.ts @@ -1,7 +1,7 @@ import { ProposalDescription } from '@custom-types/types'; const fip_105: ProposalDescription = { - title: 'FIP-105: Reinforce PCV by consolidating assets and performing technical maintenance', + title: 'FIP-105: Reinforce PCV by consolidating assets and perform technical maintenance', commands: [ ///////// DAI PSM Skimmer ////////////// { @@ -18,14 +18,14 @@ const fip_105: ProposalDescription = { values: '0', method: 'transfer(address,uint256)', arguments: ['{dpiToDaiLBPSwapper}', '37888449801955370645659'], - description: 'Transfer DPI from DAO timelock to the LBP pool' + description: 'Transfer DPI from DAO timelock to the LBP swapper' }, { target: 'compoundDaiPCVDeposit', values: '0', method: 'withdraw(address,uint256)', arguments: ['{dpiToDaiLBPSwapper}', '187947000000000000000000'], - description: 'Withdraw Use the PCVGuardian to transfer DAI from the CompoundPCVDeposit to the LBP pool' + description: 'Withdraw DAI from the CompoundPCVDeposit and transfer to the LBP pool' }, { target: 'collateralizationOracle', @@ -58,7 +58,7 @@ const fip_105: ProposalDescription = { '{dpiDepositWrapper}' ] ], - description: 'Remove DPI Deposit wrapper from CR oracle, as now empty' + description: 'Remove various empty PCV deposits from CR oracle' }, { target: 'core', From 23886074d2f86f65e267fd3b7ad4f4a46eb65f2d Mon Sep 17 00:00:00 2001 From: thomas-waite Date: Wed, 18 May 2022 15:16:24 +0100 Subject: [PATCH 097/274] feat: transfer WETH from timelock --- proposals/dao/fip_105.ts | 14 ++++++++++++++ proposals/description/fip_105.ts | 24 +++++++++++++++++++++--- test/integration/proposals_config.ts | 4 +++- 3 files changed, 38 insertions(+), 4 deletions(-) diff --git a/proposals/dao/fip_105.ts b/proposals/dao/fip_105.ts index 21bf852c9..90b4409d7 100644 --- a/proposals/dao/fip_105.ts +++ b/proposals/dao/fip_105.ts @@ -10,6 +10,7 @@ import { import { forceEth } from '@test/integration/setup/utils'; import { TransactionResponse } from '@ethersproject/providers'; import { getImpersonatedSigner, overwriteChainlinkAggregator, time } from '@test/helpers'; +import { BigNumber } from 'ethers'; const toBN = ethers.BigNumber.from; @@ -21,6 +22,8 @@ DAO Proposal #105 2. Deploy Balancer LBP and initialise auction of DPI for DAI 3. Fix NopeDAO voting period 4. Transfer CREAM to TribalCouncil multisig, where it will then be sold to ETH +5. Withdraw 15,000 WETH from DAO timelock to the aaveETHPCVDeposit +6. Fund TC with 10 eth */ // LBP Swapper config @@ -34,6 +37,9 @@ const dpiSeedAmount = toBN('37888449801955370645659'); const fipNumber = '105'; const skimThreshold = ethers.constants.WeiPerEther.mul(20_000_000); +let initialAavePCVBalance: BigNumber; +const aaveWETHTransferAmount = '14999999999999999992057'; // almost 15,000 WETH + const deploy: DeployUpgradeFunc = async (deployAddress: string, addresses: NamedAddresses, logging: boolean) => { ///////// 1. Deploy a Fei Skimmer for the DAI PSM const daiPSMFeiSkimmerFactory = await ethers.getContractFactory('FeiSkimmer'); @@ -167,6 +173,9 @@ const setup: SetupUpgradeFunc = async (addresses, oldContracts, contracts, loggi console.log('Starting DAI PSM dai balance [M]', (await contracts.compoundDaiPCVDeposit.balance()) / 1e24); await forceEth(addresses.tribalCouncilTimelock); + + initialAavePCVBalance = await contracts.aaveEthPCVDepositWrapper.balance(); + logging && console.log('Initial Aave Eth PCV Balance: ', initialAavePCVBalance.toString()); }; // Tears down any changes made in setup() that need to be @@ -223,6 +232,11 @@ const validate: ValidateUpgradeFunc = async (addresses, oldContracts, contracts, expect(await ethersSigner.provider.getBalance(addresses.tribalCouncilSafe)).to.be.equal( ethers.utils.parseEther('10') ); + + /////// 6. Transfer WETH to the aaveETHPCVDeposit ////// + const finalAavePCVBalance = await contracts.aaveEthPCVDepositWrapper.balance(); + expect(finalAavePCVBalance).to.be.bignumber.at.least(initialAavePCVBalance.add(aaveWETHTransferAmount)); + logging && console.log('Final Aave Eth PCV Balance: ', finalAavePCVBalance.toString()); }; export { deploy, setup, teardown, validate }; diff --git a/proposals/description/fip_105.ts b/proposals/description/fip_105.ts index 499620e3f..1230accbd 100644 --- a/proposals/description/fip_105.ts +++ b/proposals/description/fip_105.ts @@ -83,6 +83,21 @@ const fip_105: ProposalDescription = { arguments: ['{tribalCouncilSafe}', '31780370000000000000000'], description: 'Transfer CREAM to TribalCouncil multisig where it will then be swapped' }, + /////// Transfer WETH from feiDAOTimelock to aaveETHPCVDeposit and deposit //////// + { + target: 'weth', + values: '0', + method: 'transfer(address,uint256)', + arguments: ['{aaveEthPCVDeposit}', '14999999999999999992057'], + description: 'Transfer WETH from the DAO timelock to the aaveETHPCVDeposit' + }, + { + target: 'aaveEthPCVDeposit', + values: '0', + method: 'deposit()', + arguments: [], + description: 'Deposit WETH transferred to aaveETHPCVDeposit into the deposit' + }, //////// Fund Council ////////// { target: 'compoundEthPCVDeposit', @@ -93,14 +108,17 @@ const fip_105: ProposalDescription = { } ], description: ` - FIP-105: Reinforce PCV by consolidating assets and performing technical maintenance. + FIP-105: Reinforce PCV by consolidating assets and perform technical maintenance. This FIP implements parts of the PCV reinforcement proposal that was approved in this snapshot: https://snapshot.fei.money/#/proposal/0x2fd5bdda0067098f6c0520fe309dfe90ca403758f0ce98c1854a00bf38999674 and discussed in this forum post: https://tribe.fei.money/t/fip-104-fei-pcv-reinforcement-proposal/4162?page=2 - Specifically, it liquidates the protocol's DPI holdings to DAI using a Balancer LBP and it transfers the protocol's - CREAM holdings to the TribalCouncil multisig. The TribalCouncil will then be able to liquidate the position on a DEX. + Specifically, it: + - Liquidates the protocol's DPI holdings to DAI using a Balancer LBP + - Transfers the protocol's CREAM holdings from the DAO timelock to the TribalCouncil multisig. The TribalCouncil will + then liquidate the position on a DEX before returning the funds to PCV reserves + - Transfer 15,000 WETH from the DAO timelock to the aaveETHPCVDeposit In addition, the FIP performs several technical maintenance tasks: - Add and remove the relevant PCV deposits from the Collaterization Oracle diff --git a/test/integration/proposals_config.ts b/test/integration/proposals_config.ts index 0ec5b887b..52f2a374c 100644 --- a/test/integration/proposals_config.ts +++ b/test/integration/proposals_config.ts @@ -20,7 +20,9 @@ const proposals: ProposalsConfigMap = { 'tribalCouncilTimelock', 'tribalCouncilSafe', 'nopeDAO', - 'compoundEthPCVDeposit' + 'compoundEthPCVDeposit', + 'weth', + 'aaveEthPCVDeposit' ], deprecatedContractSignoff: [ 'rariPool31FeiPCVDepositWrapper', From 4ff17731cdc17c293a578392dd17541a7232d07a Mon Sep 17 00:00:00 2001 From: thomas-waite Date: Wed, 18 May 2022 15:21:35 +0100 Subject: [PATCH 098/274] docs: update fip text --- proposals/description/fip_105.ts | 4 ++-- test/integration/proposals_config.ts | 1 - 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/proposals/description/fip_105.ts b/proposals/description/fip_105.ts index 1230accbd..e77af8865 100644 --- a/proposals/description/fip_105.ts +++ b/proposals/description/fip_105.ts @@ -118,7 +118,6 @@ const fip_105: ProposalDescription = { - Liquidates the protocol's DPI holdings to DAI using a Balancer LBP - Transfers the protocol's CREAM holdings from the DAO timelock to the TribalCouncil multisig. The TribalCouncil will then liquidate the position on a DEX before returning the funds to PCV reserves - - Transfer 15,000 WETH from the DAO timelock to the aaveETHPCVDeposit In addition, the FIP performs several technical maintenance tasks: - Add and remove the relevant PCV deposits from the Collaterization Oracle @@ -126,7 +125,8 @@ const fip_105: ProposalDescription = { - Grant a new skimmer contract the role necessary to skim excess Fei from the DAI PSM - Fix a bug in the NopeDAO configuration that previously set the voting period to 22 months rather than the expected 4 days - - Fund the TribalCouncil with 10 eth + - Fund the TribalCouncil with 10 Eth + - Transfer 15,000 WETH from the DAO timelock to the aaveETHPCVDeposit ` }; diff --git a/test/integration/proposals_config.ts b/test/integration/proposals_config.ts index 52f2a374c..6e0525235 100644 --- a/test/integration/proposals_config.ts +++ b/test/integration/proposals_config.ts @@ -21,7 +21,6 @@ const proposals: ProposalsConfigMap = { 'tribalCouncilSafe', 'nopeDAO', 'compoundEthPCVDeposit', - 'weth', 'aaveEthPCVDeposit' ], deprecatedContractSignoff: [ From e04cf3ff85b04e8bf1d445909841ca2b28ef0ac8 Mon Sep 17 00:00:00 2001 From: thomas-waite Date: Wed, 18 May 2022 17:43:55 +0100 Subject: [PATCH 099/274] feat: add withdraw lbp liquidity withdraw script --- proposals/dao/lbp_withdraw.ts | 69 +++++++++++++++++++++++++++++++++++ 1 file changed, 69 insertions(+) create mode 100644 proposals/dao/lbp_withdraw.ts diff --git a/proposals/dao/lbp_withdraw.ts b/proposals/dao/lbp_withdraw.ts new file mode 100644 index 000000000..9cfc25f98 --- /dev/null +++ b/proposals/dao/lbp_withdraw.ts @@ -0,0 +1,69 @@ +import hre, { ethers, artifacts } from 'hardhat'; +import { expect } from 'chai'; +import { + DeployUpgradeFunc, + NamedAddresses, + SetupUpgradeFunc, + TeardownUpgradeFunc, + ValidateUpgradeFunc +} from '@custom-types/types'; +import { time } from '@test/helpers'; +import { BigNumber } from 'ethers'; + +/* +Withdraw liquidity from the LBP once it has finished +*/ + +const fipNumber = 'withdraw_lbp_liquidity'; + +let initialDaiPCVBalance: BigNumber; +let initialTCDpiBalance: BigNumber; + +const minExpectedLBPDai = ethers.constants.WeiPerEther.mul(3_000_000); +const minExpectedLBPDpi = ethers.constants.WeiPerEther.mul(100); // TODO + +// Do any deployments +// This should exclusively include new contract deployments +const deploy: DeployUpgradeFunc = async (deployAddress: string, addresses: NamedAddresses, logging: boolean) => { + console.log(`No deploy actions for fip${fipNumber}`); + return { + // put returned contract objects here + }; +}; + +// Do any setup necessary for running the test. +// This could include setting up Hardhat to impersonate accounts, +// ensuring contracts have a specific state, etc. +const setup: SetupUpgradeFunc = async (addresses, oldContracts, contracts, logging) => { + // Fast forward to end of LPB + const timeRemaining = await contracts.dpiToDaiLBPSwapper.remainingTime(); + await time.increase(timeRemaining); + + initialDaiPCVBalance = await contracts.compoundDaiPCVDeposit.balance(); + + const dpi = contracts.dpi; + initialTCDpiBalance = await dpi.balanceOf(addresses.tribalCouncilSafe); +}; + +// Tears down any changes made in setup() that need to be +// cleaned up before doing any validation checks. +const teardown: TeardownUpgradeFunc = async (addresses, oldContracts, contracts, logging) => { + console.log(`No actions to complete in teardown for fip${fipNumber}`); +}; + +// Run any validations required on the fip using mocha or console logging +// IE check balances, check state of contracts, etc. +const validate: ValidateUpgradeFunc = async (addresses, oldContracts, contracts, logging) => { + // Validate that liquidity arrived at target destination + // Will have DAI and DPI + // Withdraw DAI to Compound PCV DAI deposit + // Withdraw DPI to TC multisig, where it can be sold on a DEX + const finalDAIDepositBalance = await contracts.compoundDaiPCVDeposit.balance(); + expect(finalDAIDepositBalance).to.be.bignumber.at.least(initialDaiPCVBalance.add(minExpectedLBPDai)); + + const dpi = contracts.dpi; + const finalTCDpiBalance = await dpi.balanceOf(addresses.tribalCouncilSafe); + expect(finalTCDpiBalance).to.be.bignumber.at.least(initialTCDpiBalance.add(minExpectedLBPDpi)); +}; + +export { deploy, setup, teardown, validate }; From 5d092131faaf2f079c1cccd972cdf0f8ab315674 Mon Sep 17 00:00:00 2001 From: thomas-waite Date: Wed, 18 May 2022 17:44:47 +0100 Subject: [PATCH 100/274] feat: add TC proposal script --- proposals/description/lbp_withdraw.ts | 55 +++++++++++++++++++++++++++ test/integration/proposals_config.ts | 16 ++++++++ 2 files changed, 71 insertions(+) create mode 100644 proposals/description/lbp_withdraw.ts diff --git a/proposals/description/lbp_withdraw.ts b/proposals/description/lbp_withdraw.ts new file mode 100644 index 000000000..374815862 --- /dev/null +++ b/proposals/description/lbp_withdraw.ts @@ -0,0 +1,55 @@ +import { ProposalDescription } from '@custom-types/types'; + +const withdraw_lbp_liquidity: ProposalDescription = { + title: 'Withdraw LBP liquidity', + commands: [ + { + target: 'pcvGuardianNew', + values: '0', + method: 'setSafeAddresses(address[])', + arguments: [['{tribalCouncilSafe}', '{tribalCouncilTimelock}', '{compoundDaiPCVDeposit}']], + description: + 'Set the Compound DAI PCV deposit and TribalCouncil multisig and timelock to be safe addresses for PCV withdrawal' + }, + { + target: 'pcvGuardianNew', + values: '0', + method: 'withdrawERC20ToSafeAddress(address,address,address,uint256,bool,bool)', + arguments: [ + '{dpiToDaiLBPSwapper}', + '{compoundDaiPCVDeposit}', + '{dai}', + '3000000000000000000000000', // TODO, update with accurate figure + false, + false + ], + description: 'Withdraw DAI from the LBP to the Compound PCV DAI deposit' + }, + { + target: 'pcvGuardianNew', + values: '0', + method: 'withdrawERC20ToSafeAddress(address,address,address,uint256,bool,bool)', + arguments: [ + '{dpiToDaiLBPSwapper}', + '{tribalCouncilSafe}', + '{dpi}', + '100000000000000000000', // TODO, update with accurate figure + false, + false + ], + description: 'Withdraw DPI from the LBP to the TribalCouncil multisig' + } + ], + description: ` + Withdraw LBP liquidity. + + Set the TribalCouncil multisig and timelock to be safe addresses for PCV withdrawal. + + Then use the PCV guardian to withdraw all DAI liquidity from the DPI LBP sale to the Compound DAI PCV deposit. + + Lastly, use the PCV guardian to withdraw all DPI liquidity from the DPI LBP sale to the TribalCouncil safe, where it will then be + sold via a DEX aggregator for DAI. + ` +}; + +export default withdraw_lbp_liquidity; diff --git a/test/integration/proposals_config.ts b/test/integration/proposals_config.ts index 6e0525235..7e24568a8 100644 --- a/test/integration/proposals_config.ts +++ b/test/integration/proposals_config.ts @@ -1,6 +1,7 @@ import { ProposalCategory, ProposalsConfigMap } from '@custom-types/types'; import fip_105 from '@proposals/description/fip_105'; +import withdraw_lbp_liquidity from '@proposals/description/lbp_withdraw'; // import fip_xx_proposal from '@proposals/description/fip_xx'; const proposals: ProposalsConfigMap = { @@ -41,6 +42,21 @@ const proposals: ProposalsConfigMap = { 'dpiDepositWrapper' ], category: ProposalCategory.DAO + }, + withdraw_lbp_liquidity: { + deploy: false, + totalValue: 0, + proposal: withdraw_lbp_liquidity, + proposalId: '', + affectedContractSignoff: [ + 'dpiToDaiLBPSwapper', + 'compoundDaiPCVDeposit', + 'pcvGuardianNew', + 'tribalCouncilSafe', + 'tribalCouncilTimelock' + ], + deprecatedContractSignoff: [], + category: ProposalCategory.TC } }; From 3518a490b61d42ff4b6dd4ab04b2804f3e3d7cb8 Mon Sep 17 00:00:00 2001 From: thomas-waite Date: Wed, 18 May 2022 18:01:23 +0100 Subject: [PATCH 101/274] refactor: validate safe addresses set --- ..._withdraw.ts => withdraw_lbp_liquidity.ts} | 39 +++++++++++++------ ..._withdraw.ts => withdraw_lbp_liquidity.ts} | 9 ++++- test/integration/proposals_config.ts | 2 +- 3 files changed, 37 insertions(+), 13 deletions(-) rename proposals/dao/{lbp_withdraw.ts => withdraw_lbp_liquidity.ts} (61%) rename proposals/description/{lbp_withdraw.ts => withdraw_lbp_liquidity.ts} (87%) diff --git a/proposals/dao/lbp_withdraw.ts b/proposals/dao/withdraw_lbp_liquidity.ts similarity index 61% rename from proposals/dao/lbp_withdraw.ts rename to proposals/dao/withdraw_lbp_liquidity.ts index 9cfc25f98..4d62cb173 100644 --- a/proposals/dao/lbp_withdraw.ts +++ b/proposals/dao/withdraw_lbp_liquidity.ts @@ -1,4 +1,4 @@ -import hre, { ethers, artifacts } from 'hardhat'; +import { ethers } from 'hardhat'; import { expect } from 'chai'; import { DeployUpgradeFunc, @@ -7,8 +7,9 @@ import { TeardownUpgradeFunc, ValidateUpgradeFunc } from '@custom-types/types'; -import { time } from '@test/helpers'; +import { getImpersonatedSigner, time } from '@test/helpers'; import { BigNumber } from 'ethers'; +import { forceEth } from '@test/integration/setup/utils'; /* Withdraw liquidity from the LBP once it has finished @@ -19,8 +20,8 @@ const fipNumber = 'withdraw_lbp_liquidity'; let initialDaiPCVBalance: BigNumber; let initialTCDpiBalance: BigNumber; -const minExpectedLBPDai = ethers.constants.WeiPerEther.mul(3_000_000); -const minExpectedLBPDpi = ethers.constants.WeiPerEther.mul(100); // TODO +const minExpectedLBPDai = ethers.constants.WeiPerEther.mul(300_000); // TODO, update to accurate numbers +const minExpectedLBPDpi = ethers.constants.WeiPerEther.mul(100); // TODO, update to accurate numbers // Do any deployments // This should exclusively include new contract deployments @@ -35,14 +36,27 @@ const deploy: DeployUpgradeFunc = async (deployAddress: string, addresses: Named // This could include setting up Hardhat to impersonate accounts, // ensuring contracts have a specific state, etc. const setup: SetupUpgradeFunc = async (addresses, oldContracts, contracts, logging) => { + const dpi = contracts.dpi; + initialTCDpiBalance = await dpi.balanceOf(addresses.tribalCouncilSafe); + initialDaiPCVBalance = await contracts.compoundDaiPCVDeposit.balance(); + console.log('initial dai balance: ', initialDaiPCVBalance.toString()); + // Fast forward to end of LPB const timeRemaining = await contracts.dpiToDaiLBPSwapper.remainingTime(); await time.increase(timeRemaining); - initialDaiPCVBalance = await contracts.compoundDaiPCVDeposit.balance(); + // Drop DAI and DPI onto contract, so can test withdraw + const daiWhale = '0x5d3a536e4d6dbd6114cc1ead35777bab948e3643' + const dpiWhale = '0x6f634c6135d2ebd550000ac92f494f9cb8183dae' + const daiWhaleSigner = await getImpersonatedSigner(daiWhale); + const dpiWhaleSigner = await getImpersonatedSigner(dpiWhale); - const dpi = contracts.dpi; - initialTCDpiBalance = await dpi.balanceOf(addresses.tribalCouncilSafe); + await forceEth(daiWhale); + await forceEth(dpiWhale); + await forceEth(addresses.tribalCouncilTimelock); + + await contracts.dai.connect(daiWhaleSigner).transfer(addresses.dpiToDaiLBPSwapper, minExpectedLBPDai); + await contracts.dpi.connect(dpiWhaleSigner).transfer(addresses.dpiToDaiLBPSwapper, minExpectedLBPDpi); }; // Tears down any changes made in setup() that need to be @@ -54,10 +68,13 @@ const teardown: TeardownUpgradeFunc = async (addresses, oldContracts, contracts, // Run any validations required on the fip using mocha or console logging // IE check balances, check state of contracts, etc. const validate: ValidateUpgradeFunc = async (addresses, oldContracts, contracts, logging) => { - // Validate that liquidity arrived at target destination - // Will have DAI and DPI - // Withdraw DAI to Compound PCV DAI deposit - // Withdraw DPI to TC multisig, where it can be sold on a DEX + // 1. Validate safe addresses set on PCVGuardian + const pcvGuardian = contracts.pcvGuardianNew; + expect(await pcvGuardian.isSafeAddress(addresses.tribalCouncilSafe)).to.be.true; + expect(await pcvGuardian.isSafeAddress(addresses.tribalCouncilTimelock)).to.be.true; + expect(await pcvGuardian.isSafeAddress(addresses.compoundDaiPCVDeposit)).to.be.true; + + // 2. Validate withdrawn liquidity destinations const finalDAIDepositBalance = await contracts.compoundDaiPCVDeposit.balance(); expect(finalDAIDepositBalance).to.be.bignumber.at.least(initialDaiPCVBalance.add(minExpectedLBPDai)); diff --git a/proposals/description/lbp_withdraw.ts b/proposals/description/withdraw_lbp_liquidity.ts similarity index 87% rename from proposals/description/lbp_withdraw.ts rename to proposals/description/withdraw_lbp_liquidity.ts index 374815862..39cbb538b 100644 --- a/proposals/description/lbp_withdraw.ts +++ b/proposals/description/withdraw_lbp_liquidity.ts @@ -19,12 +19,19 @@ const withdraw_lbp_liquidity: ProposalDescription = { '{dpiToDaiLBPSwapper}', '{compoundDaiPCVDeposit}', '{dai}', - '3000000000000000000000000', // TODO, update with accurate figure + '300000000000000000000000', // TODO, update with accurate figure false, false ], description: 'Withdraw DAI from the LBP to the Compound PCV DAI deposit' }, + { + target: 'compoundDaiPCVDeposit', + values: '0', + method: 'deposit()', + arguments: [], + description: 'Deposit DAI on deposit into Compound PCV Deposit' + }, { target: 'pcvGuardianNew', values: '0', diff --git a/test/integration/proposals_config.ts b/test/integration/proposals_config.ts index 7e24568a8..ce109d6dc 100644 --- a/test/integration/proposals_config.ts +++ b/test/integration/proposals_config.ts @@ -1,7 +1,7 @@ import { ProposalCategory, ProposalsConfigMap } from '@custom-types/types'; import fip_105 from '@proposals/description/fip_105'; -import withdraw_lbp_liquidity from '@proposals/description/lbp_withdraw'; +import withdraw_lbp_liquidity from '@proposals/description/withdraw_lbp_liquidity'; // import fip_xx_proposal from '@proposals/description/fip_xx'; const proposals: ProposalsConfigMap = { From 073583556b94a1802d305ce7d76d96926733e8ac Mon Sep 17 00:00:00 2001 From: thomas-waite Date: Wed, 18 May 2022 20:34:23 +0100 Subject: [PATCH 102/274] feat: add uniswapPCVDeposit as safe address --- proposals/dao/fip_105.ts | 9 +-------- proposals/description/fip_105.ts | 10 ++++------ 2 files changed, 5 insertions(+), 14 deletions(-) diff --git a/proposals/dao/fip_105.ts b/proposals/dao/fip_105.ts index 90b4409d7..47f6bc523 100644 --- a/proposals/dao/fip_105.ts +++ b/proposals/dao/fip_105.ts @@ -189,16 +189,9 @@ const teardown: TeardownUpgradeFunc = async (addresses, oldContracts, contracts, const validate: ValidateUpgradeFunc = async (addresses, oldContracts, contracts, logging) => { poolId = '0xd10386804959a121a8a487e49f45aa9f5a2eb2a00002000000000000000001f1'; //////////// 1. DAI FEI SKIMMER ////////////// - const daiFixedPricePSMFeiSkimmer = contracts.daiFixedPricePSMFeiSkimmer; const dpiToDaiLBPSwapper = contracts.dpiToDaiLBPSwapper; const core = contracts.core; - - expect(await daiFixedPricePSMFeiSkimmer.threshold()).to.be.equal(skimThreshold); - expect(await daiFixedPricePSMFeiSkimmer.source()).to.be.equal(addresses.daiFixedPricePSM); - expect(await core.hasRole(ethers.utils.id('PCV_CONTROLLER_ROLE'), daiFixedPricePSMFeiSkimmer.address)).to.be.true; - - // Validate skimmer contract admin role is set to PCV_MINOR_PARAM_ROLE - expect(await daiFixedPricePSMFeiSkimmer.CONTRACT_ADMIN_ROLE()).to.be.equal(ethers.utils.id('PCV_MINOR_PARAM_ROLE')); + expect(await contracts.pcvGuardianNew.isSafeAddress(addresses.uniswapPCVDeposit)).to.be.true; ///////////// 2. DPI LBP //////////////// expect(await dpiToDaiLBPSwapper.doInvert()).to.be.equal(true); diff --git a/proposals/description/fip_105.ts b/proposals/description/fip_105.ts index e77af8865..5cd50c521 100644 --- a/proposals/description/fip_105.ts +++ b/proposals/description/fip_105.ts @@ -3,15 +3,13 @@ import { ProposalDescription } from '@custom-types/types'; const fip_105: ProposalDescription = { title: 'FIP-105: Reinforce PCV by consolidating assets and perform technical maintenance', commands: [ - ///////// DAI PSM Skimmer ////////////// { - target: 'core', + target: 'pcvGuardianNew', values: '0', - method: 'grantRole(bytes32,address)', - arguments: ['0x0866eae1216ed05a11636a648003f3f62921eb97ccb05acc30636f62958a8bd6', '{daiFixedPricePSMFeiSkimmer}'], - description: 'Grant the new DAI PSM Skimmer the PCV_CONTROLLER_ROLE' + method: 'setSafeAddress(address)', + arguments: ['{uniswapPCVDeposit}'], + description: 'Set the uniswapPCVDeposit to a guardian Safe address. Fei will be withdrawn and burnt here' }, - //////// DPI LBP //////// { target: 'dpi', From 87f849257504d84f29dc9cbfc48a2b9e0971b8c1 Mon Sep 17 00:00:00 2001 From: thomas-waite Date: Wed, 18 May 2022 21:06:22 +0100 Subject: [PATCH 103/274] feat: add swapper as a safe address --- proposals/dao/fip_105.ts | 5 +++-- proposals/description/fip_105.ts | 8 ++++---- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/proposals/dao/fip_105.ts b/proposals/dao/fip_105.ts index 47f6bc523..8bc4d88a5 100644 --- a/proposals/dao/fip_105.ts +++ b/proposals/dao/fip_105.ts @@ -18,7 +18,7 @@ const toBN = ethers.BigNumber.from; DAO Proposal #105 -1. Deploy Fei Skimmer and grant it PCV_CONTROLLER +1. Set uniswapPCVDeposit and dpiToDaiLBPSwapper to be guardian Safe addresses 2. Deploy Balancer LBP and initialise auction of DPI for DAI 3. Fix NopeDAO voting period 4. Transfer CREAM to TribalCouncil multisig, where it will then be sold to ETH @@ -188,10 +188,11 @@ const teardown: TeardownUpgradeFunc = async (addresses, oldContracts, contracts, // IE check balances, check state of contracts, etc. const validate: ValidateUpgradeFunc = async (addresses, oldContracts, contracts, logging) => { poolId = '0xd10386804959a121a8a487e49f45aa9f5a2eb2a00002000000000000000001f1'; - //////////// 1. DAI FEI SKIMMER ////////////// + //////////// 1. New Safe adddresses ////////////// const dpiToDaiLBPSwapper = contracts.dpiToDaiLBPSwapper; const core = contracts.core; expect(await contracts.pcvGuardianNew.isSafeAddress(addresses.uniswapPCVDeposit)).to.be.true; + expect(await contracts.pcvGuardianNew.isSafeAddress(addresses.dpiToDaiLBPSwapper)).to.be.true; ///////////// 2. DPI LBP //////////////// expect(await dpiToDaiLBPSwapper.doInvert()).to.be.equal(true); diff --git a/proposals/description/fip_105.ts b/proposals/description/fip_105.ts index 5cd50c521..367037872 100644 --- a/proposals/description/fip_105.ts +++ b/proposals/description/fip_105.ts @@ -6,9 +6,9 @@ const fip_105: ProposalDescription = { { target: 'pcvGuardianNew', values: '0', - method: 'setSafeAddress(address)', - arguments: ['{uniswapPCVDeposit}'], - description: 'Set the uniswapPCVDeposit to a guardian Safe address. Fei will be withdrawn and burnt here' + method: 'setSafeAddresses(address[])', + arguments: [['{uniswapPCVDeposit}', '{dpiToDaiLBPSwapper}']], + description: 'Set the uniswapPCVDeposit and dpiToDai LBP swapper to be guardian Safe addresses' }, //////// DPI LBP //////// { @@ -120,7 +120,7 @@ const fip_105: ProposalDescription = { In addition, the FIP performs several technical maintenance tasks: - Add and remove the relevant PCV deposits from the Collaterization Oracle - Grant the TribalCouncil the role required to initiate the DPI LBP auction - - Grant a new skimmer contract the role necessary to skim excess Fei from the DAI PSM + - Add the uniswapPCVDeposit and dpiToDai LBP swapper as Safe addresses so PCV can be moved there - Fix a bug in the NopeDAO configuration that previously set the voting period to 22 months rather than the expected 4 days - Fund the TribalCouncil with 10 Eth From 86824f4bc58d4e49a465749bf1e494265e5494ed Mon Sep 17 00:00:00 2001 From: thomas-waite Date: Wed, 18 May 2022 21:10:24 +0100 Subject: [PATCH 104/274] test: add time remaining test --- proposals/dao/fip_105.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/proposals/dao/fip_105.ts b/proposals/dao/fip_105.ts index 8bc4d88a5..733a9e209 100644 --- a/proposals/dao/fip_105.ts +++ b/proposals/dao/fip_105.ts @@ -214,6 +214,9 @@ const validate: ValidateUpgradeFunc = async (addresses, oldContracts, contracts, await dpiToDaiLBPSwapper.connect(signer).swap(); expect(await dpiToDaiLBPSwapper.isTimeEnded()).to.be.false; + // Validate time remaining resets + expect(await dpiToDaiLBPSwapper.remainingTime()).to.be.bignumber.equal(toBN(86400 * 14)); + //////// 3. Nope DAO Voting Period fix ///////////// expect(await contracts.nopeDAO.votingPeriod()).to.be.equal(26585); From aa1180dfa3637793447501f25de68518d5f7bbca Mon Sep 17 00:00:00 2001 From: thomas-waite Date: Wed, 18 May 2022 21:17:37 +0100 Subject: [PATCH 105/274] refactor: block number update --- block.txt | 2 +- proposals/dao/fip_105.ts | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/block.txt b/block.txt index 81aa07f32..435e4a6c8 100644 --- a/block.txt +++ b/block.txt @@ -1 +1 @@ -14795456 \ No newline at end of file +14800818 \ No newline at end of file diff --git a/proposals/dao/fip_105.ts b/proposals/dao/fip_105.ts index 733a9e209..c40d3e403 100644 --- a/proposals/dao/fip_105.ts +++ b/proposals/dao/fip_105.ts @@ -53,8 +53,8 @@ const deploy: DeployUpgradeFunc = async (deployAddress: string, addresses: Named /////////// 2. Deploy the Balancer LBP swapper // // Amounts: - // DPI: 37888449801955370645659 (95%), 37k DPI, $3,758,957.86 - // DAI: 187947000000000000000000 (5%), 187k DAI, $187,947.89 + // DPI: 37888449801955370645659 (95%), 37k DPI, $3,587,445 + // DAI: 187947000000000000000000 (5%), 187k DAI, $179,372.05, overfunding by ~$9k and transferring $187,947 const BalancerLBPSwapperFactory = await ethers.getContractFactory('BalancerLBPSwapper'); // Oracle reports DPI price in terms of USD, so should not be inverted From 32ba803b4c302e4d4d75f8f3cc8e165c91a34325 Mon Sep 17 00:00:00 2001 From: thomas-waite Date: Wed, 18 May 2022 21:21:53 +0100 Subject: [PATCH 106/274] refactor: update contract deps --- test/integration/proposals_config.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/test/integration/proposals_config.ts b/test/integration/proposals_config.ts index 6e0525235..d03f290e4 100644 --- a/test/integration/proposals_config.ts +++ b/test/integration/proposals_config.ts @@ -21,7 +21,9 @@ const proposals: ProposalsConfigMap = { 'tribalCouncilSafe', 'nopeDAO', 'compoundEthPCVDeposit', - 'aaveEthPCVDeposit' + 'aaveEthPCVDeposit', + 'pcvGuardianNew', + 'uniswapPCVDeposit' ], deprecatedContractSignoff: [ 'rariPool31FeiPCVDepositWrapper', From cdde9c280bb10a4a17237c4e302b2996afa2f57d Mon Sep 17 00:00:00 2001 From: thomas-waite Date: Wed, 18 May 2022 21:26:45 +0100 Subject: [PATCH 107/274] test: remove extra PCV_CONTROLLER_ROLE --- protocol-configuration/permissions.ts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/protocol-configuration/permissions.ts b/protocol-configuration/permissions.ts index 33293e5bc..c5f46d43a 100644 --- a/protocol-configuration/permissions.ts +++ b/protocol-configuration/permissions.ts @@ -22,8 +22,7 @@ export const permissions = { 'lusdPCVDripController', 'ethPSMFeiSkimmer', 'lusdPSMFeiSkimmer', - 'raiPCVDripController', - 'daiFixedPricePSMFeiSkimmer' + 'raiPCVDripController' ], GUARDIAN_ROLE: ['multisig', 'pcvGuardianNew', 'pcvSentinel'], ORACLE_ADMIN_ROLE: [ From 8937cfef61d8f5e34cc316c5732bea7ece3b4176 Mon Sep 17 00:00:00 2001 From: thomas-waite Date: Thu, 19 May 2022 14:01:51 +0100 Subject: [PATCH 108/274] feat: add forceSwap to proposal --- proposals/dao/fip_105.ts | 34 ++++++++++++++++++---- proposals/description/fip_105.ts | 7 +++++ protocol-configuration/mainnetAddresses.ts | 2 +- 3 files changed, 36 insertions(+), 7 deletions(-) diff --git a/proposals/dao/fip_105.ts b/proposals/dao/fip_105.ts index c40d3e403..f7b4f00aa 100644 --- a/proposals/dao/fip_105.ts +++ b/proposals/dao/fip_105.ts @@ -9,7 +9,7 @@ import { } from '@custom-types/types'; import { forceEth } from '@test/integration/setup/utils'; import { TransactionResponse } from '@ethersproject/providers'; -import { getImpersonatedSigner, overwriteChainlinkAggregator, time } from '@test/helpers'; +import { expectApprox, getImpersonatedSigner, overwriteChainlinkAggregator, time } from '@test/helpers'; import { BigNumber } from 'ethers'; const toBN = ethers.BigNumber.from; @@ -188,23 +188,45 @@ const teardown: TeardownUpgradeFunc = async (addresses, oldContracts, contracts, // IE check balances, check state of contracts, etc. const validate: ValidateUpgradeFunc = async (addresses, oldContracts, contracts, logging) => { poolId = '0xd10386804959a121a8a487e49f45aa9f5a2eb2a00002000000000000000001f1'; - //////////// 1. New Safe adddresses ////////////// const dpiToDaiLBPSwapper = contracts.dpiToDaiLBPSwapper; + const dpiToDaiLBPPool = contracts.dpiToDaiLBPPool; const core = contracts.core; + + const retrievedPoolId = await dpiToDaiLBPPool.getPoolId(); + expect(retrievedPoolId).to.equal(poolId); + console.log('Final DAI PSM dai balance [M]', (await contracts.compoundDaiPCVDeposit.balance()) / 1e24); + + //////////// 1. New Safe adddresses ////////////// expect(await contracts.pcvGuardianNew.isSafeAddress(addresses.uniswapPCVDeposit)).to.be.true; expect(await contracts.pcvGuardianNew.isSafeAddress(addresses.dpiToDaiLBPSwapper)).to.be.true; ///////////// 2. DPI LBP //////////////// expect(await dpiToDaiLBPSwapper.doInvert()).to.be.equal(true); + expect(await dpiToDaiLBPSwapper.isTimeStarted()).to.be.true; + expect(await dpiToDaiLBPPool.getSwapEnabled()).to.equal(true); - // By this point, the DAO has moved funds to the LBP swapper and the auction should be active - console.log('Final DAI PSM dai balance [M]', (await contracts.compoundDaiPCVDeposit.balance()) / 1e24); + // Check oracle + const price = (await dpiToDaiLBPSwapper.readOracle())[0]; + // DPI price in USDC + expect(price).to.be.bignumber.at.least(ethers.constants.WeiPerEther.mul(85)); + expect(price).to.be.bignumber.at.most(ethers.constants.WeiPerEther.mul(95)); + + // Check relative price in pool + const response = await dpiToDaiLBPSwapper.getTokensIn(100000); + const amounts = response[1]; + + // LUSD/FEI price * LUSD amount * 1% ~= amount + expect(amounts[1]).to.be.bignumber.equal(ethers.BigNumber.from(100000)); + expectApprox(price.mul(100000).div(ethers.constants.WeiPerEther).div(100), amounts[0]); + + // check pool weights + const weights = await dpiToDaiLBPPool.getNormalizedWeights(); expect(await contracts.dpi.balanceOf(dpiToDaiLBPSwapper.address)).to.be.equal(dpiSeedAmount); expect(await contracts.dai.balanceOf(dpiToDaiLBPSwapper.address)).to.be.equal(daiSeedAmount); - await time.increase(await dpiToDaiLBPSwapper.remainingTime()); - expect(await dpiToDaiLBPSwapper.isTimeEnded()).to.be.true; + // await time.increase(await dpiToDaiLBPSwapper.remainingTime()); + // expect(await dpiToDaiLBPSwapper.isTimeEnded()).to.be.true; // Validate SWAP_ADMIN_ROLE is under ROLE_ADMIN and that TribalCouncilTimelock has the role expect(await core.hasRole(ethers.utils.id('SWAP_ADMIN_ROLE'), addresses.tribalCouncilTimelock)).to.be.true; diff --git a/proposals/description/fip_105.ts b/proposals/description/fip_105.ts index 367037872..874e7abef 100644 --- a/proposals/description/fip_105.ts +++ b/proposals/description/fip_105.ts @@ -25,6 +25,13 @@ const fip_105: ProposalDescription = { arguments: ['{dpiToDaiLBPSwapper}', '187947000000000000000000'], description: 'Withdraw DAI from the CompoundPCVDeposit and transfer to the LBP pool' }, + { + target: 'dpiToDaiLBPSwapper', + values: '0', + method: 'forceSwap()', + arguments: [], + description: 'Start the auction and override the current no-op auction' + }, { target: 'collateralizationOracle', values: '0', diff --git a/protocol-configuration/mainnetAddresses.ts b/protocol-configuration/mainnetAddresses.ts index e40562f8f..fc3ba6322 100644 --- a/protocol-configuration/mainnetAddresses.ts +++ b/protocol-configuration/mainnetAddresses.ts @@ -192,7 +192,7 @@ const MainnetAddresses: MainnetAddresses = { category: AddressCategory.PCV }, dpiToDaiLBPPool: { - artifactName: 'ILiquidityBootstrappingPoolFactory', + artifactName: 'IWeightedPool', address: '0xd10386804959a121a8a487e49f45aa9f5a2eb2a0', category: AddressCategory.External }, From 6506a629843ccc0c0e6e48b7aa991abdaff18887 Mon Sep 17 00:00:00 2001 From: thomas-waite Date: Thu, 19 May 2022 16:47:37 +0100 Subject: [PATCH 109/274] feat: add more detailed validation and invert oracle price --- proposals/dao/fip_105.ts | 129 +++++++++++++++++++++---------- proposals/description/fip_105.ts | 8 ++ 2 files changed, 98 insertions(+), 39 deletions(-) diff --git a/proposals/dao/fip_105.ts b/proposals/dao/fip_105.ts index f7b4f00aa..f52f03e3e 100644 --- a/proposals/dao/fip_105.ts +++ b/proposals/dao/fip_105.ts @@ -3,6 +3,7 @@ import { expect } from 'chai'; import { DeployUpgradeFunc, NamedAddresses, + NamedContracts, SetupUpgradeFunc, TeardownUpgradeFunc, ValidateUpgradeFunc @@ -187,13 +188,8 @@ const teardown: TeardownUpgradeFunc = async (addresses, oldContracts, contracts, // Run any validations required on the fip using mocha or console logging // IE check balances, check state of contracts, etc. const validate: ValidateUpgradeFunc = async (addresses, oldContracts, contracts, logging) => { - poolId = '0xd10386804959a121a8a487e49f45aa9f5a2eb2a00002000000000000000001f1'; - const dpiToDaiLBPSwapper = contracts.dpiToDaiLBPSwapper; - const dpiToDaiLBPPool = contracts.dpiToDaiLBPPool; const core = contracts.core; - - const retrievedPoolId = await dpiToDaiLBPPool.getPoolId(); - expect(retrievedPoolId).to.equal(poolId); + poolId = '0xd10386804959a121a8a487e49f45aa9f5a2eb2a00002000000000000000001f1'; console.log('Final DAI PSM dai balance [M]', (await contracts.compoundDaiPCVDeposit.balance()) / 1e24); //////////// 1. New Safe adddresses ////////////// @@ -201,44 +197,12 @@ const validate: ValidateUpgradeFunc = async (addresses, oldContracts, contracts, expect(await contracts.pcvGuardianNew.isSafeAddress(addresses.dpiToDaiLBPSwapper)).to.be.true; ///////////// 2. DPI LBP //////////////// - expect(await dpiToDaiLBPSwapper.doInvert()).to.be.equal(true); - expect(await dpiToDaiLBPSwapper.isTimeStarted()).to.be.true; - expect(await dpiToDaiLBPPool.getSwapEnabled()).to.equal(true); - - // Check oracle - const price = (await dpiToDaiLBPSwapper.readOracle())[0]; - // DPI price in USDC - expect(price).to.be.bignumber.at.least(ethers.constants.WeiPerEther.mul(85)); - expect(price).to.be.bignumber.at.most(ethers.constants.WeiPerEther.mul(95)); - - // Check relative price in pool - const response = await dpiToDaiLBPSwapper.getTokensIn(100000); - const amounts = response[1]; - - // LUSD/FEI price * LUSD amount * 1% ~= amount - expect(amounts[1]).to.be.bignumber.equal(ethers.BigNumber.from(100000)); - expectApprox(price.mul(100000).div(ethers.constants.WeiPerEther).div(100), amounts[0]); - - // check pool weights - const weights = await dpiToDaiLBPPool.getNormalizedWeights(); - - expect(await contracts.dpi.balanceOf(dpiToDaiLBPSwapper.address)).to.be.equal(dpiSeedAmount); - expect(await contracts.dai.balanceOf(dpiToDaiLBPSwapper.address)).to.be.equal(daiSeedAmount); - - // await time.increase(await dpiToDaiLBPSwapper.remainingTime()); - // expect(await dpiToDaiLBPSwapper.isTimeEnded()).to.be.true; + await validateLBPSetup(contracts, addresses, poolId); // Validate SWAP_ADMIN_ROLE is under ROLE_ADMIN and that TribalCouncilTimelock has the role expect(await core.hasRole(ethers.utils.id('SWAP_ADMIN_ROLE'), addresses.tribalCouncilTimelock)).to.be.true; expect(await core.getRoleAdmin(ethers.utils.id('SWAP_ADMIN_ROLE'))).to.be.equal(ethers.utils.id('ROLE_ADMIN')); - const signer = await getImpersonatedSigner(addresses.tribalCouncilTimelock); - await dpiToDaiLBPSwapper.connect(signer).swap(); - expect(await dpiToDaiLBPSwapper.isTimeEnded()).to.be.false; - - // Validate time remaining resets - expect(await dpiToDaiLBPSwapper.remainingTime()).to.be.bignumber.equal(toBN(86400 * 14)); - //////// 3. Nope DAO Voting Period fix ///////////// expect(await contracts.nopeDAO.votingPeriod()).to.be.equal(26585); @@ -258,4 +222,91 @@ const validate: ValidateUpgradeFunc = async (addresses, oldContracts, contracts, logging && console.log('Final Aave Eth PCV Balance: ', finalAavePCVBalance.toString()); }; +const validateLBPSetup = async (contracts: NamedContracts, addresses: NamedAddresses, poolId: string) => { + const dpiToDaiLBPSwapper = contracts.dpiToDaiLBPSwapper; + const dpiToDaiLBPPool = contracts.dpiToDaiLBPPool; + const govSigner = await getImpersonatedSigner(addresses.feiDAOTimelock); + // swap already happened, needs inverting before + + const retrievedPoolId = await dpiToDaiLBPPool.getPoolId(); + expect(retrievedPoolId).to.equal(poolId); + + // expect(await dpiToDaiLBPSwapper.doInvert()).to.be.equal(true); + expect(await dpiToDaiLBPSwapper.isTimeStarted()).to.be.true; + expect(await dpiToDaiLBPSwapper.tokenSpent()).to.equal(addresses.dpi); + expect(await dpiToDaiLBPSwapper.tokenReceived()).to.equal(addresses.dai); + expect(await dpiToDaiLBPPool.getSwapEnabled()).to.equal(true); + // tokenSpent = DPI + // tokenReceived = DAI + + // 2.1 Check oracle price + const price = (await dpiToDaiLBPSwapper.readOracle())[0]; // DAI price in units of DPI + console.log('price: ', price); + expect(price).to.be.bignumber.at.least(ethers.constants.WeiPerEther.mul(90)); // 90e18 + expect(price).to.be.bignumber.at.most(ethers.constants.WeiPerEther.mul(100)); // 100e18 + + // On BalancerVault, token[0] = DPI, token[1] = DAI + // Therefore, on LBPSwapper, assets[0] = DPI, assets[1] = DAI + + // 2.2 Check relative price in pool + // Putting in 100,000 tokens of DPI, getting an amount of DAI back + const response = await dpiToDaiLBPSwapper.getTokensIn(100000); // input is spent token balance, 100,000 DPI tokens + const amounts = response[1]; + + console.log('amounts 0: ', amounts[0].toString()); + console.log('amounts 1: ', amounts[1].toString()); + + expect(amounts[0]).to.be.bignumber.equal(ethers.BigNumber.from(100000)); // DPI + + // DAI/DPI price * DAI amount * 5% ~= amount + // Not sure this oracle price should be inverted? + expectApprox(price.mul(100000).mul(5).div(ethers.constants.WeiPerEther).div(100), amounts[1]); // DAI + + // 2.3 Check pool weights + const weights = await dpiToDaiLBPPool.getNormalizedWeights(); + console.log('weights: ', weights); + // DAI weight ~5%, or is this DPI weight? What order is it reported in? + // are these weights the correct way round? TODO: Verify this pool and check + expectApprox(weights[0], ethers.constants.WeiPerEther.mul(5).div(100)); // 5% DAI + // DPI weight ~95% + expectApprox(weights[1], ethers.constants.WeiPerEther.mul(95).div(100)); // 95% DPI + + // Basically no DAI is being transferred????? Why???????? + // 2.4 Check pool info + const poolTokens = await contracts.balancerVault.getPoolTokens(poolId); + console.log('DAI balance: ', poolTokens.balances[1]); + console.log('DPI balance: ', poolTokens.balances[0]); + // there should be 187k DAI in the pool + expect(poolTokens.tokens[1]).to.be.equal(contracts.dai.address); // this is DAI + // there is only 21 DAI in the pool. Why????? + expect(poolTokens.balances[1]).to.be.equal('187947000000000000000000'); + // there should be 37k DPI in the pool + expect(poolTokens.tokens[0]).to.be.equal(contracts.dpi.address); // this is DPI + expect(poolTokens.balances[0]).to.be.equal('37888449801955370645659'); + + // Swapping DPI for DAI. Will initially pay a + // await balancerVault.swap( + // { + // poolId: poolId, + // kind: 0, + // assetIn: tribe.address, + // assetOut: fei.address, + // amount: `30${e18}`, + // userData: '0x' + // }, + // { + // sender: accounts[0], + // fromInternalBalance: false, + // recipient: accounts[0], + // toInternalBalance: false + // }, + // 0, + // '10000000000000000000000' + // ); + + // Accelerate time and check ended + await time.increase(LBP_FREQUENCY); + expect(await dpiToDaiLBPSwapper.isTimeEnded()).to.be.true; +}; + export { deploy, setup, teardown, validate }; diff --git a/proposals/description/fip_105.ts b/proposals/description/fip_105.ts index 874e7abef..627e557fa 100644 --- a/proposals/description/fip_105.ts +++ b/proposals/description/fip_105.ts @@ -25,6 +25,14 @@ const fip_105: ProposalDescription = { arguments: ['{dpiToDaiLBPSwapper}', '187947000000000000000000'], description: 'Withdraw DAI from the CompoundPCVDeposit and transfer to the LBP pool' }, + // Correcting the oracle needs to happen before forceSwap() + { + target: 'dpiToDaiLBPSwapper', + values: '0', + method: 'setDoInvert(bool)', + arguments: [false], + description: 'Set the dpiToDai LBP swapper to not invert' + }, { target: 'dpiToDaiLBPSwapper', values: '0', From ad07c650927b8edcecdd4181162a48188be571f0 Mon Sep 17 00:00:00 2001 From: Erwan Beauvois Date: Wed, 11 May 2022 10:33:51 +0200 Subject: [PATCH 110/274] Update DEBUG proposal type to use replaceArgs --- scripts/utils/simulateTimelockProposal.ts | 4 ++-- test/integration/setup/index.ts | 28 +++++------------------ 2 files changed, 8 insertions(+), 24 deletions(-) diff --git a/scripts/utils/simulateTimelockProposal.ts b/scripts/utils/simulateTimelockProposal.ts index aa20d11be..9d0035df5 100644 --- a/scripts/utils/simulateTimelockProposal.ts +++ b/scripts/utils/simulateTimelockProposal.ts @@ -85,7 +85,7 @@ export async function simulateTimelockProposal( } // Recursively interpolate strings in the argument array -const replaceArgs = (args: any[], contractNames: NamedAddresses) => { +export function replaceArgs(args: any[], contractNames: NamedAddresses) { const result = []; for (let i = 0; i < args.length; i++) { const element = args[i]; @@ -99,4 +99,4 @@ const replaceArgs = (args: any[], contractNames: NamedAddresses) => { } } return result; -}; +} diff --git a/test/integration/setup/index.ts b/test/integration/setup/index.ts index e3d7efcb5..d8f4217ab 100644 --- a/test/integration/setup/index.ts +++ b/test/integration/setup/index.ts @@ -1,4 +1,5 @@ import { ethers } from 'hardhat'; +import { Contract } from '@ethersproject/contracts'; import { permissions } from '@protocol/permissions'; import { getAllContractAddresses, getAllContracts } from './loadContracts'; import { @@ -23,6 +24,7 @@ import '@nomiclabs/hardhat-ethers'; import { resetFork } from '@test/helpers'; import { simulateOAProposal } from '@scripts/utils/simulateTimelockProposal'; import { simulateTCProposal } from '@scripts/utils/simulateTimelockProposal'; +import { replaceArgs } from '@scripts/utils/simulateTimelockProposal'; import { forceEth } from '@test/integration/setup/utils'; import { getImpersonatedSigner } from '@test/helpers'; @@ -192,31 +194,13 @@ export class TestEndtoEndCoordinator implements TestCoordinator { const cmd = config.proposal.commands[i]; // build tx & print details console.log(' Step' + (config.proposal.commands.length >= 10 && i < 10 ? ' ' : ''), i, ':', cmd.description); - let types = []; - if (cmd.method.indexOf('(') !== -1 && cmd.method.indexOf('()') === -1) { - // e.g. ['address', 'bytes32', 'uint256'], or empty array [] - types = cmd.method.split('(')[1].split(')')[0].split(','); - } - const cmdArguments = cmd.arguments.map((arg) => { - if (arg.indexOf('{') == 0) { - arg = contractAddresses[arg.replace('{', '').replace('}', '')] || arg; - } - return arg; - }); - const functionSig = ethers.utils.keccak256(ethers.utils.toUtf8Bytes(cmd.method)); - const calldata = ethers.utils.defaultAbiCoder - .encode(types, cmdArguments) - .replace('0x', functionSig.substring(0, 10)); // prepend function signature const to = contractAddresses[cmd.target] || cmd.target; const value = cmd.values; + const args = replaceArgs(cmd.arguments, contractAddresses); + const ethersContract: Contract = contracts[cmd.target] as Contract; + const calldata = ethersContract.interface.encodeFunctionData(cmd.method, args); console.log(' Target:', cmd.target, '[' + to + ']'); - console.log(' Method:', cmd.method); - types.forEach((type, i) => { - console.log(' Argument', i, '[' + type + ']', cmdArguments[i]); - }); - //console.log(' Value:', value); - //console.log(' Calldata:', calldata); - console.log(' Calling... '); + console.log(' Method:', cmd.method, '- Calling...'); // send tx const tx = await signer.sendTransaction({ data: calldata, to, value: Number(value) }); From e851e4c7dccb348b2e9bf0fc474b4c227d2a2a21 Mon Sep 17 00:00:00 2001 From: thomas-waite Date: Thu, 19 May 2022 17:14:25 +0100 Subject: [PATCH 111/274] test: validate pool balances --- proposals/dao/fip_105.ts | 33 +++++++++++++------------------- proposals/description/fip_105.ts | 2 +- 2 files changed, 14 insertions(+), 21 deletions(-) diff --git a/proposals/dao/fip_105.ts b/proposals/dao/fip_105.ts index f52f03e3e..830cd316f 100644 --- a/proposals/dao/fip_105.ts +++ b/proposals/dao/fip_105.ts @@ -225,8 +225,6 @@ const validate: ValidateUpgradeFunc = async (addresses, oldContracts, contracts, const validateLBPSetup = async (contracts: NamedContracts, addresses: NamedAddresses, poolId: string) => { const dpiToDaiLBPSwapper = contracts.dpiToDaiLBPSwapper; const dpiToDaiLBPPool = contracts.dpiToDaiLBPPool; - const govSigner = await getImpersonatedSigner(addresses.feiDAOTimelock); - // swap already happened, needs inverting before const retrievedPoolId = await dpiToDaiLBPPool.getPoolId(); expect(retrievedPoolId).to.equal(poolId); @@ -238,6 +236,8 @@ const validateLBPSetup = async (contracts: NamedContracts, addresses: NamedAddre expect(await dpiToDaiLBPPool.getSwapEnabled()).to.equal(true); // tokenSpent = DPI // tokenReceived = DAI + // On BalancerVault, token[0] = DPI, token[1] = DAI + // Therefore, on LBPSwapper, assets[0] = DPI, assets[1] = DAI // 2.1 Check oracle price const price = (await dpiToDaiLBPSwapper.readOracle())[0]; // DAI price in units of DPI @@ -245,45 +245,38 @@ const validateLBPSetup = async (contracts: NamedContracts, addresses: NamedAddre expect(price).to.be.bignumber.at.least(ethers.constants.WeiPerEther.mul(90)); // 90e18 expect(price).to.be.bignumber.at.most(ethers.constants.WeiPerEther.mul(100)); // 100e18 - // On BalancerVault, token[0] = DPI, token[1] = DAI - // Therefore, on LBPSwapper, assets[0] = DPI, assets[1] = DAI - // 2.2 Check relative price in pool // Putting in 100,000 tokens of DPI, getting an amount of DAI back const response = await dpiToDaiLBPSwapper.getTokensIn(100000); // input is spent token balance, 100,000 DPI tokens const amounts = response[1]; - - console.log('amounts 0: ', amounts[0].toString()); - console.log('amounts 1: ', amounts[1].toString()); - expect(amounts[0]).to.be.bignumber.equal(ethers.BigNumber.from(100000)); // DPI // DAI/DPI price * DAI amount * 5% ~= amount - // Not sure this oracle price should be inverted? expectApprox(price.mul(100000).mul(5).div(ethers.constants.WeiPerEther).div(100), amounts[1]); // DAI + expect(amounts[1]).to.be.bignumber.at.least(toBN(1000)); // Make sure orcacle inversion is correct (i.e. not inverted) // 2.3 Check pool weights const weights = await dpiToDaiLBPPool.getNormalizedWeights(); - console.log('weights: ', weights); - // DAI weight ~5%, or is this DPI weight? What order is it reported in? - // are these weights the correct way round? TODO: Verify this pool and check expectApprox(weights[0], ethers.constants.WeiPerEther.mul(5).div(100)); // 5% DAI - // DPI weight ~95% expectApprox(weights[1], ethers.constants.WeiPerEther.mul(95).div(100)); // 95% DPI - // Basically no DAI is being transferred????? Why???????? // 2.4 Check pool info const poolTokens = await contracts.balancerVault.getPoolTokens(poolId); - console.log('DAI balance: ', poolTokens.balances[1]); - console.log('DPI balance: ', poolTokens.balances[0]); - // there should be 187k DAI in the pool + // there should be 188k DAI in the pool expect(poolTokens.tokens[1]).to.be.equal(contracts.dai.address); // this is DAI - // there is only 21 DAI in the pool. Why????? - expect(poolTokens.balances[1]).to.be.equal('187947000000000000000000'); + expect(poolTokens.balances[1]).to.be.bignumber.at.least(ethers.constants.WeiPerEther.mul(185_000)); + expect(poolTokens.balances[1]).to.be.bignumber.at.most(ethers.constants.WeiPerEther.mul(190_000)); // there should be 37k DPI in the pool expect(poolTokens.tokens[0]).to.be.equal(contracts.dpi.address); // this is DPI expect(poolTokens.balances[0]).to.be.equal('37888449801955370645659'); + // Pool balances Maths: + // Total value of pool = (188k DAI * $1) + (37k DPI * $93) = $3.63M + // DAI share = 5% + // DPI share = 95% + // Expected DAI amount = $3.63M * 0.05 = ~$181k + // Expected DPI amount = $3.63M * 0.95 = ~$3.5M -> ~ ($3500k / 93) 37k DPI + // Swapping DPI for DAI. Will initially pay a // await balancerVault.swap( // { diff --git a/proposals/description/fip_105.ts b/proposals/description/fip_105.ts index 627e557fa..1802f17db 100644 --- a/proposals/description/fip_105.ts +++ b/proposals/description/fip_105.ts @@ -22,7 +22,7 @@ const fip_105: ProposalDescription = { target: 'compoundDaiPCVDeposit', values: '0', method: 'withdraw(address,uint256)', - arguments: ['{dpiToDaiLBPSwapper}', '187947000000000000000000'], + arguments: ['{dpiToDaiLBPSwapper}', '200000000000000000000000'], description: 'Withdraw DAI from the CompoundPCVDeposit and transfer to the LBP pool' }, // Correcting the oracle needs to happen before forceSwap() From d388b5268e19a2f0a78d4be3d0d6f3745a1dad6f Mon Sep 17 00:00:00 2001 From: thomas-waite Date: Thu, 19 May 2022 17:18:03 +0100 Subject: [PATCH 112/274] docs: update proposal copy --- proposals/dao/fip_105.ts | 24 +----------------------- proposals/description/fip_105.ts | 1 + 2 files changed, 2 insertions(+), 23 deletions(-) diff --git a/proposals/dao/fip_105.ts b/proposals/dao/fip_105.ts index 830cd316f..88ff08f55 100644 --- a/proposals/dao/fip_105.ts +++ b/proposals/dao/fip_105.ts @@ -25,6 +25,7 @@ DAO Proposal #105 4. Transfer CREAM to TribalCouncil multisig, where it will then be sold to ETH 5. Withdraw 15,000 WETH from DAO timelock to the aaveETHPCVDeposit 6. Fund TC with 10 eth +7. Invert oracle price on LBP swapper and forceSwap() */ // LBP Swapper config @@ -32,9 +33,6 @@ const LBP_FREQUENCY = 86400 * 14; // 2 weeks in seconds const MIN_LBP_SIZE = ethers.constants.WeiPerEther.mul(10_000); // 10k let poolId; // auction pool id -const daiSeedAmount = toBN('187947000000000000000000'); -const dpiSeedAmount = toBN('37888449801955370645659'); - const fipNumber = '105'; const skimThreshold = ethers.constants.WeiPerEther.mul(20_000_000); @@ -277,26 +275,6 @@ const validateLBPSetup = async (contracts: NamedContracts, addresses: NamedAddre // Expected DAI amount = $3.63M * 0.05 = ~$181k // Expected DPI amount = $3.63M * 0.95 = ~$3.5M -> ~ ($3500k / 93) 37k DPI - // Swapping DPI for DAI. Will initially pay a - // await balancerVault.swap( - // { - // poolId: poolId, - // kind: 0, - // assetIn: tribe.address, - // assetOut: fei.address, - // amount: `30${e18}`, - // userData: '0x' - // }, - // { - // sender: accounts[0], - // fromInternalBalance: false, - // recipient: accounts[0], - // toInternalBalance: false - // }, - // 0, - // '10000000000000000000000' - // ); - // Accelerate time and check ended await time.increase(LBP_FREQUENCY); expect(await dpiToDaiLBPSwapper.isTimeEnded()).to.be.true; diff --git a/proposals/description/fip_105.ts b/proposals/description/fip_105.ts index 1802f17db..0880c226e 100644 --- a/proposals/description/fip_105.ts +++ b/proposals/description/fip_105.ts @@ -140,6 +140,7 @@ const fip_105: ProposalDescription = { expected 4 days - Fund the TribalCouncil with 10 Eth - Transfer 15,000 WETH from the DAO timelock to the aaveETHPCVDeposit + - Invert oracle price on LBP swapper and initiate auction ` }; From f0c7384938e02800f96bb06c549e46b6ff48ae14 Mon Sep 17 00:00:00 2001 From: thomas-waite Date: Thu, 19 May 2022 19:03:17 +0100 Subject: [PATCH 113/274] feat: peform swap in validation and get implied dpi price further overfund --- block.txt | 2 +- proposals/dao/fip_105.ts | 46 +++++++++++++++++++++++++++++++- proposals/description/fip_105.ts | 2 +- 3 files changed, 47 insertions(+), 3 deletions(-) diff --git a/block.txt b/block.txt index 435e4a6c8..f14424f9e 100644 --- a/block.txt +++ b/block.txt @@ -1 +1 @@ -14800818 \ No newline at end of file +14806301 \ No newline at end of file diff --git a/proposals/dao/fip_105.ts b/proposals/dao/fip_105.ts index 88ff08f55..70af246df 100644 --- a/proposals/dao/fip_105.ts +++ b/proposals/dao/fip_105.ts @@ -263,7 +263,7 @@ const validateLBPSetup = async (contracts: NamedContracts, addresses: NamedAddre // there should be 188k DAI in the pool expect(poolTokens.tokens[1]).to.be.equal(contracts.dai.address); // this is DAI expect(poolTokens.balances[1]).to.be.bignumber.at.least(ethers.constants.WeiPerEther.mul(185_000)); - expect(poolTokens.balances[1]).to.be.bignumber.at.most(ethers.constants.WeiPerEther.mul(190_000)); + expect(poolTokens.balances[1]).to.be.bignumber.at.most(ethers.constants.WeiPerEther.mul(200_000)); // there should be 37k DPI in the pool expect(poolTokens.tokens[0]).to.be.equal(contracts.dpi.address); // this is DPI expect(poolTokens.balances[0]).to.be.equal('37888449801955370645659'); @@ -275,6 +275,50 @@ const validateLBPSetup = async (contracts: NamedContracts, addresses: NamedAddre // Expected DAI amount = $3.63M * 0.05 = ~$181k // Expected DPI amount = $3.63M * 0.95 = ~$3.5M -> ~ ($3500k / 93) 37k DPI + // Validate that a swap can occur + const daiWhale = '0x5d3a536e4d6dbd6114cc1ead35777bab948e3643'; + const daiWhaleSigner = await getImpersonatedSigner(daiWhale); + await forceEth(daiWhale); + + const initialUserDpiBalance = await contracts.dpi.balanceOf(daiWhale); + const initialUserDaiBalance = await contracts.dai.balanceOf(daiWhale); + + const amountIn = ethers.constants.WeiPerEther.mul(10_000); + await contracts.dai.connect(daiWhaleSigner).approve(addresses.balancerVault, amountIn); + await contracts.balancerVault.connect(daiWhaleSigner).swap( + { + poolId: poolId, + kind: 0, + assetIn: addresses.dai, + assetOut: addresses.dpi, + amount: amountIn, + userData: '0x' + }, + { + sender: daiWhale, + fromInternalBalance: false, + recipient: daiWhale, + toInternalBalance: false + }, + 0, + '10000000000000000000000' + ); + + const postUserDpiBalance = await contracts.dpi.balanceOf(daiWhale); + const postUserDaiBalance = await contracts.dai.balanceOf(daiWhale); + + const daiSpent = initialUserDaiBalance.sub(postUserDaiBalance); + expect(daiSpent).to.be.bignumber.equal(amountIn); + + const dpiGained = postUserDpiBalance.sub(initialUserDpiBalance); + expect(dpiGained).to.be.bignumber.at.least(ethers.constants.WeiPerEther.mul(100)); + expect(dpiGained).to.be.bignumber.at.most(ethers.constants.WeiPerEther.mul(110)); + + // Put in 10k DAI, got out 101 DPI + // Implies price of $98.5 per DPI, compared to an oracle price of $95.6 + console.log('DAI spent: ', daiSpent); + console.log('DPI gained: ', dpiGained); + // Accelerate time and check ended await time.increase(LBP_FREQUENCY); expect(await dpiToDaiLBPSwapper.isTimeEnded()).to.be.true; diff --git a/proposals/description/fip_105.ts b/proposals/description/fip_105.ts index 0880c226e..99c09ebcd 100644 --- a/proposals/description/fip_105.ts +++ b/proposals/description/fip_105.ts @@ -22,7 +22,7 @@ const fip_105: ProposalDescription = { target: 'compoundDaiPCVDeposit', values: '0', method: 'withdraw(address,uint256)', - arguments: ['{dpiToDaiLBPSwapper}', '200000000000000000000000'], + arguments: ['{dpiToDaiLBPSwapper}', '230000000000000000000000'], description: 'Withdraw DAI from the CompoundPCVDeposit and transfer to the LBP pool' }, // Correcting the oracle needs to happen before forceSwap() From 7898138d3fecedbff612328f700ea1c06db76d93 Mon Sep 17 00:00:00 2001 From: thomas-waite Date: Thu, 19 May 2022 21:12:57 +0100 Subject: [PATCH 114/274] test: add second swap gives more DPI validation --- proposals/dao/fip_105.ts | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/proposals/dao/fip_105.ts b/proposals/dao/fip_105.ts index 70af246df..6f6e26d8d 100644 --- a/proposals/dao/fip_105.ts +++ b/proposals/dao/fip_105.ts @@ -319,6 +319,31 @@ const validateLBPSetup = async (contracts: NamedContracts, addresses: NamedAddre console.log('DAI spent: ', daiSpent); console.log('DPI gained: ', dpiGained); + await time.increase(86400 * 7); + // Perform second swap, check price goes down + await contracts.dai.connect(daiWhaleSigner).approve(addresses.balancerVault, amountIn); + await contracts.balancerVault.connect(daiWhaleSigner).swap( + { + poolId: poolId, + kind: 0, + assetIn: addresses.dai, + assetOut: addresses.dpi, + amount: amountIn, + userData: '0x' + }, + { + sender: daiWhale, + fromInternalBalance: false, + recipient: daiWhale, + toInternalBalance: false + }, + 0, + '10000000000000000000000' + ); + const secondSwapDPIAmount = (await contracts.dpi.balanceOf(daiWhale)).sub(postUserDpiBalance); + // If price has dropped, then for the same DAI the user gets more DPI + expect(secondSwapDPIAmount).to.be.bignumber.greaterThan(dpiGained); + // Accelerate time and check ended await time.increase(LBP_FREQUENCY); expect(await dpiToDaiLBPSwapper.isTimeEnded()).to.be.true; From 32aed686cacd3ae0c958c62e0b3798bfd7090c2d Mon Sep 17 00:00:00 2001 From: thomas-waite Date: Thu, 19 May 2022 21:46:43 +0100 Subject: [PATCH 115/274] refactor: update fip number --- proposals/dao/{fip_105.ts => fip_104.ts} | 0 proposals/description/{fip_105.ts => fip_104.ts} | 8 ++++---- test/integration/proposals_config.ts | 6 +++--- 3 files changed, 7 insertions(+), 7 deletions(-) rename proposals/dao/{fip_105.ts => fip_104.ts} (100%) rename proposals/description/{fip_105.ts => fip_104.ts} (96%) diff --git a/proposals/dao/fip_105.ts b/proposals/dao/fip_104.ts similarity index 100% rename from proposals/dao/fip_105.ts rename to proposals/dao/fip_104.ts diff --git a/proposals/description/fip_105.ts b/proposals/description/fip_104.ts similarity index 96% rename from proposals/description/fip_105.ts rename to proposals/description/fip_104.ts index 99c09ebcd..36e31e66a 100644 --- a/proposals/description/fip_105.ts +++ b/proposals/description/fip_104.ts @@ -1,7 +1,7 @@ import { ProposalDescription } from '@custom-types/types'; -const fip_105: ProposalDescription = { - title: 'FIP-105: Reinforce PCV by consolidating assets and perform technical maintenance', +const fip_104: ProposalDescription = { + title: 'FIP-104: Reinforce PCV by consolidating assets and perform technical maintenance', commands: [ { target: 'pcvGuardianNew', @@ -121,7 +121,7 @@ const fip_105: ProposalDescription = { } ], description: ` - FIP-105: Reinforce PCV by consolidating assets and perform technical maintenance. + FIP-104: Reinforce PCV by consolidating assets and perform technical maintenance. This FIP implements parts of the PCV reinforcement proposal that was approved in this snapshot: https://snapshot.fei.money/#/proposal/0x2fd5bdda0067098f6c0520fe309dfe90ca403758f0ce98c1854a00bf38999674 @@ -144,4 +144,4 @@ const fip_105: ProposalDescription = { ` }; -export default fip_105; +export default fip_104; diff --git a/test/integration/proposals_config.ts b/test/integration/proposals_config.ts index d03f290e4..ef53943df 100644 --- a/test/integration/proposals_config.ts +++ b/test/integration/proposals_config.ts @@ -1,13 +1,13 @@ import { ProposalCategory, ProposalsConfigMap } from '@custom-types/types'; -import fip_105 from '@proposals/description/fip_105'; +import fip_104 from '@proposals/description/fip_104'; // import fip_xx_proposal from '@proposals/description/fip_xx'; const proposals: ProposalsConfigMap = { - fip_105: { + fip_104: { deploy: false, // deploy flag for whether to run deploy action during e2e tests or use mainnet state totalValue: 0, // amount of ETH to send to DAO execution - proposal: fip_105, // full proposal file, imported from '@proposals/description/fip_xx.ts' + proposal: fip_104, // full proposal file, imported from '@proposals/description/fip_xx.ts' proposalId: '', affectedContractSignoff: [ 'daiFixedPricePSMFeiSkimmer', From 041155c1ab80de70a54bd92ad86f1a0e2c50060f Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 19 May 2022 23:14:11 +0000 Subject: [PATCH 116/274] Bump ethers from 5.6.5 to 5.6.6 Bumps [ethers](https://github.com/ethers-io/ethers.js/tree/HEAD/packages/ethers) from 5.6.5 to 5.6.6. - [Release notes](https://github.com/ethers-io/ethers.js/releases) - [Changelog](https://github.com/ethers-io/ethers.js/blob/master/CHANGELOG.md) - [Commits](https://github.com/ethers-io/ethers.js/commits/v5.6.6/packages/ethers) --- updated-dependencies: - dependency-name: ethers dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- package-lock.json | 126 +++++++++++++++++++++++----------------------- package.json | 2 +- 2 files changed, 64 insertions(+), 64 deletions(-) diff --git a/package-lock.json b/package-lock.json index 4bb4b28ed..9e427e014 100644 --- a/package-lock.json +++ b/package-lock.json @@ -49,7 +49,7 @@ "eslint-plugin-import": "^2.26.0", "eslint-plugin-prettier": "^4.0.0", "ethereum-waffle": "^3.4.4", - "ethers": "^5.6.5", + "ethers": "^5.6.6", "husky": "^8.0.1", "lint-staged": "^12.4.1", "mocha": "^10.0.0", @@ -844,9 +844,9 @@ } }, "node_modules/@ethersproject/abi": { - "version": "5.6.1", - "resolved": "https://registry.npmjs.org/@ethersproject/abi/-/abi-5.6.1.tgz", - "integrity": "sha512-0cqssYh6FXjlwKWBmLm3+zH2BNARoS5u/hxbz+LpQmcDB3w0W553h2btWui1/uZp2GBM/SI3KniTuMcYyHpA5w==", + "version": "5.6.2", + "resolved": "https://registry.npmjs.org/@ethersproject/abi/-/abi-5.6.2.tgz", + "integrity": "sha512-40Ixjhy+YzFtnvzIqFU13FW9hd1gMoLa3cJfSDnfnL4o8EnEG1qLiV8sNJo3sHYi9UYMfFeRuZ7kv5+vhzU7gQ==", "funding": [ { "type": "individual", @@ -894,9 +894,9 @@ } }, "node_modules/@ethersproject/abstract-signer": { - "version": "5.6.0", - "resolved": "https://registry.npmjs.org/@ethersproject/abstract-signer/-/abstract-signer-5.6.0.tgz", - "integrity": "sha512-WOqnG0NJKtI8n0wWZPReHtaLkDByPL67tn4nBaDAhmVq8sjHTPbCdz4DRhVu/cfTOvfy9w3iq5QZ7BX7zw56BQ==", + "version": "5.6.1", + "resolved": "https://registry.npmjs.org/@ethersproject/abstract-signer/-/abstract-signer-5.6.1.tgz", + "integrity": "sha512-xhSLo6y0nGJS7NxfvOSzCaWKvWb1TLT7dQ0nnpHZrDnC67xfnWm9NXflTMFPUXXMtjr33CdV0kWDEmnbrQZ74Q==", "funding": [ { "type": "individual", @@ -975,9 +975,9 @@ } }, "node_modules/@ethersproject/bignumber": { - "version": "5.6.0", - "resolved": "https://registry.npmjs.org/@ethersproject/bignumber/-/bignumber-5.6.0.tgz", - "integrity": "sha512-VziMaXIUHQlHJmkv1dlcd6GY2PmT0khtAqaMctCIDogxkrarMzA9L94KN1NeXqqOfFD6r0sJT3vCTOFSmZ07DA==", + "version": "5.6.1", + "resolved": "https://registry.npmjs.org/@ethersproject/bignumber/-/bignumber-5.6.1.tgz", + "integrity": "sha512-UtMeZ3GaUuF9sx2u9nPZiPP3ULcAFmXyvynR7oHl/tPrM+vldZh7ocMsoa1PqKYGnQnqUZJoqxZnGN6J0qdipA==", "funding": [ { "type": "individual", @@ -1036,9 +1036,9 @@ } }, "node_modules/@ethersproject/contracts": { - "version": "5.6.0", - "resolved": "https://registry.npmjs.org/@ethersproject/contracts/-/contracts-5.6.0.tgz", - "integrity": "sha512-74Ge7iqTDom0NX+mux8KbRUeJgu1eHZ3iv6utv++sLJG80FVuU9HnHeKVPfjd9s3woFhaFoQGf3B3iH/FrQmgw==", + "version": "5.6.1", + "resolved": "https://registry.npmjs.org/@ethersproject/contracts/-/contracts-5.6.1.tgz", + "integrity": "sha512-0fpBBDoPqJMsutE6sNjg6pvCJaIcl7tliMQTMRcoUWDACfjO68CpKOJBlsEhEhmzdnu/41KbrfAeg+sB3y35MQ==", "funding": [ { "type": "individual", @@ -1113,9 +1113,9 @@ } }, "node_modules/@ethersproject/hdnode": { - "version": "5.6.0", - "resolved": "https://registry.npmjs.org/@ethersproject/hdnode/-/hdnode-5.6.0.tgz", - "integrity": "sha512-61g3Jp3nwDqJcL/p4nugSyLrpl/+ChXIOtCEM8UDmWeB3JCAt5FoLdOMXQc3WWkc0oM2C0aAn6GFqqMcS/mHTw==", + "version": "5.6.1", + "resolved": "https://registry.npmjs.org/@ethersproject/hdnode/-/hdnode-5.6.1.tgz", + "integrity": "sha512-6IuYDmbH5Bv/WH/A2cUd0FjNr4qTLAvyHAECiFZhNZp69pPvU7qIDwJ7CU7VAkwm4IVBzqdYy9mpMAGhQdwCDA==", "funding": [ { "type": "individual", @@ -1266,9 +1266,9 @@ } }, "node_modules/@ethersproject/providers": { - "version": "5.6.5", - "resolved": "https://registry.npmjs.org/@ethersproject/providers/-/providers-5.6.5.tgz", - "integrity": "sha512-TRS+c2Ud+cMpWodmGAc9xbnYRPWzRNYt2zkCSnj58nJoamBQ6x4cUbBeo0lTC3y+6RDVIBeJv18OqsDbSktLVg==", + "version": "5.6.6", + "resolved": "https://registry.npmjs.org/@ethersproject/providers/-/providers-5.6.6.tgz", + "integrity": "sha512-6X6agj3NeQ4tgnvBMCjHK+CjQbz+Qmn20JTxCYZ/uymrgCEOpJtY9zeRxJIDsSi0DPw8xNAxypj95JMCsapUfA==", "funding": [ { "type": "individual", @@ -1477,9 +1477,9 @@ } }, "node_modules/@ethersproject/wallet": { - "version": "5.6.0", - "resolved": "https://registry.npmjs.org/@ethersproject/wallet/-/wallet-5.6.0.tgz", - "integrity": "sha512-qMlSdOSTyp0MBeE+r7SUhr1jjDlC1zAXB8VD84hCnpijPQiSNbxr6GdiLXxpUs8UKzkDiNYYC5DRI3MZr+n+tg==", + "version": "5.6.1", + "resolved": "https://registry.npmjs.org/@ethersproject/wallet/-/wallet-5.6.1.tgz", + "integrity": "sha512-oXWoOslEWtwZiViIMlGVjeKDQz/tI7JF9UkyzN9jaGj8z7sXt2SyFMb0Ev6vSAqjIzrCrNrJ/+MkAhtKnGOfZw==", "funding": [ { "type": "individual", @@ -8923,9 +8923,9 @@ } }, "node_modules/ethers": { - "version": "5.6.5", - "resolved": "https://registry.npmjs.org/ethers/-/ethers-5.6.5.tgz", - "integrity": "sha512-9CTmplO9bv0s/aPw3HB3txGzKz3tUSI2EfO4dJo0W2WvaEq1ArgsEX6obV+bj5X3yY+Zgb1kAux8TDtJKe1FaA==", + "version": "5.6.6", + "resolved": "https://registry.npmjs.org/ethers/-/ethers-5.6.6.tgz", + "integrity": "sha512-2B2ZmSGvRcJpHnFMBk58mkXP50njFipUBCgLK8jUTFbomhVs501cLzyMU6+Vx8YnUDQxywC3qkZvd33xWS+2FA==", "funding": [ { "type": "individual", @@ -8937,25 +8937,25 @@ } ], "dependencies": { - "@ethersproject/abi": "5.6.1", + "@ethersproject/abi": "5.6.2", "@ethersproject/abstract-provider": "5.6.0", - "@ethersproject/abstract-signer": "5.6.0", + "@ethersproject/abstract-signer": "5.6.1", "@ethersproject/address": "5.6.0", "@ethersproject/base64": "5.6.0", "@ethersproject/basex": "5.6.0", - "@ethersproject/bignumber": "5.6.0", + "@ethersproject/bignumber": "5.6.1", "@ethersproject/bytes": "5.6.1", "@ethersproject/constants": "5.6.0", - "@ethersproject/contracts": "5.6.0", + "@ethersproject/contracts": "5.6.1", "@ethersproject/hash": "5.6.0", - "@ethersproject/hdnode": "5.6.0", + "@ethersproject/hdnode": "5.6.1", "@ethersproject/json-wallets": "5.6.0", "@ethersproject/keccak256": "5.6.0", "@ethersproject/logger": "5.6.0", "@ethersproject/networks": "5.6.2", "@ethersproject/pbkdf2": "5.6.0", "@ethersproject/properties": "5.6.0", - "@ethersproject/providers": "5.6.5", + "@ethersproject/providers": "5.6.6", "@ethersproject/random": "5.6.0", "@ethersproject/rlp": "5.6.0", "@ethersproject/sha2": "5.6.0", @@ -8964,7 +8964,7 @@ "@ethersproject/strings": "5.6.0", "@ethersproject/transactions": "5.6.0", "@ethersproject/units": "5.6.0", - "@ethersproject/wallet": "5.6.0", + "@ethersproject/wallet": "5.6.1", "@ethersproject/web": "5.6.0", "@ethersproject/wordlists": "5.6.0" } @@ -29397,9 +29397,9 @@ } }, "@ethersproject/abi": { - "version": "5.6.1", - "resolved": "https://registry.npmjs.org/@ethersproject/abi/-/abi-5.6.1.tgz", - "integrity": "sha512-0cqssYh6FXjlwKWBmLm3+zH2BNARoS5u/hxbz+LpQmcDB3w0W553h2btWui1/uZp2GBM/SI3KniTuMcYyHpA5w==", + "version": "5.6.2", + "resolved": "https://registry.npmjs.org/@ethersproject/abi/-/abi-5.6.2.tgz", + "integrity": "sha512-40Ixjhy+YzFtnvzIqFU13FW9hd1gMoLa3cJfSDnfnL4o8EnEG1qLiV8sNJo3sHYi9UYMfFeRuZ7kv5+vhzU7gQ==", "requires": { "@ethersproject/address": "^5.6.0", "@ethersproject/bignumber": "^5.6.0", @@ -29427,9 +29427,9 @@ } }, "@ethersproject/abstract-signer": { - "version": "5.6.0", - "resolved": "https://registry.npmjs.org/@ethersproject/abstract-signer/-/abstract-signer-5.6.0.tgz", - "integrity": "sha512-WOqnG0NJKtI8n0wWZPReHtaLkDByPL67tn4nBaDAhmVq8sjHTPbCdz4DRhVu/cfTOvfy9w3iq5QZ7BX7zw56BQ==", + "version": "5.6.1", + "resolved": "https://registry.npmjs.org/@ethersproject/abstract-signer/-/abstract-signer-5.6.1.tgz", + "integrity": "sha512-xhSLo6y0nGJS7NxfvOSzCaWKvWb1TLT7dQ0nnpHZrDnC67xfnWm9NXflTMFPUXXMtjr33CdV0kWDEmnbrQZ74Q==", "requires": { "@ethersproject/abstract-provider": "^5.6.0", "@ethersproject/bignumber": "^5.6.0", @@ -29468,9 +29468,9 @@ } }, "@ethersproject/bignumber": { - "version": "5.6.0", - "resolved": "https://registry.npmjs.org/@ethersproject/bignumber/-/bignumber-5.6.0.tgz", - "integrity": "sha512-VziMaXIUHQlHJmkv1dlcd6GY2PmT0khtAqaMctCIDogxkrarMzA9L94KN1NeXqqOfFD6r0sJT3vCTOFSmZ07DA==", + "version": "5.6.1", + "resolved": "https://registry.npmjs.org/@ethersproject/bignumber/-/bignumber-5.6.1.tgz", + "integrity": "sha512-UtMeZ3GaUuF9sx2u9nPZiPP3ULcAFmXyvynR7oHl/tPrM+vldZh7ocMsoa1PqKYGnQnqUZJoqxZnGN6J0qdipA==", "requires": { "@ethersproject/bytes": "^5.6.0", "@ethersproject/logger": "^5.6.0", @@ -29501,9 +29501,9 @@ } }, "@ethersproject/contracts": { - "version": "5.6.0", - "resolved": "https://registry.npmjs.org/@ethersproject/contracts/-/contracts-5.6.0.tgz", - "integrity": "sha512-74Ge7iqTDom0NX+mux8KbRUeJgu1eHZ3iv6utv++sLJG80FVuU9HnHeKVPfjd9s3woFhaFoQGf3B3iH/FrQmgw==", + "version": "5.6.1", + "resolved": "https://registry.npmjs.org/@ethersproject/contracts/-/contracts-5.6.1.tgz", + "integrity": "sha512-0fpBBDoPqJMsutE6sNjg6pvCJaIcl7tliMQTMRcoUWDACfjO68CpKOJBlsEhEhmzdnu/41KbrfAeg+sB3y35MQ==", "requires": { "@ethersproject/abi": "^5.6.0", "@ethersproject/abstract-provider": "^5.6.0", @@ -29546,9 +29546,9 @@ } }, "@ethersproject/hdnode": { - "version": "5.6.0", - "resolved": "https://registry.npmjs.org/@ethersproject/hdnode/-/hdnode-5.6.0.tgz", - "integrity": "sha512-61g3Jp3nwDqJcL/p4nugSyLrpl/+ChXIOtCEM8UDmWeB3JCAt5FoLdOMXQc3WWkc0oM2C0aAn6GFqqMcS/mHTw==", + "version": "5.6.1", + "resolved": "https://registry.npmjs.org/@ethersproject/hdnode/-/hdnode-5.6.1.tgz", + "integrity": "sha512-6IuYDmbH5Bv/WH/A2cUd0FjNr4qTLAvyHAECiFZhNZp69pPvU7qIDwJ7CU7VAkwm4IVBzqdYy9mpMAGhQdwCDA==", "requires": { "@ethersproject/abstract-signer": "^5.6.0", "@ethersproject/basex": "^5.6.0", @@ -29631,9 +29631,9 @@ } }, "@ethersproject/providers": { - "version": "5.6.5", - "resolved": "https://registry.npmjs.org/@ethersproject/providers/-/providers-5.6.5.tgz", - "integrity": "sha512-TRS+c2Ud+cMpWodmGAc9xbnYRPWzRNYt2zkCSnj58nJoamBQ6x4cUbBeo0lTC3y+6RDVIBeJv18OqsDbSktLVg==", + "version": "5.6.6", + "resolved": "https://registry.npmjs.org/@ethersproject/providers/-/providers-5.6.6.tgz", + "integrity": "sha512-6X6agj3NeQ4tgnvBMCjHK+CjQbz+Qmn20JTxCYZ/uymrgCEOpJtY9zeRxJIDsSi0DPw8xNAxypj95JMCsapUfA==", "requires": { "@ethersproject/abstract-provider": "^5.6.0", "@ethersproject/abstract-signer": "^5.6.0", @@ -29754,9 +29754,9 @@ } }, "@ethersproject/wallet": { - "version": "5.6.0", - "resolved": "https://registry.npmjs.org/@ethersproject/wallet/-/wallet-5.6.0.tgz", - "integrity": "sha512-qMlSdOSTyp0MBeE+r7SUhr1jjDlC1zAXB8VD84hCnpijPQiSNbxr6GdiLXxpUs8UKzkDiNYYC5DRI3MZr+n+tg==", + "version": "5.6.1", + "resolved": "https://registry.npmjs.org/@ethersproject/wallet/-/wallet-5.6.1.tgz", + "integrity": "sha512-oXWoOslEWtwZiViIMlGVjeKDQz/tI7JF9UkyzN9jaGj8z7sXt2SyFMb0Ev6vSAqjIzrCrNrJ/+MkAhtKnGOfZw==", "requires": { "@ethersproject/abstract-provider": "^5.6.0", "@ethersproject/abstract-signer": "^5.6.0", @@ -35928,29 +35928,29 @@ } }, "ethers": { - "version": "5.6.5", - "resolved": "https://registry.npmjs.org/ethers/-/ethers-5.6.5.tgz", - "integrity": "sha512-9CTmplO9bv0s/aPw3HB3txGzKz3tUSI2EfO4dJo0W2WvaEq1ArgsEX6obV+bj5X3yY+Zgb1kAux8TDtJKe1FaA==", + "version": "5.6.6", + "resolved": "https://registry.npmjs.org/ethers/-/ethers-5.6.6.tgz", + "integrity": "sha512-2B2ZmSGvRcJpHnFMBk58mkXP50njFipUBCgLK8jUTFbomhVs501cLzyMU6+Vx8YnUDQxywC3qkZvd33xWS+2FA==", "requires": { - "@ethersproject/abi": "5.6.1", + "@ethersproject/abi": "5.6.2", "@ethersproject/abstract-provider": "5.6.0", - "@ethersproject/abstract-signer": "5.6.0", + "@ethersproject/abstract-signer": "5.6.1", "@ethersproject/address": "5.6.0", "@ethersproject/base64": "5.6.0", "@ethersproject/basex": "5.6.0", - "@ethersproject/bignumber": "5.6.0", + "@ethersproject/bignumber": "5.6.1", "@ethersproject/bytes": "5.6.1", "@ethersproject/constants": "5.6.0", - "@ethersproject/contracts": "5.6.0", + "@ethersproject/contracts": "5.6.1", "@ethersproject/hash": "5.6.0", - "@ethersproject/hdnode": "5.6.0", + "@ethersproject/hdnode": "5.6.1", "@ethersproject/json-wallets": "5.6.0", "@ethersproject/keccak256": "5.6.0", "@ethersproject/logger": "5.6.0", "@ethersproject/networks": "5.6.2", "@ethersproject/pbkdf2": "5.6.0", "@ethersproject/properties": "5.6.0", - "@ethersproject/providers": "5.6.5", + "@ethersproject/providers": "5.6.6", "@ethersproject/random": "5.6.0", "@ethersproject/rlp": "5.6.0", "@ethersproject/sha2": "5.6.0", @@ -35959,7 +35959,7 @@ "@ethersproject/strings": "5.6.0", "@ethersproject/transactions": "5.6.0", "@ethersproject/units": "5.6.0", - "@ethersproject/wallet": "5.6.0", + "@ethersproject/wallet": "5.6.1", "@ethersproject/web": "5.6.0", "@ethersproject/wordlists": "5.6.0" } diff --git a/package.json b/package.json index 4e956eab3..2f09ec5e1 100644 --- a/package.json +++ b/package.json @@ -89,7 +89,7 @@ "eslint-plugin-import": "^2.26.0", "eslint-plugin-prettier": "^4.0.0", "ethereum-waffle": "^3.4.4", - "ethers": "^5.6.5", + "ethers": "^5.6.6", "husky": "^8.0.1", "lint-staged": "^12.4.1", "mocha": "^10.0.0", From 882dce4ad40746d296b1f507411825f14dd742f4 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 19 May 2022 23:14:19 +0000 Subject: [PATCH 117/274] build(deps): bump hardhat from 2.9.4 to 2.9.6 Bumps [hardhat](https://github.com/nomiclabs/hardhat) from 2.9.4 to 2.9.6. - [Release notes](https://github.com/nomiclabs/hardhat/releases) - [Commits](https://github.com/nomiclabs/hardhat/compare/hardhat@2.9.4...hardhat@2.9.6) --- updated-dependencies: - dependency-name: hardhat dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- package-lock.json | 18 +++++++++--------- package.json | 2 +- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/package-lock.json b/package-lock.json index 4bb4b28ed..0e1a91066 100644 --- a/package-lock.json +++ b/package-lock.json @@ -25,7 +25,7 @@ "@uniswap/v2-periphery": "^1.1.0-beta.0", "chai": "^4.3.6", "dotenv": "^16.0.1", - "hardhat": "^2.9.4", + "hardhat": "^2.9.6", "hardhat-contract-sizer": "^2.5.1", "hardhat-gas-reporter": "^1.0.8", "merkletreejs": "^0.2.31", @@ -18396,9 +18396,9 @@ } }, "node_modules/hardhat": { - "version": "2.9.4", - "resolved": "https://registry.npmjs.org/hardhat/-/hardhat-2.9.4.tgz", - "integrity": "sha512-7hpJz1lXz3H/1shcI284xgQ9WPdXGMuXKoNj8ySJKG7pdifB/lNs1o+Kx/P4TKFwhOiGQYH51/wS2NHKI+dPfg==", + "version": "2.9.6", + "resolved": "https://registry.npmjs.org/hardhat/-/hardhat-2.9.6.tgz", + "integrity": "sha512-Vnm1iDfhbavNjvLxArt47rt6G3vPIV4Q/+pNgFkh6sfQH8JVf8px5VxiEs5cj4rPxmU+DXGKoalY+pK8fAL4oA==", "dependencies": { "@ethereumjs/block": "^3.6.2", "@ethereumjs/blockchain": "^5.5.2", @@ -18427,7 +18427,7 @@ "find-up": "^2.1.0", "fp-ts": "1.19.3", "fs-extra": "^7.0.1", - "glob": "^7.1.3", + "glob": "7.2.0", "immutable": "^4.0.0-rc.12", "io-ts": "1.10.4", "lodash": "^4.17.11", @@ -43021,9 +43021,9 @@ } }, "hardhat": { - "version": "2.9.4", - "resolved": "https://registry.npmjs.org/hardhat/-/hardhat-2.9.4.tgz", - "integrity": "sha512-7hpJz1lXz3H/1shcI284xgQ9WPdXGMuXKoNj8ySJKG7pdifB/lNs1o+Kx/P4TKFwhOiGQYH51/wS2NHKI+dPfg==", + "version": "2.9.6", + "resolved": "https://registry.npmjs.org/hardhat/-/hardhat-2.9.6.tgz", + "integrity": "sha512-Vnm1iDfhbavNjvLxArt47rt6G3vPIV4Q/+pNgFkh6sfQH8JVf8px5VxiEs5cj4rPxmU+DXGKoalY+pK8fAL4oA==", "requires": { "@ethereumjs/block": "^3.6.2", "@ethereumjs/blockchain": "^5.5.2", @@ -43052,7 +43052,7 @@ "find-up": "^2.1.0", "fp-ts": "1.19.3", "fs-extra": "^7.0.1", - "glob": "^7.1.3", + "glob": "7.2.0", "immutable": "^4.0.0-rc.12", "io-ts": "1.10.4", "lodash": "^4.17.11", diff --git a/package.json b/package.json index 4e956eab3..7e0299cd0 100644 --- a/package.json +++ b/package.json @@ -65,7 +65,7 @@ "@uniswap/v2-periphery": "^1.1.0-beta.0", "chai": "^4.3.6", "dotenv": "^16.0.1", - "hardhat": "^2.9.4", + "hardhat": "^2.9.6", "hardhat-contract-sizer": "^2.5.1", "hardhat-gas-reporter": "^1.0.8", "merkletreejs": "^0.2.31", From 99a18c935f9cf4f8a198c67ddac4c8ef49dac50e Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 20 May 2022 07:21:41 +0000 Subject: [PATCH 118/274] build(deps-dev): bump @types/node from 17.0.34 to 17.0.35 Bumps [@types/node](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/node) from 17.0.34 to 17.0.35. - [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases) - [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/node) --- updated-dependencies: - dependency-name: "@types/node" dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- package-lock.json | 14 +++++++------- package.json | 2 +- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/package-lock.json b/package-lock.json index e1125b879..f247649ab 100644 --- a/package-lock.json +++ b/package-lock.json @@ -39,7 +39,7 @@ "@typechain/hardhat": "^2.3.0", "@types/chai": "^4.3.1", "@types/mocha": "^9.1.1", - "@types/node": "^17.0.34", + "@types/node": "^17.0.35", "@typescript-eslint/eslint-plugin": "^4.31.2", "@typescript-eslint/parser": "^4.31.2", "chai-bn": "^0.3.1", @@ -4471,9 +4471,9 @@ "dev": true }, "node_modules/@types/node": { - "version": "17.0.34", - "resolved": "https://registry.npmjs.org/@types/node/-/node-17.0.34.tgz", - "integrity": "sha512-XImEz7XwTvDBtzlTnm8YvMqGW/ErMWBsKZ+hMTvnDIjGCKxwK5Xpc+c/oQjOauwq8M4OS11hEkpjX8rrI/eEgA==" + "version": "17.0.35", + "resolved": "https://registry.npmjs.org/@types/node/-/node-17.0.35.tgz", + "integrity": "sha512-vu1SrqBjbbZ3J6vwY17jBs8Sr/BKA+/a/WtjRG+whKg1iuLFOosq872EXS0eXWILdO36DHQQeku/ZcL6hz2fpg==" }, "node_modules/@types/node-fetch": { "version": "2.6.1", @@ -32393,9 +32393,9 @@ "dev": true }, "@types/node": { - "version": "17.0.34", - "resolved": "https://registry.npmjs.org/@types/node/-/node-17.0.34.tgz", - "integrity": "sha512-XImEz7XwTvDBtzlTnm8YvMqGW/ErMWBsKZ+hMTvnDIjGCKxwK5Xpc+c/oQjOauwq8M4OS11hEkpjX8rrI/eEgA==" + "version": "17.0.35", + "resolved": "https://registry.npmjs.org/@types/node/-/node-17.0.35.tgz", + "integrity": "sha512-vu1SrqBjbbZ3J6vwY17jBs8Sr/BKA+/a/WtjRG+whKg1iuLFOosq872EXS0eXWILdO36DHQQeku/ZcL6hz2fpg==" }, "@types/node-fetch": { "version": "2.6.1", diff --git a/package.json b/package.json index 128784b8b..3cbf71ea9 100644 --- a/package.json +++ b/package.json @@ -79,7 +79,7 @@ "@typechain/hardhat": "^2.3.0", "@types/chai": "^4.3.1", "@types/mocha": "^9.1.1", - "@types/node": "^17.0.34", + "@types/node": "^17.0.35", "@typescript-eslint/eslint-plugin": "^4.31.2", "@typescript-eslint/parser": "^4.31.2", "chai-bn": "^0.3.1", From bf71bbf2dd00c8afa5079c499d0bc77a73b5dbc4 Mon Sep 17 00:00:00 2001 From: Erwan Beauvois Date: Fri, 20 May 2022 11:35:56 +0200 Subject: [PATCH 119/274] Restore withdrawERC20 to a vanilla impl --- contracts/metagov/BalancerGaugeStaker.sol | 30 ----------------- proposals/dao/balancer_gauge_fix.ts | 14 -------- .../tests/metagov/BalancerGaugeStaker.ts | 33 ++++++------------- 3 files changed, 10 insertions(+), 67 deletions(-) diff --git a/contracts/metagov/BalancerGaugeStaker.sol b/contracts/metagov/BalancerGaugeStaker.sol index da9f0bb82..242539ac5 100644 --- a/contracts/metagov/BalancerGaugeStaker.sol +++ b/contracts/metagov/BalancerGaugeStaker.sol @@ -73,36 +73,6 @@ contract BalancerGaugeStaker is PCVDeposit, LiquidityGaugeManager { emit Withdrawal(msg.sender, to, amount); } - /// @notice withdraw ERC20 from the contract - /// @param token address of the ERC20 to send - /// @param to address destination of the ERC20 - /// @param amount quantity of ERC20 to send - function withdrawERC20( - address token, - address to, - uint256 amount - ) public virtual override onlyPCVController whenNotPaused { - // if the token has a gauge, we unstake it from the gauge before transfer - // @dev : note that this gauge unstaking normally is access controlled to - // onlyTribeRole(TribeRoles.METAGOVERNANCE_GAUGE_ADMIN), but since - // withdrawERC20() is a higher clearance role (PCVController), this - // privilege of gauge unstaking is also made available to the PCV controller, - // that may have important reasons to quickly unstake from the gauge and move - // the staked ERC20s to another place. - address gaugeAddress = tokenToGauge[token]; - if (gaugeAddress != address(0)) { - ILiquidityGauge(gaugeAddress).withdraw(amount, false); - } - - // emit the right event if the withdrawn token - // is the one used in accounting. - if (token == BAL) { - withdraw(to, amount); - } else { - _withdrawERC20(token, to, amount); - } - } - /// @notice Mint everything which belongs to this contract in the given gauge /// @param token whose gauge should be claimed function mintGaugeRewards(address token) external whenNotPaused returns (uint256) { diff --git a/proposals/dao/balancer_gauge_fix.ts b/proposals/dao/balancer_gauge_fix.ts index 0bc17920e..ae012bf59 100644 --- a/proposals/dao/balancer_gauge_fix.ts +++ b/proposals/dao/balancer_gauge_fix.ts @@ -139,20 +139,6 @@ const validate: ValidateUpgradeFunc = async (addresses, oldContracts, contracts, expect(sourceBalanceBefore.sub(sourceBalanceAfter)).to.be.equal(withdrawAmount); expect(targetBalanceAfter.sub(targetBalanceBefore)).to.be.equal(withdrawAmount); - // check withdrawERC20() can unstake gauge & move LP tokens - const lpWithdrawAmount = `1${e18}`; - const sourceLpBalanceBefore = await contracts.balancerGaugeBpt30Fei70Weth.balanceOf(addresses.balancerGaugeStaker); - const targetLpBalanceBefore = await contracts.bpt30Fei70Weth.balanceOf(addresses.feiDAOTimelock); - await contracts.balancerGaugeStaker.withdrawERC20( - addresses.bpt30Fei70Weth, - addresses.feiDAOTimelock, - lpWithdrawAmount - ); - const sourceLpBalanceAfter = await contracts.balancerGaugeBpt30Fei70Weth.balanceOf(addresses.balancerGaugeStaker); - const targetLpBalanceAfter = await contracts.bpt30Fei70Weth.balanceOf(addresses.feiDAOTimelock); - expect(sourceLpBalanceBefore.sub(sourceLpBalanceAfter)).to.be.equal(lpWithdrawAmount); - expect(targetLpBalanceAfter.sub(targetLpBalanceBefore)).to.be.equal(lpWithdrawAmount); - // display pcvStats console.log('----------------------------------------------------'); console.log(' pcvStatsBefore.protocolControlledValue [M]e18 ', pcvStatsBefore.protocolControlledValue / 1e24); diff --git a/test/integration/tests/metagov/BalancerGaugeStaker.ts b/test/integration/tests/metagov/BalancerGaugeStaker.ts index df21ffaa9..0a1d90730 100644 --- a/test/integration/tests/metagov/BalancerGaugeStaker.ts +++ b/test/integration/tests/metagov/BalancerGaugeStaker.ts @@ -152,29 +152,16 @@ describe('e2e-metagov', function () { await staker.connect(daoSigner).unpause(); }); - describe('should work if user has PCV_CONTROLLER_ROLE role', function () { - it('should emit Withdrawal if token is BAL', async function () { - const balanceBefore = await contracts.bal.balanceOf(daoSigner.address); - expectEvent( - await staker.connect(daoSigner).withdrawERC20(contracts.bal.address, daoSigner.address, '10'), - staker, - 'Withdrawal', - [daoSigner.address, daoSigner.address, '10'] - ); - const balanceAfter = await contracts.bal.balanceOf(daoSigner.address); - expect(balanceAfter.sub(balanceBefore)).to.be.equal('10'); - }); - it('should unstake from gauge and emit WithdrawERC20 otherwise', async function () { - const balanceBefore = await contracts.bpt30Fei70Weth.balanceOf(daoSigner.address); - expectEvent( - await staker.connect(daoSigner).withdrawERC20(contracts.bpt30Fei70Weth.address, daoSigner.address, '10'), - staker, - 'WithdrawERC20', - [daoSigner.address, contracts.bpt30Fei70Weth.address, daoSigner.address, '10'] - ); - const balanceAfter = await contracts.bpt30Fei70Weth.balanceOf(daoSigner.address); - expect(balanceAfter.sub(balanceBefore)).to.be.equal('10'); - }); + it('should work if user has PCV_CONTROLLER_ROLE role', async function () { + const balanceBefore = await contracts.bal.balanceOf(daoSigner.address); + expectEvent( + await staker.connect(daoSigner).withdrawERC20(contracts.bal.address, daoSigner.address, '10'), + staker, + 'WithdrawERC20', + [daoSigner.address, contracts.bal.address, daoSigner.address, '10'] + ); + const balanceAfter = await contracts.bal.balanceOf(daoSigner.address); + expect(balanceAfter.sub(balanceBefore)).to.be.equal('10'); }); }); }); From 8f640b55223e94c73f3b0363beb85596d92787ec Mon Sep 17 00:00:00 2001 From: Erwan Beauvois Date: Fri, 20 May 2022 16:09:21 +0200 Subject: [PATCH 120/274] mainnet deploy --- block.txt | 2 +- protocol-configuration/mainnetAddresses.ts | 20 ++++++++++++++++++++ test/integration/proposals_config.ts | 2 +- 3 files changed, 22 insertions(+), 2 deletions(-) diff --git a/block.txt b/block.txt index f351c8af5..b1a280ab3 100644 --- a/block.txt +++ b/block.txt @@ -1 +1 @@ -14806301 +14811496 diff --git a/protocol-configuration/mainnetAddresses.ts b/protocol-configuration/mainnetAddresses.ts index 573b5aacd..17dae8d74 100644 --- a/protocol-configuration/mainnetAddresses.ts +++ b/protocol-configuration/mainnetAddresses.ts @@ -416,16 +416,36 @@ const MainnetAddresses: MainnetAddresses = { address: '0xc4EAc760C2C631eE0b064E39888b89158ff808B2', category: AddressCategory.Governance }, + balancerGaugeStaker: { + artifactName: 'BalancerGaugeStaker', // actually a TransparentUpgradeableProxy + address: '0x66977Ce30049CD0e443216Bf26377966c3A109E2', + category: AddressCategory.Governance + }, + balancerGaugeStakerImpl: { + artifactName: 'BalancerGaugeStaker', + address: '0xF53E251352683155898295569d77B8506bA00d80', + category: AddressCategory.Governance + }, gaugeLensBpt30Fei70WethGaugeOld: { artifactName: 'CurveGaugeLens', address: '0xa8E388a1f19f2b33Be8bf2cCeC43641C10b4D1e5', category: AddressCategory.Deprecated }, + gaugeLensBpt30Fei70WethGauge: { + artifactName: 'CurveGaugeLens', + address: '0xd9fc482E0Af8fd509699f1074d72D137cAC94D5B', + category: AddressCategory.PCV_V1 + }, balancerLensBpt30Fei70WethOld: { artifactName: 'BalancerPool2Lens', address: '0x673f7DFA863b611dE657759aEDE629b260F4E682', category: AddressCategory.Deprecated }, + balancerLensBpt30Fei70Weth: { + artifactName: 'BalancerPool2Lens', + address: '0x8465E7CFA63Aa6682531C7a34141966318aC5178', + category: AddressCategory.PCV + }, balancerLensVeBalBal: { artifactName: 'BalancerPool2Lens', address: '0x8cbA3149b95084A61bBAb9e01110b0fB92C9a289', diff --git a/test/integration/proposals_config.ts b/test/integration/proposals_config.ts index 87bd96c49..0379d9248 100644 --- a/test/integration/proposals_config.ts +++ b/test/integration/proposals_config.ts @@ -46,7 +46,7 @@ const proposals: ProposalsConfigMap = { category: ProposalCategory.DAO }, balancer_gauge_fix: { - deploy: true, // deploy flag for whether to run deploy action during e2e tests or use mainnet state + deploy: false, // deploy flag for whether to run deploy action during e2e tests or use mainnet state totalValue: 0, // amount of ETH to send to DAO execution proposal: balancer_gauge_fix, // full proposal file, imported from '@proposals/description/fip_xx.ts' proposalId: null, From d4066f4936eb69d8b3d59d6aaf2adcb8ad28b77d Mon Sep 17 00:00:00 2001 From: Erwan Beauvois Date: Fri, 20 May 2022 16:29:49 +0200 Subject: [PATCH 121/274] update dependencies --- protocol-configuration/dependencies.ts | 6 +++++- test/integration/proposals_config.ts | 13 +++++++++++-- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/protocol-configuration/dependencies.ts b/protocol-configuration/dependencies.ts index 423105767..69d380c88 100644 --- a/protocol-configuration/dependencies.ts +++ b/protocol-configuration/dependencies.ts @@ -127,7 +127,8 @@ const dependencies: DependencyMap = { 'podAdminGateway', 'podFactory', 'roleBastion', - 'daiFixedPricePSMFeiSkimmer' + 'daiFixedPricePSMFeiSkimmer', + 'balancerGaugeStaker' ] }, fei: { @@ -662,6 +663,9 @@ const dependencies: DependencyMap = { erc20Dripper: { contractDependencies: ['core', 'tribe', 'tribalChief', 'tribeMinter'] }, + balancerGaugeStaker: { + contractDependencies: ['core'] + }, rariRewardsDistributorDelegate: { contractDependencies: [ 'rariRewardsDistributorDelegator' // proxy diff --git a/test/integration/proposals_config.ts b/test/integration/proposals_config.ts index 0379d9248..8a8861c86 100644 --- a/test/integration/proposals_config.ts +++ b/test/integration/proposals_config.ts @@ -50,8 +50,17 @@ const proposals: ProposalsConfigMap = { totalValue: 0, // amount of ETH to send to DAO execution proposal: balancer_gauge_fix, // full proposal file, imported from '@proposals/description/fip_xx.ts' proposalId: null, - affectedContractSignoff: [], - deprecatedContractSignoff: [], + affectedContractSignoff: [ + 'tribalCouncilTimelock', + 'balancerDepositFeiWeth', + 'balancerLensBpt30Fei70Weth', + 'pcvGuardianNew', + 'core', + 'balancerGaugeStaker', + 'collateralizationOracle', + 'pcvGuardianNew' + ], + deprecatedContractSignoff: ['balancerLensBpt30Fei70WethOld'], category: ProposalCategory.TC } }; From cefb736c8c310492e22b21d993feb00122316a6b Mon Sep 17 00:00:00 2001 From: Erwan Beauvois Date: Fri, 20 May 2022 16:33:45 +0200 Subject: [PATCH 122/274] relax check in fip-104 (fork block changed & spot price changed) --- proposals/dao/fip_104.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/proposals/dao/fip_104.ts b/proposals/dao/fip_104.ts index 6f6e26d8d..0793203d6 100644 --- a/proposals/dao/fip_104.ts +++ b/proposals/dao/fip_104.ts @@ -311,8 +311,8 @@ const validateLBPSetup = async (contracts: NamedContracts, addresses: NamedAddre expect(daiSpent).to.be.bignumber.equal(amountIn); const dpiGained = postUserDpiBalance.sub(initialUserDpiBalance); - expect(dpiGained).to.be.bignumber.at.least(ethers.constants.WeiPerEther.mul(100)); - expect(dpiGained).to.be.bignumber.at.most(ethers.constants.WeiPerEther.mul(110)); + expect(dpiGained).to.be.bignumber.at.least(ethers.constants.WeiPerEther.mul(90)); + expect(dpiGained).to.be.bignumber.at.most(ethers.constants.WeiPerEther.mul(120)); // Put in 10k DAI, got out 101 DPI // Implies price of $98.5 per DPI, compared to an oracle price of $95.6 From e1c7cdbce7b670a7bd19806280ddc00fd9250af5 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 23 May 2022 07:35:04 +0000 Subject: [PATCH 123/274] build(deps-dev): bump ts-node from 10.7.0 to 10.8.0 Bumps [ts-node](https://github.com/TypeStrong/ts-node) from 10.7.0 to 10.8.0. - [Release notes](https://github.com/TypeStrong/ts-node/releases) - [Commits](https://github.com/TypeStrong/ts-node/compare/v10.7.0...v10.8.0) --- updated-dependencies: - dependency-name: ts-node dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- package-lock.json | 100 ++++++++++++++++++++++++++++++---------------- package.json | 2 +- 2 files changed, 67 insertions(+), 35 deletions(-) diff --git a/package-lock.json b/package-lock.json index e1125b879..f343ba54f 100644 --- a/package-lock.json +++ b/package-lock.json @@ -60,7 +60,7 @@ "solhint": "^3.3.7", "solhint-plugin-prettier": "^0.0.5", "solidity-coverage": "^0.7.21", - "ts-node": "^10.7.0", + "ts-node": "^10.8.0", "tsconfig-paths": "^4.0.0", "typechain": "^5.2.0", "typescript": "^4.6.4" @@ -237,22 +237,13 @@ "node": ">=0.1.90" } }, - "node_modules/@cspotcode/source-map-consumer": { - "version": "0.8.0", - "resolved": "https://registry.npmjs.org/@cspotcode/source-map-consumer/-/source-map-consumer-0.8.0.tgz", - "integrity": "sha512-41qniHzTU8yAGbCp04ohlmSrZf8bkf/iJsl3V0dRGsQN/5GFfx+LbCSsCpp2gqrqjTVg/K6O8ycoV35JIwAzAg==", - "dev": true, - "engines": { - "node": ">= 12" - } - }, "node_modules/@cspotcode/source-map-support": { - "version": "0.7.0", - "resolved": "https://registry.npmjs.org/@cspotcode/source-map-support/-/source-map-support-0.7.0.tgz", - "integrity": "sha512-X4xqRHqN8ACt2aHVe51OxeA2HjbcL4MqFqXkrmQszJ1NOUuUu5u6Vqx/0lZSVNku7velL5FC/s5uEAj1lsBMhA==", + "version": "0.8.1", + "resolved": "https://registry.npmjs.org/@cspotcode/source-map-support/-/source-map-support-0.8.1.tgz", + "integrity": "sha512-IchNf6dN4tHoMFIn/7OE8LWZ19Y6q/67Bmf6vnGREv8RSbBVb9LPJxEcnwrcwX6ixSvaiGoomAUvu4YSxXrVgw==", "dev": true, "dependencies": { - "@cspotcode/source-map-consumer": "0.8.0" + "@jridgewell/trace-mapping": "0.3.9" }, "engines": { "node": ">=12" @@ -1670,6 +1661,31 @@ "hardhat": "^2.0.0" } }, + "node_modules/@jridgewell/resolve-uri": { + "version": "3.0.7", + "resolved": "https://registry.npmjs.org/@jridgewell/resolve-uri/-/resolve-uri-3.0.7.tgz", + "integrity": "sha512-8cXDaBBHOr2pQ7j77Y6Vp5VDT2sIqWyWQ56TjEq4ih/a4iST3dItRe8Q9fp0rrIl9DoKhWQtUQz/YpOxLkXbNA==", + "dev": true, + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/@jridgewell/sourcemap-codec": { + "version": "1.4.13", + "resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.4.13.tgz", + "integrity": "sha512-GryiOJmNcWbovBxTfZSF71V/mXbgcV3MewDe3kIMCLyIh5e7SKAeUZs+rMnJ8jkMolZ/4/VsdBmMrw3l+VdZ3w==", + "dev": true + }, + "node_modules/@jridgewell/trace-mapping": { + "version": "0.3.9", + "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.9.tgz", + "integrity": "sha512-3Belt6tdc8bPgAtbcmdtNJlirVoTmEb5e2gC94PnkwEW9jI6CAHUeoG85tjWP5WquqfavoMtMwiG4P926ZKKuQ==", + "dev": true, + "dependencies": { + "@jridgewell/resolve-uri": "^3.0.3", + "@jridgewell/sourcemap-codec": "^1.4.10" + } + }, "node_modules/@ledgerhq/cryptoassets": { "version": "5.53.0", "resolved": "https://registry.npmjs.org/@ledgerhq/cryptoassets/-/cryptoassets-5.53.0.tgz", @@ -27256,12 +27272,12 @@ "integrity": "sha512-q3N1xS4vZpRouhYHDPwO0bDW3EZ6SK9CrrDHxi/D6BPReSjpVgWIOpLS2o0gSBZm+7q/wyKp6RVM1AeeW7uyfQ==" }, "node_modules/ts-node": { - "version": "10.7.0", - "resolved": "https://registry.npmjs.org/ts-node/-/ts-node-10.7.0.tgz", - "integrity": "sha512-TbIGS4xgJoX2i3do417KSaep1uRAW/Lu+WAL2doDHC0D6ummjirVOXU5/7aiZotbQ5p1Zp9tP7U6cYhA0O7M8A==", + "version": "10.8.0", + "resolved": "https://registry.npmjs.org/ts-node/-/ts-node-10.8.0.tgz", + "integrity": "sha512-/fNd5Qh+zTt8Vt1KbYZjRHCE9sI5i7nqfD/dzBBRDeVXZXS6kToW6R7tTU6Nd4XavFs0mAVCg29Q//ML7WsZYA==", "dev": true, "dependencies": { - "@cspotcode/source-map-support": "0.7.0", + "@cspotcode/source-map-support": "^0.8.0", "@tsconfig/node10": "^1.0.7", "@tsconfig/node12": "^1.0.7", "@tsconfig/node14": "^1.0.0", @@ -27272,7 +27288,7 @@ "create-require": "^1.1.0", "diff": "^4.0.1", "make-error": "^1.1.1", - "v8-compile-cache-lib": "^3.0.0", + "v8-compile-cache-lib": "^3.0.1", "yn": "3.1.1" }, "bin": { @@ -28867,19 +28883,13 @@ "integrity": "sha512-ooWCrlZP11i8GImSjTHYHLkvFDP48nS4+204nGb1RiX/WXYHmJA2III9/e2DWVabCESdW7hBAEzHRqUn9OUVvQ==", "optional": true }, - "@cspotcode/source-map-consumer": { - "version": "0.8.0", - "resolved": "https://registry.npmjs.org/@cspotcode/source-map-consumer/-/source-map-consumer-0.8.0.tgz", - "integrity": "sha512-41qniHzTU8yAGbCp04ohlmSrZf8bkf/iJsl3V0dRGsQN/5GFfx+LbCSsCpp2gqrqjTVg/K6O8ycoV35JIwAzAg==", - "dev": true - }, "@cspotcode/source-map-support": { - "version": "0.7.0", - "resolved": "https://registry.npmjs.org/@cspotcode/source-map-support/-/source-map-support-0.7.0.tgz", - "integrity": "sha512-X4xqRHqN8ACt2aHVe51OxeA2HjbcL4MqFqXkrmQszJ1NOUuUu5u6Vqx/0lZSVNku7velL5FC/s5uEAj1lsBMhA==", + "version": "0.8.1", + "resolved": "https://registry.npmjs.org/@cspotcode/source-map-support/-/source-map-support-0.8.1.tgz", + "integrity": "sha512-IchNf6dN4tHoMFIn/7OE8LWZ19Y6q/67Bmf6vnGREv8RSbBVb9LPJxEcnwrcwX6ixSvaiGoomAUvu4YSxXrVgw==", "dev": true, "requires": { - "@cspotcode/source-map-consumer": "0.8.0" + "@jridgewell/trace-mapping": "0.3.9" } }, "@ensdomains/address-encoder": { @@ -29904,6 +29914,28 @@ "dev": true, "requires": {} }, + "@jridgewell/resolve-uri": { + "version": "3.0.7", + "resolved": "https://registry.npmjs.org/@jridgewell/resolve-uri/-/resolve-uri-3.0.7.tgz", + "integrity": "sha512-8cXDaBBHOr2pQ7j77Y6Vp5VDT2sIqWyWQ56TjEq4ih/a4iST3dItRe8Q9fp0rrIl9DoKhWQtUQz/YpOxLkXbNA==", + "dev": true + }, + "@jridgewell/sourcemap-codec": { + "version": "1.4.13", + "resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.4.13.tgz", + "integrity": "sha512-GryiOJmNcWbovBxTfZSF71V/mXbgcV3MewDe3kIMCLyIh5e7SKAeUZs+rMnJ8jkMolZ/4/VsdBmMrw3l+VdZ3w==", + "dev": true + }, + "@jridgewell/trace-mapping": { + "version": "0.3.9", + "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.9.tgz", + "integrity": "sha512-3Belt6tdc8bPgAtbcmdtNJlirVoTmEb5e2gC94PnkwEW9jI6CAHUeoG85tjWP5WquqfavoMtMwiG4P926ZKKuQ==", + "dev": true, + "requires": { + "@jridgewell/resolve-uri": "^3.0.3", + "@jridgewell/sourcemap-codec": "^1.4.10" + } + }, "@ledgerhq/cryptoassets": { "version": "5.53.0", "resolved": "https://registry.npmjs.org/@ledgerhq/cryptoassets/-/cryptoassets-5.53.0.tgz", @@ -49820,12 +49852,12 @@ } }, "ts-node": { - "version": "10.7.0", - "resolved": "https://registry.npmjs.org/ts-node/-/ts-node-10.7.0.tgz", - "integrity": "sha512-TbIGS4xgJoX2i3do417KSaep1uRAW/Lu+WAL2doDHC0D6ummjirVOXU5/7aiZotbQ5p1Zp9tP7U6cYhA0O7M8A==", + "version": "10.8.0", + "resolved": "https://registry.npmjs.org/ts-node/-/ts-node-10.8.0.tgz", + "integrity": "sha512-/fNd5Qh+zTt8Vt1KbYZjRHCE9sI5i7nqfD/dzBBRDeVXZXS6kToW6R7tTU6Nd4XavFs0mAVCg29Q//ML7WsZYA==", "dev": true, "requires": { - "@cspotcode/source-map-support": "0.7.0", + "@cspotcode/source-map-support": "^0.8.0", "@tsconfig/node10": "^1.0.7", "@tsconfig/node12": "^1.0.7", "@tsconfig/node14": "^1.0.0", @@ -49836,7 +49868,7 @@ "create-require": "^1.1.0", "diff": "^4.0.1", "make-error": "^1.1.1", - "v8-compile-cache-lib": "^3.0.0", + "v8-compile-cache-lib": "^3.0.1", "yn": "3.1.1" }, "dependencies": { diff --git a/package.json b/package.json index 128784b8b..5168984d6 100644 --- a/package.json +++ b/package.json @@ -100,7 +100,7 @@ "solhint": "^3.3.7", "solhint-plugin-prettier": "^0.0.5", "solidity-coverage": "^0.7.21", - "ts-node": "^10.7.0", + "ts-node": "^10.8.0", "tsconfig-paths": "^4.0.0", "typechain": "^5.2.0", "typescript": "^4.6.4" From 7b61121f38526acf1fb4617e32ae502822961a7c Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 23 May 2022 07:35:35 +0000 Subject: [PATCH 124/274] build(deps-dev): bump ethers from 5.6.6 to 5.6.7 Bumps [ethers](https://github.com/ethers-io/ethers.js/tree/HEAD/packages/ethers) from 5.6.6 to 5.6.7. - [Release notes](https://github.com/ethers-io/ethers.js/releases) - [Changelog](https://github.com/ethers-io/ethers.js/blob/master/CHANGELOG.md) - [Commits](https://github.com/ethers-io/ethers.js/commits/v5.6.7/packages/ethers) --- updated-dependencies: - dependency-name: ethers dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- package-lock.json | 64 ++++++++++++++++++++++++----------------------- package.json | 2 +- 2 files changed, 34 insertions(+), 32 deletions(-) diff --git a/package-lock.json b/package-lock.json index e1125b879..03353d52f 100644 --- a/package-lock.json +++ b/package-lock.json @@ -49,7 +49,7 @@ "eslint-plugin-import": "^2.26.0", "eslint-plugin-prettier": "^4.0.0", "ethereum-waffle": "^3.4.4", - "ethers": "^5.6.6", + "ethers": "^5.6.7", "husky": "^8.0.1", "lint-staged": "^12.4.1", "mocha": "^10.0.0", @@ -1211,9 +1211,9 @@ ] }, "node_modules/@ethersproject/networks": { - "version": "5.6.2", - "resolved": "https://registry.npmjs.org/@ethersproject/networks/-/networks-5.6.2.tgz", - "integrity": "sha512-9uEzaJY7j5wpYGTojGp8U89mSsgQLc40PCMJLMCnFXTs7nhBveZ0t7dbqWUNrepWTszDbFkYD6WlL8DKx5huHA==", + "version": "5.6.3", + "resolved": "https://registry.npmjs.org/@ethersproject/networks/-/networks-5.6.3.tgz", + "integrity": "sha512-QZxRH7cA5Ut9TbXwZFiCyuPchdWi87ZtVNHWZd0R6YFgYtes2jQ3+bsslJ0WdyDe0i6QumqtoYqvY3rrQFRZOQ==", "funding": [ { "type": "individual", @@ -1266,9 +1266,9 @@ } }, "node_modules/@ethersproject/providers": { - "version": "5.6.6", - "resolved": "https://registry.npmjs.org/@ethersproject/providers/-/providers-5.6.6.tgz", - "integrity": "sha512-6X6agj3NeQ4tgnvBMCjHK+CjQbz+Qmn20JTxCYZ/uymrgCEOpJtY9zeRxJIDsSi0DPw8xNAxypj95JMCsapUfA==", + "version": "5.6.7", + "resolved": "https://registry.npmjs.org/@ethersproject/providers/-/providers-5.6.7.tgz", + "integrity": "sha512-QG7KLxfYk0FA0ycWATKMM8UzMOfOvchtkN89nNORlPqqhX5zatdamJ506dh5ECk+ybcnCkeVOdStlzrOMkkGOA==", "funding": [ { "type": "individual", @@ -1283,6 +1283,7 @@ "@ethersproject/abstract-provider": "^5.6.0", "@ethersproject/abstract-signer": "^5.6.0", "@ethersproject/address": "^5.6.0", + "@ethersproject/base64": "^5.6.0", "@ethersproject/basex": "^5.6.0", "@ethersproject/bignumber": "^5.6.0", "@ethersproject/bytes": "^5.6.0", @@ -1431,9 +1432,9 @@ } }, "node_modules/@ethersproject/transactions": { - "version": "5.6.0", - "resolved": "https://registry.npmjs.org/@ethersproject/transactions/-/transactions-5.6.0.tgz", - "integrity": "sha512-4HX+VOhNjXHZyGzER6E/LVI2i6lf9ejYeWD6l4g50AdmimyuStKc39kvKf1bXWQMg7QNVh+uC7dYwtaZ02IXeg==", + "version": "5.6.1", + "resolved": "https://registry.npmjs.org/@ethersproject/transactions/-/transactions-5.6.1.tgz", + "integrity": "sha512-oIAC7zBCDnjVlEn0KSG1udbqR7hP9FOurxIV/aG+erCdvdvi+QXEZRUtVP9+lu3WYUe8SMYhdAVwNJtD7dZMRw==", "funding": [ { "type": "individual", @@ -8923,9 +8924,9 @@ } }, "node_modules/ethers": { - "version": "5.6.6", - "resolved": "https://registry.npmjs.org/ethers/-/ethers-5.6.6.tgz", - "integrity": "sha512-2B2ZmSGvRcJpHnFMBk58mkXP50njFipUBCgLK8jUTFbomhVs501cLzyMU6+Vx8YnUDQxywC3qkZvd33xWS+2FA==", + "version": "5.6.7", + "resolved": "https://registry.npmjs.org/ethers/-/ethers-5.6.7.tgz", + "integrity": "sha512-Q8pmMraUENK0cY6cy6IvIe3e9xL/+4kBvxmUvLXg1O7Abob0c7XzWI76E29j5em/HxWMl5hYiSClmOMW3jJmdg==", "funding": [ { "type": "individual", @@ -8952,17 +8953,17 @@ "@ethersproject/json-wallets": "5.6.0", "@ethersproject/keccak256": "5.6.0", "@ethersproject/logger": "5.6.0", - "@ethersproject/networks": "5.6.2", + "@ethersproject/networks": "5.6.3", "@ethersproject/pbkdf2": "5.6.0", "@ethersproject/properties": "5.6.0", - "@ethersproject/providers": "5.6.6", + "@ethersproject/providers": "5.6.7", "@ethersproject/random": "5.6.0", "@ethersproject/rlp": "5.6.0", "@ethersproject/sha2": "5.6.0", "@ethersproject/signing-key": "5.6.1", "@ethersproject/solidity": "5.6.0", "@ethersproject/strings": "5.6.0", - "@ethersproject/transactions": "5.6.0", + "@ethersproject/transactions": "5.6.1", "@ethersproject/units": "5.6.0", "@ethersproject/wallet": "5.6.1", "@ethersproject/web": "5.6.0", @@ -29606,9 +29607,9 @@ "integrity": "sha512-BiBWllUROH9w+P21RzoxJKzqoqpkyM1pRnEKG69bulE9TSQD8SAIvTQqIMZmmCO8pUNkgLP1wndX1gKghSpBmg==" }, "@ethersproject/networks": { - "version": "5.6.2", - "resolved": "https://registry.npmjs.org/@ethersproject/networks/-/networks-5.6.2.tgz", - "integrity": "sha512-9uEzaJY7j5wpYGTojGp8U89mSsgQLc40PCMJLMCnFXTs7nhBveZ0t7dbqWUNrepWTszDbFkYD6WlL8DKx5huHA==", + "version": "5.6.3", + "resolved": "https://registry.npmjs.org/@ethersproject/networks/-/networks-5.6.3.tgz", + "integrity": "sha512-QZxRH7cA5Ut9TbXwZFiCyuPchdWi87ZtVNHWZd0R6YFgYtes2jQ3+bsslJ0WdyDe0i6QumqtoYqvY3rrQFRZOQ==", "requires": { "@ethersproject/logger": "^5.6.0" } @@ -29631,13 +29632,14 @@ } }, "@ethersproject/providers": { - "version": "5.6.6", - "resolved": "https://registry.npmjs.org/@ethersproject/providers/-/providers-5.6.6.tgz", - "integrity": "sha512-6X6agj3NeQ4tgnvBMCjHK+CjQbz+Qmn20JTxCYZ/uymrgCEOpJtY9zeRxJIDsSi0DPw8xNAxypj95JMCsapUfA==", + "version": "5.6.7", + "resolved": "https://registry.npmjs.org/@ethersproject/providers/-/providers-5.6.7.tgz", + "integrity": "sha512-QG7KLxfYk0FA0ycWATKMM8UzMOfOvchtkN89nNORlPqqhX5zatdamJ506dh5ECk+ybcnCkeVOdStlzrOMkkGOA==", "requires": { "@ethersproject/abstract-provider": "^5.6.0", "@ethersproject/abstract-signer": "^5.6.0", "@ethersproject/address": "^5.6.0", + "@ethersproject/base64": "^5.6.0", "@ethersproject/basex": "^5.6.0", "@ethersproject/bignumber": "^5.6.0", "@ethersproject/bytes": "^5.6.0", @@ -29728,9 +29730,9 @@ } }, "@ethersproject/transactions": { - "version": "5.6.0", - "resolved": "https://registry.npmjs.org/@ethersproject/transactions/-/transactions-5.6.0.tgz", - "integrity": "sha512-4HX+VOhNjXHZyGzER6E/LVI2i6lf9ejYeWD6l4g50AdmimyuStKc39kvKf1bXWQMg7QNVh+uC7dYwtaZ02IXeg==", + "version": "5.6.1", + "resolved": "https://registry.npmjs.org/@ethersproject/transactions/-/transactions-5.6.1.tgz", + "integrity": "sha512-oIAC7zBCDnjVlEn0KSG1udbqR7hP9FOurxIV/aG+erCdvdvi+QXEZRUtVP9+lu3WYUe8SMYhdAVwNJtD7dZMRw==", "requires": { "@ethersproject/address": "^5.6.0", "@ethersproject/bignumber": "^5.6.0", @@ -35928,9 +35930,9 @@ } }, "ethers": { - "version": "5.6.6", - "resolved": "https://registry.npmjs.org/ethers/-/ethers-5.6.6.tgz", - "integrity": "sha512-2B2ZmSGvRcJpHnFMBk58mkXP50njFipUBCgLK8jUTFbomhVs501cLzyMU6+Vx8YnUDQxywC3qkZvd33xWS+2FA==", + "version": "5.6.7", + "resolved": "https://registry.npmjs.org/ethers/-/ethers-5.6.7.tgz", + "integrity": "sha512-Q8pmMraUENK0cY6cy6IvIe3e9xL/+4kBvxmUvLXg1O7Abob0c7XzWI76E29j5em/HxWMl5hYiSClmOMW3jJmdg==", "requires": { "@ethersproject/abi": "5.6.2", "@ethersproject/abstract-provider": "5.6.0", @@ -35947,17 +35949,17 @@ "@ethersproject/json-wallets": "5.6.0", "@ethersproject/keccak256": "5.6.0", "@ethersproject/logger": "5.6.0", - "@ethersproject/networks": "5.6.2", + "@ethersproject/networks": "5.6.3", "@ethersproject/pbkdf2": "5.6.0", "@ethersproject/properties": "5.6.0", - "@ethersproject/providers": "5.6.6", + "@ethersproject/providers": "5.6.7", "@ethersproject/random": "5.6.0", "@ethersproject/rlp": "5.6.0", "@ethersproject/sha2": "5.6.0", "@ethersproject/signing-key": "5.6.1", "@ethersproject/solidity": "5.6.0", "@ethersproject/strings": "5.6.0", - "@ethersproject/transactions": "5.6.0", + "@ethersproject/transactions": "5.6.1", "@ethersproject/units": "5.6.0", "@ethersproject/wallet": "5.6.1", "@ethersproject/web": "5.6.0", diff --git a/package.json b/package.json index 128784b8b..efbf22527 100644 --- a/package.json +++ b/package.json @@ -89,7 +89,7 @@ "eslint-plugin-import": "^2.26.0", "eslint-plugin-prettier": "^4.0.0", "ethereum-waffle": "^3.4.4", - "ethers": "^5.6.6", + "ethers": "^5.6.7", "husky": "^8.0.1", "lint-staged": "^12.4.1", "mocha": "^10.0.0", From e72b69bcd79d1af574b7cf616941835c73fcdb87 Mon Sep 17 00:00:00 2001 From: thomas-waite Date: Mon, 23 May 2022 14:34:16 +0100 Subject: [PATCH 125/274] feat: update proposalId --- test/integration/proposals_config.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/integration/proposals_config.ts b/test/integration/proposals_config.ts index 8a8861c86..9de785854 100644 --- a/test/integration/proposals_config.ts +++ b/test/integration/proposals_config.ts @@ -9,7 +9,7 @@ const proposals: ProposalsConfigMap = { deploy: false, // deploy flag for whether to run deploy action during e2e tests or use mainnet state totalValue: 0, // amount of ETH to send to DAO execution proposal: fip_104, // full proposal file, imported from '@proposals/description/fip_xx.ts' - proposalId: '', + proposalId: '31578302030309093637065801555854148925062532860791705694822567566349182964602', affectedContractSignoff: [ 'daiFixedPricePSMFeiSkimmer', 'core', From 959fb937bf760a79411358556dc13eb2cc8f4db4 Mon Sep 17 00:00:00 2001 From: thomas-waite Date: Mon, 23 May 2022 14:35:58 +0100 Subject: [PATCH 126/274] test: relax validate price check --- proposals/dao/fip_104.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/proposals/dao/fip_104.ts b/proposals/dao/fip_104.ts index 0793203d6..4b38608b4 100644 --- a/proposals/dao/fip_104.ts +++ b/proposals/dao/fip_104.ts @@ -311,7 +311,7 @@ const validateLBPSetup = async (contracts: NamedContracts, addresses: NamedAddre expect(daiSpent).to.be.bignumber.equal(amountIn); const dpiGained = postUserDpiBalance.sub(initialUserDpiBalance); - expect(dpiGained).to.be.bignumber.at.least(ethers.constants.WeiPerEther.mul(90)); + expect(dpiGained).to.be.bignumber.at.least(ethers.constants.WeiPerEther.mul(80)); expect(dpiGained).to.be.bignumber.at.most(ethers.constants.WeiPerEther.mul(120)); // Put in 10k DAI, got out 101 DPI From 8be48992a7299393669f626dc9c184f2adf9f179 Mon Sep 17 00:00:00 2001 From: thomas-waite Date: Mon, 23 May 2022 14:50:08 +0100 Subject: [PATCH 127/274] test: remove need to drop liquidity --- proposals/dao/withdraw_lbp_liquidity.ts | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) diff --git a/proposals/dao/withdraw_lbp_liquidity.ts b/proposals/dao/withdraw_lbp_liquidity.ts index 253f09ad7..1e536897e 100644 --- a/proposals/dao/withdraw_lbp_liquidity.ts +++ b/proposals/dao/withdraw_lbp_liquidity.ts @@ -39,24 +39,13 @@ const setup: SetupUpgradeFunc = async (addresses, oldContracts, contracts, loggi const dpi = contracts.dpi; initialTCDpiBalance = await dpi.balanceOf(addresses.tribalCouncilSafe); initialDaiPCVBalance = await contracts.compoundDaiPCVDeposit.balance(); - console.log('initial dai balance: ', initialDaiPCVBalance.toString()); + console.log('Initial dai balance: ', initialDaiPCVBalance.toString()); // Fast forward to end of LPB const timeRemaining = await contracts.dpiToDaiLBPSwapper.remainingTime(); await time.increase(timeRemaining); - // Drop DAI and DPI onto contract, so can test withdraw - const daiWhale = '0x5d3a536e4d6dbd6114cc1ead35777bab948e3643'; - const dpiWhale = '0x6f634c6135d2ebd550000ac92f494f9cb8183dae'; - const daiWhaleSigner = await getImpersonatedSigner(daiWhale); - const dpiWhaleSigner = await getImpersonatedSigner(dpiWhale); - - await forceEth(daiWhale); - await forceEth(dpiWhale); await forceEth(addresses.tribalCouncilTimelock); - - await contracts.dai.connect(daiWhaleSigner).transfer(addresses.dpiToDaiLBPSwapper, minExpectedLBPDai); - await contracts.dpi.connect(dpiWhaleSigner).transfer(addresses.dpiToDaiLBPSwapper, minExpectedLBPDpi); }; // Tears down any changes made in setup() that need to be From b93fd669f15e4eea641ed8643ccd8d64753a2e23 Mon Sep 17 00:00:00 2001 From: thomas-waite Date: Mon, 23 May 2022 15:25:24 +0100 Subject: [PATCH 128/274] refactor: remove executed proposal, update block num --- block.txt | 2 +- test/integration/proposals_config.ts | 41 ---------------------------- 2 files changed, 1 insertion(+), 42 deletions(-) diff --git a/block.txt b/block.txt index b1a280ab3..b589b8a2a 100644 --- a/block.txt +++ b/block.txt @@ -1 +1 @@ -14811496 +14830001 diff --git a/test/integration/proposals_config.ts b/test/integration/proposals_config.ts index eb42892be..dcded2405 100644 --- a/test/integration/proposals_config.ts +++ b/test/integration/proposals_config.ts @@ -1,50 +1,9 @@ import { ProposalCategory, ProposalsConfigMap } from '@custom-types/types'; -import fip_104 from '@proposals/description/fip_104'; import balancer_gauge_fix from '@proposals/description/balancer_gauge_fix'; import withdraw_lbp_liquidity from '@proposals/description/withdraw_lbp_liquidity'; const proposals: ProposalsConfigMap = { - fip_104: { - deploy: false, // deploy flag for whether to run deploy action during e2e tests or use mainnet state - totalValue: 0, // amount of ETH to send to DAO execution - proposal: fip_104, // full proposal file, imported from '@proposals/description/fip_xx.ts' - proposalId: '', - affectedContractSignoff: [ - 'daiFixedPricePSMFeiSkimmer', - 'core', - 'compoundDaiPCVDeposit', - 'dpiToDaiLBPSwapper', - 'dpiToDaiLensDai', - 'dpiToDaiLensDpi', - 'collateralizationOracle', - 'tribalCouncilTimelock', - 'tribalCouncilSafe', - 'nopeDAO', - 'compoundEthPCVDeposit', - 'aaveEthPCVDeposit', - 'pcvGuardianNew', - 'uniswapPCVDeposit' - ], - deprecatedContractSignoff: [ - 'rariPool31FeiPCVDepositWrapper', - 'rariPool25FeiPCVDepositWrapper', - 'rariPool9RaiPCVDepositWrapper', - 'aaveRaiPCVDepositWrapper', - 'rariPool19DpiPCVDepositWrapper', - 'liquityFusePoolLusdPCVDeposit', - 'rariPool72FeiPCVDepositWrapper', - 'raiDepositWrapper', - 'rariPool31FeiPCVDeposit', - 'rariPool25FeiPCVDeposit', - 'rariPool9RaiPCVDeposit', - 'aaveRaiPCVDeposit', - 'rariPool19DpiPCVDeposit', - 'rariPool72FeiPCVDeposit', - 'dpiDepositWrapper' - ], - category: ProposalCategory.DAO - }, balancer_gauge_fix: { deploy: false, // deploy flag for whether to run deploy action during e2e tests or use mainnet state totalValue: 0, // amount of ETH to send to DAO execution From 48ad2a3e58ed26d05c9279d8fe6b22069d3840af Mon Sep 17 00:00:00 2001 From: thomas-waite Date: Mon, 23 May 2022 15:28:37 +0100 Subject: [PATCH 129/274] refactor: use exitPool in withdraw proposal --- proposals/dao/withdraw_lbp_liquidity.ts | 5 +- .../description/withdraw_lbp_liquidity.ts | 46 ++++++++----------- test/integration/proposals_config.ts | 2 +- 3 files changed, 24 insertions(+), 29 deletions(-) diff --git a/proposals/dao/withdraw_lbp_liquidity.ts b/proposals/dao/withdraw_lbp_liquidity.ts index 1e536897e..8f2b53c4e 100644 --- a/proposals/dao/withdraw_lbp_liquidity.ts +++ b/proposals/dao/withdraw_lbp_liquidity.ts @@ -7,7 +7,7 @@ import { TeardownUpgradeFunc, ValidateUpgradeFunc } from '@custom-types/types'; -import { getImpersonatedSigner, time } from '@test/helpers'; +import { time } from '@test/helpers'; import { BigNumber } from 'ethers'; import { forceEth } from '@test/integration/setup/utils'; @@ -39,7 +39,7 @@ const setup: SetupUpgradeFunc = async (addresses, oldContracts, contracts, loggi const dpi = contracts.dpi; initialTCDpiBalance = await dpi.balanceOf(addresses.tribalCouncilSafe); initialDaiPCVBalance = await contracts.compoundDaiPCVDeposit.balance(); - console.log('Initial dai balance: ', initialDaiPCVBalance.toString()); + logging && console.log('Initial dai balance: ', initialDaiPCVBalance.toString()); // Fast forward to end of LPB const timeRemaining = await contracts.dpiToDaiLBPSwapper.remainingTime(); @@ -66,6 +66,7 @@ const validate: ValidateUpgradeFunc = async (addresses, oldContracts, contracts, // 2. Validate withdrawn liquidity destinations const finalDAIDepositBalance = await contracts.compoundDaiPCVDeposit.balance(); expect(finalDAIDepositBalance).to.be.bignumber.at.least(initialDaiPCVBalance.add(minExpectedLBPDai)); + logging && console.log('Final DAI balance: ', finalDAIDepositBalance.toString()); const dpi = contracts.dpi; const finalTCDpiBalance = await dpi.balanceOf(addresses.tribalCouncilSafe); diff --git a/proposals/description/withdraw_lbp_liquidity.ts b/proposals/description/withdraw_lbp_liquidity.ts index 39cbb538b..27278c70a 100644 --- a/proposals/description/withdraw_lbp_liquidity.ts +++ b/proposals/description/withdraw_lbp_liquidity.ts @@ -11,51 +11,45 @@ const withdraw_lbp_liquidity: ProposalDescription = { description: 'Set the Compound DAI PCV deposit and TribalCouncil multisig and timelock to be safe addresses for PCV withdrawal' }, + // Have to call exitPool() + { + target: 'dpiToDaiLBPSwapper', + values: '0', + method: 'exitPool(address)', + arguments: ['{compoundDaiPCVDeposit}'], + description: 'Withdraw all DAI and DPI from LBP pool to the compoundDAIPCVDeposit' + }, + // Desired end state: DPI on TC safe, DAI on compoundDAIDeposit { target: 'pcvGuardianNew', values: '0', method: 'withdrawERC20ToSafeAddress(address,address,address,uint256,bool,bool)', arguments: [ - '{dpiToDaiLBPSwapper}', '{compoundDaiPCVDeposit}', - '{dai}', - '300000000000000000000000', // TODO, update with accurate figure + '{tribalCouncilSafe}', + '{dpi}', + '100000000000000000000', // TODO, update with accurate figure false, false ], - description: 'Withdraw DAI from the LBP to the Compound PCV DAI deposit' + description: 'Withdraw DPI from the compound DAI PCV deposit to the TribalCouncil multisig' }, { target: 'compoundDaiPCVDeposit', values: '0', method: 'deposit()', arguments: [], - description: 'Deposit DAI on deposit into Compound PCV Deposit' - }, - { - target: 'pcvGuardianNew', - values: '0', - method: 'withdrawERC20ToSafeAddress(address,address,address,uint256,bool,bool)', - arguments: [ - '{dpiToDaiLBPSwapper}', - '{tribalCouncilSafe}', - '{dpi}', - '100000000000000000000', // TODO, update with accurate figure - false, - false - ], - description: 'Withdraw DPI from the LBP to the TribalCouncil multisig' + description: 'Deposit DAI on compoundDAIPCVdeposit into Compound' } ], description: ` - Withdraw LBP liquidity. - - Set the TribalCouncil multisig and timelock to be safe addresses for PCV withdrawal. - - Then use the PCV guardian to withdraw all DAI liquidity from the DPI LBP sale to the Compound DAI PCV deposit. + Withdraw all liquidity from the DPI LBP. - Lastly, use the PCV guardian to withdraw all DPI liquidity from the DPI LBP sale to the TribalCouncil safe, where it will then be - sold via a DEX aggregator for DAI. + Specifically this,: + - Sets the TribalCouncil multisig, timelock and compoundDAIPCVDeposit to be safe addresses for PCV withdrawal + - Exits the LBP pool and withdraws all liquidity to the compound DAI deposit + - Withdraws the DPI from the deposit to the TribalCouncil multisig, uisng the pcvGuardian + - Deposits the DAI on the deposit into Compound ` }; diff --git a/test/integration/proposals_config.ts b/test/integration/proposals_config.ts index dcded2405..ffe443ce8 100644 --- a/test/integration/proposals_config.ts +++ b/test/integration/proposals_config.ts @@ -35,7 +35,7 @@ const proposals: ProposalsConfigMap = { 'tribalCouncilTimelock' ], deprecatedContractSignoff: [], - category: ProposalCategory.TC + category: ProposalCategory.DAO } }; From 43ab49667a6d847708c332476143961d14332ed5 Mon Sep 17 00:00:00 2001 From: thomas-waite Date: Mon, 23 May 2022 15:37:26 +0100 Subject: [PATCH 130/274] docs: update proposal name and copy --- .../dao/{withdraw_lbp_liquidity.ts => fip_104b.ts} | 2 +- .../{withdraw_lbp_liquidity.ts => fip_104b.ts} | 14 ++++++++------ test/integration/proposals_config.ts | 6 +++--- 3 files changed, 12 insertions(+), 10 deletions(-) rename proposals/dao/{withdraw_lbp_liquidity.ts => fip_104b.ts} (98%) rename proposals/description/{withdraw_lbp_liquidity.ts => fip_104b.ts} (79%) diff --git a/proposals/dao/withdraw_lbp_liquidity.ts b/proposals/dao/fip_104b.ts similarity index 98% rename from proposals/dao/withdraw_lbp_liquidity.ts rename to proposals/dao/fip_104b.ts index 8f2b53c4e..2f18cbba3 100644 --- a/proposals/dao/withdraw_lbp_liquidity.ts +++ b/proposals/dao/fip_104b.ts @@ -15,7 +15,7 @@ import { forceEth } from '@test/integration/setup/utils'; Withdraw liquidity from the LBP once it has finished */ -const fipNumber = 'withdraw_lbp_liquidity'; +const fipNumber = 'fip_104b'; let initialDaiPCVBalance: BigNumber; let initialTCDpiBalance: BigNumber; diff --git a/proposals/description/withdraw_lbp_liquidity.ts b/proposals/description/fip_104b.ts similarity index 79% rename from proposals/description/withdraw_lbp_liquidity.ts rename to proposals/description/fip_104b.ts index 27278c70a..69abc78d0 100644 --- a/proposals/description/withdraw_lbp_liquidity.ts +++ b/proposals/description/fip_104b.ts @@ -1,6 +1,6 @@ import { ProposalDescription } from '@custom-types/types'; -const withdraw_lbp_liquidity: ProposalDescription = { +const fip_104b: ProposalDescription = { title: 'Withdraw LBP liquidity', commands: [ { @@ -11,7 +11,6 @@ const withdraw_lbp_liquidity: ProposalDescription = { description: 'Set the Compound DAI PCV deposit and TribalCouncil multisig and timelock to be safe addresses for PCV withdrawal' }, - // Have to call exitPool() { target: 'dpiToDaiLBPSwapper', values: '0', @@ -19,7 +18,6 @@ const withdraw_lbp_liquidity: ProposalDescription = { arguments: ['{compoundDaiPCVDeposit}'], description: 'Withdraw all DAI and DPI from LBP pool to the compoundDAIPCVDeposit' }, - // Desired end state: DPI on TC safe, DAI on compoundDAIDeposit { target: 'pcvGuardianNew', values: '0', @@ -43,9 +41,13 @@ const withdraw_lbp_liquidity: ProposalDescription = { } ], description: ` - Withdraw all liquidity from the DPI LBP. + FIP_104b: Withdraw all liquidity from the DPI LBP. - Specifically this,: + This FIP cleans up and finishes elements of the PCV reinforcement process snapshotted here: + https://snapshot.fei.money/#/proposal/0x2fd5bdda0067098f6c0520fe309dfe90ca403758f0ce98c1854a00bf38999674 + and discussed here: https://tribe.fei.money/t/fip-104-fei-pcv-reinforcement-proposal/4162 . + + Specifically it: - Sets the TribalCouncil multisig, timelock and compoundDAIPCVDeposit to be safe addresses for PCV withdrawal - Exits the LBP pool and withdraws all liquidity to the compound DAI deposit - Withdraws the DPI from the deposit to the TribalCouncil multisig, uisng the pcvGuardian @@ -53,4 +55,4 @@ const withdraw_lbp_liquidity: ProposalDescription = { ` }; -export default withdraw_lbp_liquidity; +export default fip_104b; diff --git a/test/integration/proposals_config.ts b/test/integration/proposals_config.ts index ffe443ce8..2e06b424c 100644 --- a/test/integration/proposals_config.ts +++ b/test/integration/proposals_config.ts @@ -1,7 +1,7 @@ import { ProposalCategory, ProposalsConfigMap } from '@custom-types/types'; import balancer_gauge_fix from '@proposals/description/balancer_gauge_fix'; -import withdraw_lbp_liquidity from '@proposals/description/withdraw_lbp_liquidity'; +import fip_104b from '@proposals/description/fip_104b'; const proposals: ProposalsConfigMap = { balancer_gauge_fix: { @@ -22,10 +22,10 @@ const proposals: ProposalsConfigMap = { deprecatedContractSignoff: ['balancerLensBpt30Fei70WethOld'], category: ProposalCategory.TC }, - withdraw_lbp_liquidity: { + fip_104b: { deploy: false, totalValue: 0, - proposal: withdraw_lbp_liquidity, + proposal: fip_104b, proposalId: '', affectedContractSignoff: [ 'dpiToDaiLBPSwapper', From 434f695dfc4db99561eb82162ece07ff15cf7d02 Mon Sep 17 00:00:00 2001 From: thomas-waite Date: Mon, 23 May 2022 16:39:33 +0100 Subject: [PATCH 131/274] refactor: make use of ratio PCV controller --- proposals/dao/fip_104b.ts | 12 +++++------- proposals/description/fip_104b.ts | 25 +++++++++++-------------- test/integration/proposals_config.ts | 1 + 3 files changed, 17 insertions(+), 21 deletions(-) diff --git a/proposals/dao/fip_104b.ts b/proposals/dao/fip_104b.ts index 882d6d19e..754948e1f 100644 --- a/proposals/dao/fip_104b.ts +++ b/proposals/dao/fip_104b.ts @@ -9,7 +9,6 @@ import { } from '@custom-types/types'; import { time } from '@test/helpers'; import { BigNumber } from 'ethers'; -import { forceEth } from '@test/integration/setup/utils'; /* Withdraw liquidity from the LBP once it has finished @@ -20,9 +19,6 @@ const fipNumber = 'fip_104b'; let initialDaiPCVBalance: BigNumber; let initialTCDpiBalance: BigNumber; -const minExpectedLBPDai = ethers.constants.WeiPerEther.mul(300_000); // TODO, update to accurate numbers -const minExpectedLBPDpi = ethers.constants.WeiPerEther.mul(100); // TODO, update to accurate numbers - // Do any deployments // This should exclusively include new contract deployments const deploy: DeployUpgradeFunc = async (deployAddress: string, addresses: NamedAddresses, logging: boolean) => { @@ -59,16 +55,18 @@ const validate: ValidateUpgradeFunc = async (addresses, oldContracts, contracts, const pcvGuardian = contracts.pcvGuardianNew; expect(await pcvGuardian.isSafeAddress(addresses.tribalCouncilSafe)).to.be.true; expect(await pcvGuardian.isSafeAddress(addresses.tribalCouncilTimelock)).to.be.true; - expect(await pcvGuardian.isSafeAddress(addresses.compoundDaiPCVDeposit)).to.be.true; // 2. Validate withdrawn liquidity destinations + const sanityCheckDAIAmount = ethers.constants.WeiPerEther.mul(100_000); const finalDAIDepositBalance = await contracts.compoundDaiPCVDeposit.balance(); - expect(finalDAIDepositBalance).to.be.bignumber.at.least(initialDaiPCVBalance.add(minExpectedLBPDai)); + expect(finalDAIDepositBalance).to.be.bignumber.at.least(initialDaiPCVBalance.add(sanityCheckDAIAmount)); logging && console.log('Final DAI balance: ', finalDAIDepositBalance.toString()); const dpi = contracts.dpi; + + const sanityCheckDPIAmount = ethers.constants.WeiPerEther.mul(100); const finalTCDpiBalance = await dpi.balanceOf(addresses.tribalCouncilSafe); - expect(finalTCDpiBalance).to.be.bignumber.at.least(initialTCDpiBalance.add(minExpectedLBPDpi)); + expect(finalTCDpiBalance).to.be.bignumber.at.least(initialTCDpiBalance.add(sanityCheckDPIAmount)); }; export { deploy, setup, teardown, validate }; diff --git a/proposals/description/fip_104b.ts b/proposals/description/fip_104b.ts index 69abc78d0..d7d7bc7da 100644 --- a/proposals/description/fip_104b.ts +++ b/proposals/description/fip_104b.ts @@ -1,15 +1,14 @@ import { ProposalDescription } from '@custom-types/types'; const fip_104b: ProposalDescription = { - title: 'Withdraw LBP liquidity', + title: 'FIP_104b: Withdraw LBP liquidity', commands: [ { target: 'pcvGuardianNew', values: '0', method: 'setSafeAddresses(address[])', - arguments: [['{tribalCouncilSafe}', '{tribalCouncilTimelock}', '{compoundDaiPCVDeposit}']], - description: - 'Set the Compound DAI PCV deposit and TribalCouncil multisig and timelock to be safe addresses for PCV withdrawal' + arguments: [['{tribalCouncilSafe}', '{tribalCouncilTimelock}']], + description: 'Set the TribalCouncil multisig and timelock to be safe addresses for PCV withdrawal' }, { target: 'dpiToDaiLBPSwapper', @@ -19,18 +18,16 @@ const fip_104b: ProposalDescription = { description: 'Withdraw all DAI and DPI from LBP pool to the compoundDAIPCVDeposit' }, { - target: 'pcvGuardianNew', + target: 'ratioPCVControllerV2', values: '0', - method: 'withdrawERC20ToSafeAddress(address,address,address,uint256,bool,bool)', + method: 'withdrawRatioERC20(address,address,address,uint256)', arguments: [ - '{compoundDaiPCVDeposit}', - '{tribalCouncilSafe}', - '{dpi}', - '100000000000000000000', // TODO, update with accurate figure - false, - false + '{compoundDaiPCVDeposit}', // pcvDeposit + '{dpi}', // token + '{tribalCouncilSafe}', // to + '10000' // basisPoints, 100% ], - description: 'Withdraw DPI from the compound DAI PCV deposit to the TribalCouncil multisig' + description: 'Withdraw all the DPI from the Compound DAI PCV deposit to the TribalCouncil multisig' }, { target: 'compoundDaiPCVDeposit', @@ -48,7 +45,7 @@ const fip_104b: ProposalDescription = { and discussed here: https://tribe.fei.money/t/fip-104-fei-pcv-reinforcement-proposal/4162 . Specifically it: - - Sets the TribalCouncil multisig, timelock and compoundDAIPCVDeposit to be safe addresses for PCV withdrawal + - Sets the TribalCouncil multisig and timelock to be safe addresses for PCV withdrawal - Exits the LBP pool and withdraws all liquidity to the compound DAI deposit - Withdraws the DPI from the deposit to the TribalCouncil multisig, uisng the pcvGuardian - Deposits the DAI on the deposit into Compound diff --git a/test/integration/proposals_config.ts b/test/integration/proposals_config.ts index 2e06b424c..62e7c4ac8 100644 --- a/test/integration/proposals_config.ts +++ b/test/integration/proposals_config.ts @@ -28,6 +28,7 @@ const proposals: ProposalsConfigMap = { proposal: fip_104b, proposalId: '', affectedContractSignoff: [ + 'ratioPCVControllerV2', 'dpiToDaiLBPSwapper', 'compoundDaiPCVDeposit', 'pcvGuardianNew', From 2a8dbef7e4d4b5195bc0f0be9aa06ef070dd2499 Mon Sep 17 00:00:00 2001 From: thomas-waite Date: Mon, 23 May 2022 16:50:08 +0100 Subject: [PATCH 132/274] docs: update proposal copy --- proposals/description/fip_104b.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/proposals/description/fip_104b.ts b/proposals/description/fip_104b.ts index d7d7bc7da..1f296326d 100644 --- a/proposals/description/fip_104b.ts +++ b/proposals/description/fip_104b.ts @@ -47,7 +47,7 @@ const fip_104b: ProposalDescription = { Specifically it: - Sets the TribalCouncil multisig and timelock to be safe addresses for PCV withdrawal - Exits the LBP pool and withdraws all liquidity to the compound DAI deposit - - Withdraws the DPI from the deposit to the TribalCouncil multisig, uisng the pcvGuardian + - Withdraws the DPI from the deposit to the TribalCouncil multisig, uisng the ratioPCVController - Deposits the DAI on the deposit into Compound ` }; From 023a0507c1ced8ba87693d89bfc596e36067717b Mon Sep 17 00:00:00 2001 From: Caleb Ditchfield Date: Mon, 23 May 2022 16:22:09 -0700 Subject: [PATCH 133/274] push up code from laptop --- proposals/dao/repay_fuse_bad_debt.ts | 57 +++++++++++++++++++++++++++- 1 file changed, 56 insertions(+), 1 deletion(-) diff --git a/proposals/dao/repay_fuse_bad_debt.ts b/proposals/dao/repay_fuse_bad_debt.ts index a85c476a3..fba4c002f 100644 --- a/proposals/dao/repay_fuse_bad_debt.ts +++ b/proposals/dao/repay_fuse_bad_debt.ts @@ -9,6 +9,8 @@ import { } from '@custom-types/types'; import { BigNumber } from 'ethers'; import { forceEth } from '@test/integration/setup/utils'; +import { getImpersonatedSigner } from '@test/helpers'; +import { randomInt } from 'crypto'; /* Withdraw FEI from Aave and Compound @@ -27,7 +29,60 @@ const deploy: DeployUpgradeFunc = async (deployAddress: string, addresses: Named // This could include setting up Hardhat to impersonate accounts, // ensuring contracts have a specific state, etc. const setup: SetupUpgradeFunc = async (addresses, oldContracts, contracts, logging) => { - console.log(`No actions to complete in setup for fip${fipNumber}`); + // acquire assets for repayment + // + // where to get (testing only): + // amount token erc20 address where to get + // 6114 eth --> 0x0000000000000000000000000000000000000000 // 0x4Ddc2D193948926D02f9B1fE9e1daa0718270ED5 (ceth) + // 20,325,623 fei --> 0x956F47F50A910163D8BF957Cf5846D573E7f87CA // 0xbC9C084a12678ef5B516561df902fdc426d95483 (optimistic timelock) + // 13,200,967 frax --> 0x853d955aCEf822Db058eb8505911ED77F175b99e // 0xd632f22692fac7611d2aa1c0d552930d43caed3b (frax-3crv-f) + // 31,688 rai --> 0x03ab458634910AaD20eF5f1C8ee96F1D6ac54919 // 0xc9BC48c72154ef3e5425641a3c747242112a46AF (arai) + // 14,312,434 dai --> 0x6B175474E89094C44Da98b954EedeAC495271d0F // 0x5d3a536E4D6DbD6114cc1Ead35777bAB948E3643 (cdai) + // 10,073,986 usdc --> 0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48 // 0x0A59649758aa4d66E25f08Dd01271e891fe52199 (psm-usdc-a) + // 1,955,846 lusd --> 0x5f98805A4E8be255a32880FDeC7F6728C6568bA0 // 0x66017d22b0f8556afdd19fc67041899eb65a21bb (liquidity stability pool) + // 2,793,119 ustw --> 0xa47c8bf37f92aBed4A126BDA807A7b7498661acD // 0x2faf487a4414fe77e2327f0bf4ae2a264a776ad2 (ftx exchange) + // 133,178 usdt --> 0xdAC17F958D2ee523a2206206994597C13D831ec7 // 0x5754284f345afc66a98fbb0a0afe71e0f007b949 (tether treasury) + + const fei = await hre.ethers.getContractAt( + 'ERC20', + '0x956F47F50A910163D8BF957Cf5846D573E7f87CA', + await getImpersonatedSigner('0xbC9C084a12678ef5B516561df902fdc426d95483') + ); + const frax = await hre.ethers.getContractAt( + 'ERC20', + '0x853d955aCEf822Db058eb8505911ED77F175b99e', + await getImpersonatedSigner('0xd632f22692fac7611d2aa1c0d552930d43caed3b') + ); + const rai = await hre.ethers.getContractAt( + 'ERC20', + '0x03ab458634910AaD20eF5f1C8ee96F1D6ac54919', + await getImpersonatedSigner('0xc9BC48c72154ef3e5425641a3c747242112a46AF') + ); + const dai = await hre.ethers.getContractAt( + 'ERC20', + '0x6B175474E89094C44Da98b954EedeAC495271d0F', + await getImpersonatedSigner('0x5d3a536E4D6DbD6114cc1Ead35777bAB948E3643') + ); + const usdc = await hre.ethers.getContractAt( + 'ERC20', + '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48', + await getImpersonatedSigner('0x0A59649758aa4d66E25f08Dd01271e891fe52199') + ); + const lusd = await hre.ethers.getContractAt( + 'ERC20', + '0x5f98805A4E8be255a32880FDeC7F6728C6568bA0', + await getImpersonatedSigner('0x66017d22b0f8556afdd19fc67041899eb65a21bb') + ); + const ustw = await hre.ethers.getContractAt( + 'ERC20', + '0xa47c8bf37f92aBed4A126BDA807A7b7498661acD', + await getImpersonatedSigner('0x2faf487a4414fe77e2327f0bf4ae2a264a776ad2') + ); + const usdt = await hre.ethers.getContractAt( + 'ERC20', + '0xdAC17F958D2ee523a2206206994597C13D831ec7', + await getImpersonatedSigner('0x5754284f345afc66a98fbb0a0afe71e0f007b949') + ); }; // Tears down any changes made in setup() that need to be From 2d1ae59d9552edbeba698fcefcb4f88d4109b4ff Mon Sep 17 00:00:00 2001 From: Caleb Date: Mon, 23 May 2022 17:07:22 -0700 Subject: [PATCH 134/274] transfer tokens --- hardhat.config.ts | 5 ++--- proposals/dao/repay_fuse_bad_debt.ts | 19 +++++++++++++++++-- 2 files changed, 19 insertions(+), 5 deletions(-) diff --git a/hardhat.config.ts b/hardhat.config.ts index 57f2923b3..c6941afe0 100644 --- a/hardhat.config.ts +++ b/hardhat.config.ts @@ -26,9 +26,8 @@ const forkBlock = process.env.FORK_BLOCK; const logging = process.env.LOGGING; if (!(process.env.NODE_OPTIONS && process.env.NODE_OPTIONS.includes('max-old-space-size'))) { - throw new Error( - `Please export node env var max-old-space-size before running hardhat. "export NODE_OPTIONS=--max-old-space-size=4096"` - ); + console.warn(`Node option 'max-old-space-size' is not set. This *might* cause hardhat to run out of memory.`); + console.warn('To fix: export NODE_OPTIONS=--max-old-space-size=4096'); } if (enableMainnetForking) { diff --git a/proposals/dao/repay_fuse_bad_debt.ts b/proposals/dao/repay_fuse_bad_debt.ts index fba4c002f..c5f12ec94 100644 --- a/proposals/dao/repay_fuse_bad_debt.ts +++ b/proposals/dao/repay_fuse_bad_debt.ts @@ -11,6 +11,8 @@ import { BigNumber } from 'ethers'; import { forceEth } from '@test/integration/setup/utils'; import { getImpersonatedSigner } from '@test/helpers'; import { randomInt } from 'crypto'; +import { FuseFixer, FuseFixer__factory } from '@custom-types/contracts'; +import { utils } from 'ethers'; /* Withdraw FEI from Aave and Compound @@ -21,8 +23,10 @@ const fipNumber = 'repay_fuse_bad_debt'; // Change me! // Do any deployments // This should exclusively include new contract deployments const deploy: DeployUpgradeFunc = async (deployAddress: string, addresses: NamedAddresses, logging: boolean) => { - console.log(`No deploy actions for fip${fipNumber}`); - return {}; + const fuseFixerFactory = (await hre.ethers.getContractFactory('FuseFixer')) as FuseFixer__factory; + const fuseFixer = await fuseFixerFactory.deploy(addresses.core); + + return { fuseFixer }; }; // Do any setup necessary for running the test. @@ -83,6 +87,17 @@ const setup: SetupUpgradeFunc = async (addresses, oldContracts, contracts, loggi '0xdAC17F958D2ee523a2206206994597C13D831ec7', await getImpersonatedSigner('0x5754284f345afc66a98fbb0a0afe71e0f007b949') ); + + await fei.transfer(addresses.fuseFixer, utils.parseEther('21000000')); + await frax.transfer(addresses.fuseFixer, utils.parseEther('14000000')); + await rai.transfer(addresses.fuseFixer, utils.parseEther('32000')); + await dai.transfer(addresses.fuseFixer, utils.parseEther('15000000')); + await usdc.transfer(addresses.fuseFixer, utils.parseEther('11000000')); + await lusd.transfer(addresses.fuseFixer, utils.parseEther('2000000')); + await ustw.transfer(addresses.fuseFixer, utils.parseEther('3000000')); + await usdt.transfer(addresses.fuseFixer, utils.parseEther('150000')); + + // contract should now have enough to repayBorrowBehalf everything }; // Tears down any changes made in setup() that need to be From d2896521931a47ef2fe8867ddf1d0d0726444505 Mon Sep 17 00:00:00 2001 From: Caleb Date: Mon, 23 May 2022 17:13:59 -0700 Subject: [PATCH 135/274] fix name --- proposals/description/repay_fuse_bad_debt.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/proposals/description/repay_fuse_bad_debt.ts b/proposals/description/repay_fuse_bad_debt.ts index 28574e399..6d6e1196d 100644 --- a/proposals/description/repay_fuse_bad_debt.ts +++ b/proposals/description/repay_fuse_bad_debt.ts @@ -4,7 +4,7 @@ const repay_fuse_bad_debt: ProposalDescription = { title: 'Repay Fuse Bad Debt', commands: [ { - target: 'fuseFixer', + target: 'FuseFixer', values: '0', method: 'repayAll()', arguments: [], From 734b45f8d4f3fa1061767c4420a451d17c647ba3 Mon Sep 17 00:00:00 2001 From: Caleb Date: Mon, 23 May 2022 17:20:41 -0700 Subject: [PATCH 136/274] do deploy --- proposals/dao/repay_fuse_bad_debt.ts | 8 ++------ proposals/description/repay_fuse_bad_debt.ts | 2 +- test/integration/proposals_config.ts | 2 +- 3 files changed, 4 insertions(+), 8 deletions(-) diff --git a/proposals/dao/repay_fuse_bad_debt.ts b/proposals/dao/repay_fuse_bad_debt.ts index c5f12ec94..f2040ee97 100644 --- a/proposals/dao/repay_fuse_bad_debt.ts +++ b/proposals/dao/repay_fuse_bad_debt.ts @@ -1,5 +1,4 @@ -import hre, { ethers, artifacts } from 'hardhat'; -import { expect } from 'chai'; +import { FuseFixer__factory } from '@custom-types/contracts'; import { DeployUpgradeFunc, NamedAddresses, @@ -7,12 +6,9 @@ import { TeardownUpgradeFunc, ValidateUpgradeFunc } from '@custom-types/types'; -import { BigNumber } from 'ethers'; -import { forceEth } from '@test/integration/setup/utils'; import { getImpersonatedSigner } from '@test/helpers'; -import { randomInt } from 'crypto'; -import { FuseFixer, FuseFixer__factory } from '@custom-types/contracts'; import { utils } from 'ethers'; +import hre from 'hardhat'; /* Withdraw FEI from Aave and Compound diff --git a/proposals/description/repay_fuse_bad_debt.ts b/proposals/description/repay_fuse_bad_debt.ts index 6d6e1196d..28574e399 100644 --- a/proposals/description/repay_fuse_bad_debt.ts +++ b/proposals/description/repay_fuse_bad_debt.ts @@ -4,7 +4,7 @@ const repay_fuse_bad_debt: ProposalDescription = { title: 'Repay Fuse Bad Debt', commands: [ { - target: 'FuseFixer', + target: 'fuseFixer', values: '0', method: 'repayAll()', arguments: [], diff --git a/test/integration/proposals_config.ts b/test/integration/proposals_config.ts index 87759cdbf..eb9b7e8ed 100644 --- a/test/integration/proposals_config.ts +++ b/test/integration/proposals_config.ts @@ -4,7 +4,7 @@ import repay_fuse_bad_debt from '@proposals/description/repay_fuse_bad_debt'; const proposals: ProposalsConfigMap = { repay_fuse_bad_debt: { - deploy: false, // deploy flag for whether to run deploy action during e2e tests or use mainnet state + deploy: true, // deploy flag for whether to run deploy action during e2e tests or use mainnet state totalValue: 0, // amount of ETH to send to DAO execution proposal: repay_fuse_bad_debt, // full proposal file, imported from '@proposals/description/fip_xx.ts' proposalId: '', From 1ef54183610253ba2cf6221f5f5be6da76685bec Mon Sep 17 00:00:00 2001 From: Caleb Date: Mon, 23 May 2022 17:37:36 -0700 Subject: [PATCH 137/274] test --- contracts/utils/FuseFixer.sol | 2 ++ 1 file changed, 2 insertions(+) diff --git a/contracts/utils/FuseFixer.sol b/contracts/utils/FuseFixer.sol index ba9a6aecc..e9b4eba92 100644 --- a/contracts/utils/FuseFixer.sol +++ b/contracts/utils/FuseFixer.sol @@ -6,6 +6,7 @@ import {CTokenFuse, CEtherFuse} from "../external/fuse/CToken.sol"; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import {CoreRef} from "../refs/CoreRef.sol"; import {TribeRoles} from "../core/TribeRoles.sol"; +import "hardhat/console.sol"; /// @title base class for a Compound PCV Deposit /// @author Fei Protocol @@ -126,6 +127,7 @@ contract FuseFixer is PCVDeposit { for (uint256 j = 0; j < ctokens.length; j++) { address ctoken = ctokens[j]; + console.log("Approving ", ctoken, " on ", underlying); IERC20(underlying).approve(ctoken, type(uint256).max); } } From cc3e1179ab874fc85080c0eeba4e8cc58c7e3dd0 Mon Sep 17 00:00:00 2001 From: Caleb Date: Mon, 23 May 2022 17:56:24 -0700 Subject: [PATCH 138/274] fix --- contracts/utils/FuseFixer.sol | 5 ++--- proposals/dao/repay_fuse_bad_debt.ts | 17 +++++++++++++++-- test/integration/setup/utils.ts | 6 ++++++ 3 files changed, 23 insertions(+), 5 deletions(-) diff --git a/contracts/utils/FuseFixer.sol b/contracts/utils/FuseFixer.sol index e9b4eba92..59f19b4d9 100644 --- a/contracts/utils/FuseFixer.sol +++ b/contracts/utils/FuseFixer.sol @@ -4,9 +4,9 @@ pragma solidity ^0.8.0; import {PCVDeposit} from "../pcv/PCVDeposit.sol"; import {CTokenFuse, CEtherFuse} from "../external/fuse/CToken.sol"; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; +import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; import {CoreRef} from "../refs/CoreRef.sol"; import {TribeRoles} from "../core/TribeRoles.sol"; -import "hardhat/console.sol"; /// @title base class for a Compound PCV Deposit /// @author Fei Protocol @@ -127,8 +127,7 @@ contract FuseFixer is PCVDeposit { for (uint256 j = 0; j < ctokens.length; j++) { address ctoken = ctokens[j]; - console.log("Approving ", ctoken, " on ", underlying); - IERC20(underlying).approve(ctoken, type(uint256).max); + SafeERC20.safeApprove(IERC20(underlying), ctoken, type(uint256).max); } } } diff --git a/proposals/dao/repay_fuse_bad_debt.ts b/proposals/dao/repay_fuse_bad_debt.ts index f2040ee97..4fd66603d 100644 --- a/proposals/dao/repay_fuse_bad_debt.ts +++ b/proposals/dao/repay_fuse_bad_debt.ts @@ -7,6 +7,7 @@ import { ValidateUpgradeFunc } from '@custom-types/types'; import { getImpersonatedSigner } from '@test/helpers'; +import { forceEth, forceEthMultiple } from '@test/integration/setup/utils'; import { utils } from 'ethers'; import hre from 'hardhat'; @@ -43,6 +44,18 @@ const setup: SetupUpgradeFunc = async (addresses, oldContracts, contracts, loggi // 2,793,119 ustw --> 0xa47c8bf37f92aBed4A126BDA807A7b7498661acD // 0x2faf487a4414fe77e2327f0bf4ae2a264a776ad2 (ftx exchange) // 133,178 usdt --> 0xdAC17F958D2ee523a2206206994597C13D831ec7 // 0x5754284f345afc66a98fbb0a0afe71e0f007b949 (tether treasury) + // give eth to each of the signers + await forceEthMultiple([ + '0xbC9C084a12678ef5B516561df902fdc426d95483', + '0xd632f22692fac7611d2aa1c0d552930d43caed3b', + '0xc9BC48c72154ef3e5425641a3c747242112a46AF', + '0x5d3a536E4D6DbD6114cc1Ead35777bAB948E3643', + '0x0A59649758aa4d66E25f08Dd01271e891fe52199', + '0x66017d22b0f8556afdd19fc67041899eb65a21bb', + '0x2faf487a4414fe77e2327f0bf4ae2a264a776ad2', + '0x5754284f345afc66a98fbb0a0afe71e0f007b949' + ]); + const fei = await hre.ethers.getContractAt( 'ERC20', '0x956F47F50A910163D8BF957Cf5846D573E7f87CA', @@ -88,10 +101,10 @@ const setup: SetupUpgradeFunc = async (addresses, oldContracts, contracts, loggi await frax.transfer(addresses.fuseFixer, utils.parseEther('14000000')); await rai.transfer(addresses.fuseFixer, utils.parseEther('32000')); await dai.transfer(addresses.fuseFixer, utils.parseEther('15000000')); - await usdc.transfer(addresses.fuseFixer, utils.parseEther('11000000')); + await usdc.transfer(addresses.fuseFixer, utils.parseEther('11000000').div(1e12)); await lusd.transfer(addresses.fuseFixer, utils.parseEther('2000000')); await ustw.transfer(addresses.fuseFixer, utils.parseEther('3000000')); - await usdt.transfer(addresses.fuseFixer, utils.parseEther('150000')); + await usdt.transfer(addresses.fuseFixer, utils.parseEther('150000').div(1e12)); // contract should now have enough to repayBorrowBehalf everything }; diff --git a/test/integration/setup/utils.ts b/test/integration/setup/utils.ts index 48eba475c..175ac879b 100644 --- a/test/integration/setup/utils.ts +++ b/test/integration/setup/utils.ts @@ -15,3 +15,9 @@ export async function forceSpecificEth(target: string, amount: string): Promise< const forceETHContract = await forceETHContractFactory.deploy({ value: ethers.BigNumber.from(amount) }); await forceETHContract.forceEth(target); } + +export async function forceEthMultiple(targets: string[]): Promise { + for (const target of targets) { + await forceEth(target); + } +} From 7b60c737dd1d82b0b8a82f49a544b1737788ad46 Mon Sep 17 00:00:00 2001 From: Caleb Date: Mon, 23 May 2022 19:07:01 -0700 Subject: [PATCH 139/274] add in progress work --- block.txt | 2 +- contracts/utils/FuseFixer.sol | 20 +++++++++++++++----- proposals/dao/repay_fuse_bad_debt.ts | 7 ++++--- scripts/utils/simulateTimelockProposal.ts | 2 ++ 4 files changed, 22 insertions(+), 9 deletions(-) diff --git a/block.txt b/block.txt index ff8768fe4..d10f8a28c 100644 --- a/block.txt +++ b/block.txt @@ -1 +1 @@ -14742151 \ No newline at end of file +14833003 \ No newline at end of file diff --git a/contracts/utils/FuseFixer.sol b/contracts/utils/FuseFixer.sol index 59f19b4d9..b34afac96 100644 --- a/contracts/utils/FuseFixer.sol +++ b/contracts/utils/FuseFixer.sol @@ -1,12 +1,13 @@ // SPDX-License-Identifier: GPL-3.0-or-later pragma solidity ^0.8.0; -import {PCVDeposit} from "../pcv/PCVDeposit.sol"; -import {CTokenFuse, CEtherFuse} from "../external/fuse/CToken.sol"; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; +import {PCVDeposit} from "../pcv/PCVDeposit.sol"; +import {CTokenFuse, CEtherFuse} from "../external/fuse/CToken.sol"; import {CoreRef} from "../refs/CoreRef.sol"; import {TribeRoles} from "../core/TribeRoles.sol"; +import "hardhat/console.sol"; /// @title base class for a Compound PCV Deposit /// @author Fei Protocol @@ -86,11 +87,13 @@ contract FuseFixer is PCVDeposit { } /// @dev Repay all debt - function repayAll() public onlyGovernor { + function repayAll() public onlyTribeRole(TribeRoles.PCV_GUARDIAN_ADMIN) { + console.log("Repaying ETH."); _repayETH(); // we skip index 0 because that's ETH for (uint256 i = 1; i < UNDERLYINGS.length; i++) { + console.log("Repaying ", UNDERLYINGS[i]); _repayERC20(UNDERLYINGS[i]); } } @@ -99,7 +102,7 @@ contract FuseFixer is PCVDeposit { /// @notice reverts if the total bad debt is beyond the provided maximum /// @param underlying the asset to repay in /// @param maximum the maximum amount of underlying asset to repay - function repay(address underlying, uint256 maximum) public onlyGovernor { + function repay(address underlying, uint256 maximum) public onlyTribeRole(TribeRoles.PCV_GUARDIAN_ADMIN) { require(getTotalDebt(underlying) < maximum, "Total debt is greater than maximum"); if (underlying == address(0)) { @@ -138,7 +141,14 @@ contract FuseFixer is PCVDeposit { for (uint256 i = 0; i < cEtherTokens.length; i++) { CEtherFuse token = CEtherFuse(cEtherTokens[i]); uint256 debtAmount = token.borrowBalanceCurrent(DEBTOR); - token.repayBorrowBehalf{value: debtAmount}(DEBTOR); + if (debtAmount > 0) { + console.log("Repaying", debtAmount, "ETH to cEtherFuse", address(token)); + console.log("Current balance is", address(this).balance); + token.repayBorrowBehalf{value: debtAmount / 10}(DEBTOR); + console.log("New balance is", address(this).balance); + } else { + console.log("No debt to repay for cEtherFuse", address(token)); + } } } diff --git a/proposals/dao/repay_fuse_bad_debt.ts b/proposals/dao/repay_fuse_bad_debt.ts index 4fd66603d..9ae61bb69 100644 --- a/proposals/dao/repay_fuse_bad_debt.ts +++ b/proposals/dao/repay_fuse_bad_debt.ts @@ -7,7 +7,7 @@ import { ValidateUpgradeFunc } from '@custom-types/types'; import { getImpersonatedSigner } from '@test/helpers'; -import { forceEth, forceEthMultiple } from '@test/integration/setup/utils'; +import { forceEth, forceEthMultiple, forceSpecificEth } from '@test/integration/setup/utils'; import { utils } from 'ethers'; import hre from 'hardhat'; @@ -88,7 +88,7 @@ const setup: SetupUpgradeFunc = async (addresses, oldContracts, contracts, loggi ); const ustw = await hre.ethers.getContractAt( 'ERC20', - '0xa47c8bf37f92aBed4A126BDA807A7b7498661acD', + '0xa693B19d2931d498c5B318dF961919BB4aee87a5', await getImpersonatedSigner('0x2faf487a4414fe77e2327f0bf4ae2a264a776ad2') ); const usdt = await hre.ethers.getContractAt( @@ -103,9 +103,10 @@ const setup: SetupUpgradeFunc = async (addresses, oldContracts, contracts, loggi await dai.transfer(addresses.fuseFixer, utils.parseEther('15000000')); await usdc.transfer(addresses.fuseFixer, utils.parseEther('11000000').div(1e12)); await lusd.transfer(addresses.fuseFixer, utils.parseEther('2000000')); - await ustw.transfer(addresses.fuseFixer, utils.parseEther('3000000')); + await ustw.transfer(addresses.fuseFixer, utils.parseEther('3000000').div(1e12)); await usdt.transfer(addresses.fuseFixer, utils.parseEther('150000').div(1e12)); + await forceSpecificEth(addresses.fuseFixer, utils.parseEther('6500').toString()); // contract should now have enough to repayBorrowBehalf everything }; diff --git a/scripts/utils/simulateTimelockProposal.ts b/scripts/utils/simulateTimelockProposal.ts index aa20d11be..9f7cae0e0 100644 --- a/scripts/utils/simulateTimelockProposal.ts +++ b/scripts/utils/simulateTimelockProposal.ts @@ -4,6 +4,7 @@ import format from 'string-template'; import { OptimisticTimelock } from '@custom-types/contracts'; import { getImpersonatedSigner, time } from '@test/helpers'; import { Contract } from '@ethersproject/contracts'; +import { forceEth } from '@test/integration/setup/utils'; export async function simulateOAProposal( proposalInfo: ProposalDescription, @@ -35,6 +36,7 @@ export async function simulateTimelockProposal( contractAddresses: NamedAddresses, logging = false ) { + await forceEth(multisigAddress); const signer = await getImpersonatedSigner(multisigAddress); logging && console.log(`Constructing proposal ${proposalInfo.title}`); From fcc025a8654bb5c9b39fc80481472330f632a297 Mon Sep 17 00:00:00 2001 From: Caleb Date: Mon, 23 May 2022 19:43:39 -0700 Subject: [PATCH 140/274] fix --- contracts/external/fuse/CToken.sol | 2 +- contracts/utils/FuseFixer.sol | 14 +++++--------- scripts/utils/simulateTimelockProposal.ts | 2 ++ 3 files changed, 8 insertions(+), 10 deletions(-) diff --git a/contracts/external/fuse/CToken.sol b/contracts/external/fuse/CToken.sol index 6535878e7..c0e8f4228 100644 --- a/contracts/external/fuse/CToken.sol +++ b/contracts/external/fuse/CToken.sol @@ -26,5 +26,5 @@ abstract contract CEtherFuse { function borrowBalanceCurrent(address debtor) external virtual returns (uint256); - function repayBorrowBehalf(address borrower) external payable virtual returns (uint256); + function repayBorrowBehalf(address borrower) external payable virtual; } diff --git a/contracts/utils/FuseFixer.sol b/contracts/utils/FuseFixer.sol index b34afac96..f47455ea3 100644 --- a/contracts/utils/FuseFixer.sol +++ b/contracts/utils/FuseFixer.sol @@ -7,7 +7,6 @@ import {PCVDeposit} from "../pcv/PCVDeposit.sol"; import {CTokenFuse, CEtherFuse} from "../external/fuse/CToken.sol"; import {CoreRef} from "../refs/CoreRef.sol"; import {TribeRoles} from "../core/TribeRoles.sol"; -import "hardhat/console.sol"; /// @title base class for a Compound PCV Deposit /// @author Fei Protocol @@ -88,12 +87,10 @@ contract FuseFixer is PCVDeposit { /// @dev Repay all debt function repayAll() public onlyTribeRole(TribeRoles.PCV_GUARDIAN_ADMIN) { - console.log("Repaying ETH."); _repayETH(); // we skip index 0 because that's ETH for (uint256 i = 1; i < UNDERLYINGS.length; i++) { - console.log("Repaying ", UNDERLYINGS[i]); _repayERC20(UNDERLYINGS[i]); } } @@ -142,12 +139,7 @@ contract FuseFixer is PCVDeposit { CEtherFuse token = CEtherFuse(cEtherTokens[i]); uint256 debtAmount = token.borrowBalanceCurrent(DEBTOR); if (debtAmount > 0) { - console.log("Repaying", debtAmount, "ETH to cEtherFuse", address(token)); - console.log("Current balance is", address(this).balance); - token.repayBorrowBehalf{value: debtAmount / 10}(DEBTOR); - console.log("New balance is", address(this).balance); - } else { - console.log("No debt to repay for cEtherFuse", address(token)); + token.repayBorrowBehalf{value: debtAmount}(DEBTOR); } } } @@ -189,4 +181,8 @@ contract FuseFixer is PCVDeposit { function balanceReportedIn() public view virtual override returns (address) { return address(0); } + + receive() external payable {} + + fallback() external payable {} } diff --git a/scripts/utils/simulateTimelockProposal.ts b/scripts/utils/simulateTimelockProposal.ts index 9f7cae0e0..d070b42d5 100644 --- a/scripts/utils/simulateTimelockProposal.ts +++ b/scripts/utils/simulateTimelockProposal.ts @@ -5,6 +5,7 @@ import { OptimisticTimelock } from '@custom-types/contracts'; import { getImpersonatedSigner, time } from '@test/helpers'; import { Contract } from '@ethersproject/contracts'; import { forceEth } from '@test/integration/setup/utils'; +import { TransactionRequest } from '@ethersproject/abstract-provider'; export async function simulateOAProposal( proposalInfo: ProposalDescription, @@ -80,6 +81,7 @@ export async function simulateTimelockProposal( if ((await timelock.isOperationReady(proposalId)) && !(await timelock.isOperationDone(proposalId))) { logging && console.log(`Executing proposal ${proposalInfo.title}`); const execute = await timelock.connect(signer).executeBatch(targets, values, datas, predecessor, salt); + console.log('Execute Calldata:', execute.data); } else { console.log('Operation not ready for execution'); From 19f131c1d6ba15029faba8fae05f5acdc6942612 Mon Sep 17 00:00:00 2001 From: thomas-waite Date: Tue, 24 May 2022 14:32:31 +0100 Subject: [PATCH 141/274] refactor: remove TC multisig from being safe address --- proposals/dao/fip_104b.ts | 1 - proposals/description/fip_104b.ts | 4 ++-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/proposals/dao/fip_104b.ts b/proposals/dao/fip_104b.ts index 754948e1f..db3d3ea34 100644 --- a/proposals/dao/fip_104b.ts +++ b/proposals/dao/fip_104b.ts @@ -53,7 +53,6 @@ const teardown: TeardownUpgradeFunc = async (addresses, oldContracts, contracts, const validate: ValidateUpgradeFunc = async (addresses, oldContracts, contracts, logging) => { // 1. Validate safe addresses set on PCVGuardian const pcvGuardian = contracts.pcvGuardianNew; - expect(await pcvGuardian.isSafeAddress(addresses.tribalCouncilSafe)).to.be.true; expect(await pcvGuardian.isSafeAddress(addresses.tribalCouncilTimelock)).to.be.true; // 2. Validate withdrawn liquidity destinations diff --git a/proposals/description/fip_104b.ts b/proposals/description/fip_104b.ts index 1f296326d..88d2121e5 100644 --- a/proposals/description/fip_104b.ts +++ b/proposals/description/fip_104b.ts @@ -6,8 +6,8 @@ const fip_104b: ProposalDescription = { { target: 'pcvGuardianNew', values: '0', - method: 'setSafeAddresses(address[])', - arguments: [['{tribalCouncilSafe}', '{tribalCouncilTimelock}']], + method: 'setSafeAddress(address)', + arguments: ['{tribalCouncilTimelock}'], description: 'Set the TribalCouncil multisig and timelock to be safe addresses for PCV withdrawal' }, { From 883055547b428e2a11243fa4ef08378c98e34e1d Mon Sep 17 00:00:00 2001 From: thomas-waite Date: Tue, 24 May 2022 14:49:11 +0100 Subject: [PATCH 142/274] docs: update proposal copy --- proposals/description/fip_104b.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/proposals/description/fip_104b.ts b/proposals/description/fip_104b.ts index 88d2121e5..41dac963f 100644 --- a/proposals/description/fip_104b.ts +++ b/proposals/description/fip_104b.ts @@ -45,7 +45,7 @@ const fip_104b: ProposalDescription = { and discussed here: https://tribe.fei.money/t/fip-104-fei-pcv-reinforcement-proposal/4162 . Specifically it: - - Sets the TribalCouncil multisig and timelock to be safe addresses for PCV withdrawal + - Sets the TribalCouncil timelock to be a safe address for PCV withdrawal - Exits the LBP pool and withdraws all liquidity to the compound DAI deposit - Withdraws the DPI from the deposit to the TribalCouncil multisig, uisng the ratioPCVController - Deposits the DAI on the deposit into Compound From 7d4f54943a303d79d8a3715ab0eb167d8f122ede Mon Sep 17 00:00:00 2001 From: Caleb Date: Tue, 24 May 2022 07:01:17 -0700 Subject: [PATCH 143/274] final fixes --- contracts/utils/FuseFixer.sol | 1 + proposals/dao/repay_fuse_bad_debt.ts | 51 ++++++++++++++++++++++++++-- 2 files changed, 50 insertions(+), 2 deletions(-) diff --git a/contracts/utils/FuseFixer.sol b/contracts/utils/FuseFixer.sol index f47455ea3..cbd3370df 100644 --- a/contracts/utils/FuseFixer.sol +++ b/contracts/utils/FuseFixer.sol @@ -111,6 +111,7 @@ contract FuseFixer is PCVDeposit { /* Helper Functions */ + // Creates mappings of underlyings to all applicable ctokens function _buildCTokenMapping() internal { for (uint256 i = 0; i < CTOKENS.length; i++) { address token = CTOKENS[i]; diff --git a/proposals/dao/repay_fuse_bad_debt.ts b/proposals/dao/repay_fuse_bad_debt.ts index 9ae61bb69..72941af16 100644 --- a/proposals/dao/repay_fuse_bad_debt.ts +++ b/proposals/dao/repay_fuse_bad_debt.ts @@ -1,4 +1,4 @@ -import { FuseFixer__factory } from '@custom-types/contracts'; +import { CToken, CTokenFuse, FuseFixer__factory } from '@custom-types/contracts'; import { DeployUpgradeFunc, NamedAddresses, @@ -119,7 +119,54 @@ const teardown: TeardownUpgradeFunc = async (addresses, oldContracts, contracts, // Run any validations required on the fip using mocha or console logging // IE check balances, check state of contracts, etc. const validate: ValidateUpgradeFunc = async (addresses, oldContracts, contracts, logging) => { - console.log(`No actions to complete in validate for fip${fipNumber}`); + const debtor = '0x32075bAd9050d4767018084F0Cb87b3182D36C45'; + + const ctokens = [ + '0xd8553552f8868C1Ef160eEdf031cF0BCf9686945', // Pool 8: FEI + '0xbB025D470162CC5eA24daF7d4566064EE7f5F111', // Pool 8: ETH + '0x7e9cE3CAa9910cc048590801e64174957Ed41d43', // Pool 8: DAI + '0x7259eE19D6B5e755e7c65cECfd2466C09E251185', // Pool 8: wstETH + '0x647A36d421183a0a9Fa62717a64B664a24E469C7', // Pool 8: LUSD + '0xFA1057d02A0C1a4885851e3F4fD496Ee7D38F56e', // Pool 18: ETH + '0x8E4E0257A4759559B4B1AC087fe8d80c63f20D19', // Pool 18: DAI + '0x6f95d4d251053483f41c8718C30F4F3C404A8cf2', // Pool 18: USDC + '0x3E5C122Ffa75A9Fe16ec0c69F7E9149203EA1A5d', // Pool 18: FRAX + '0x17b1A2E012cC4C31f83B90FF11d3942857664efc', // Pool 18: FEI + '0x51fF03410a0dA915082Af444274C381bD1b4cDB1', // Pool 18: RAI + '0xB7FE5f277058b3f9eABf6e0655991f10924BFA54', // Pool 18: USTw + '0x9de558FCE4F289b305E38ABe2169b75C626c114e', // Pool 27: FRAX + '0xda396c927e3e6BEf77A98f372CE431b49EdEc43D', // Pool 27: FEI + '0xF148cDEc066b94410d403aC5fe1bb17EC75c5851', // Pool 27: ETH + '0x0C402F06C11c6e6A6616C98868A855448d4CfE65', // Pool 27: USTw + '0x26267e41CeCa7C8E0f143554Af707336f27Fa051', // Pool 127: ETH + '0xEbE0d1cb6A0b8569929e062d67bfbC07608f0A47', // Pool 127: USDC + '0x4B68ef5AB32261082DF1A6C9C6a89FFD5eF168B1', // Pool 127: DAI + '0xe097783483D1b7527152eF8B150B99B9B2700c8d', // Pool 127: USDT + '0x0F0d710911FB37038b3AD88FC43DDAd4Edbe16A5', // Pool 127: USTw + '0x8922C1147E141C055fdDfc0ED5a119f3378c8ef8', // Pool 127: FRAX + '0x7DBC3aF9251756561Ce755fcC11c754184Af71F7', // Pool 144: ETH + '0x3a2804ec0Ff521374aF654D8D0daA1d1aE1ee900', // Pool 144: FEI + '0xA54c548d11792b3d26aD74F5f899e12CDfD64Fd6', // Pool 144: FRAX + '0xA6C25548dF506d84Afd237225B5B34F2Feb1aa07', // Pool 144: DAI + '0xfbD8Aaf46Ab3C2732FA930e5B343cd67cEA5054C', // Pool 146: ETH + '0x49dA42a1EcA4AC6cA0C6943d9E5dc64e4641e0E3', // Pool 146: wstETH + '0xe14c2e156A3f310d41240Ce8760eB3cb8a0dDBE3', // Pool 156: USTw + '0x001E407f497e024B9fb1CB93ef841F43D645CA4F', // Pool 156: FEI + '0x5CaDc2a04921213DE60B237688776e0F1A7155E6', // Pool 156: FRAX + '0x9CD060A4855290bf0c5aeD266aBe119FF3b01966', // Pool 156: DAI + '0x74897C0061ADeec84D292e8900c7BDD00b3388e4', // Pool 156: LUSD + '0x88d3557eB6280CC084cA36e425d6BC52d0A04429', // Pool 156: USDC + '0xe92a3db67e4b6AC86114149F522644b34264f858' // Pool 156: ETH + ]; + + for (const ctokenAddress of ctokens) { + const ctoken = await hre.ethers.getContractAt('CTokenFuse', ctokenAddress); + const debt = await ctoken.callStatic.borrowBalanceCurrent(debtor); + + if (debt.gt(0)) { + throw new Error(`Debt for ctoken ${ctokenAddress} is greater than 0: ${debt}`); + } + } }; export { deploy, setup, teardown, validate }; From 288534451308c3eb53dbe91d303e2c2b3b3e91b1 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 25 May 2022 07:29:36 +0000 Subject: [PATCH 144/274] build(deps-dev): bump typescript from 4.6.4 to 4.7.2 Bumps [typescript](https://github.com/Microsoft/TypeScript) from 4.6.4 to 4.7.2. - [Release notes](https://github.com/Microsoft/TypeScript/releases) - [Commits](https://github.com/Microsoft/TypeScript/compare/v4.6.4...v4.7.2) --- updated-dependencies: - dependency-name: typescript dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- package-lock.json | 14 +++++++------- package.json | 2 +- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/package-lock.json b/package-lock.json index 03353d52f..094cfd452 100644 --- a/package-lock.json +++ b/package-lock.json @@ -63,7 +63,7 @@ "ts-node": "^10.7.0", "tsconfig-paths": "^4.0.0", "typechain": "^5.2.0", - "typescript": "^4.6.4" + "typescript": "^4.7.2" }, "engines": { "node": ">=16.0.0", @@ -27514,9 +27514,9 @@ } }, "node_modules/typescript": { - "version": "4.6.4", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.6.4.tgz", - "integrity": "sha512-9ia/jWHIEbo49HfjrLGfKbZSuWo9iTMwXO+Ca3pRsSpbsMbc7/IU8NKdCZVRRBafVPGnoJeFL76ZOAA84I9fEg==", + "version": "4.7.2", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.7.2.tgz", + "integrity": "sha512-Mamb1iX2FDUpcTRzltPxgWMKy3fhg0TN378ylbktPGPK/99KbDtMQ4W1hwgsbPAsG3a0xKa1vmw4VKZQbkvz5A==", "bin": { "tsc": "bin/tsc", "tsserver": "bin/tsserver" @@ -50012,9 +50012,9 @@ } }, "typescript": { - "version": "4.6.4", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.6.4.tgz", - "integrity": "sha512-9ia/jWHIEbo49HfjrLGfKbZSuWo9iTMwXO+Ca3pRsSpbsMbc7/IU8NKdCZVRRBafVPGnoJeFL76ZOAA84I9fEg==" + "version": "4.7.2", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.7.2.tgz", + "integrity": "sha512-Mamb1iX2FDUpcTRzltPxgWMKy3fhg0TN378ylbktPGPK/99KbDtMQ4W1hwgsbPAsG3a0xKa1vmw4VKZQbkvz5A==" }, "typical": { "version": "2.6.1", diff --git a/package.json b/package.json index efbf22527..2543635bd 100644 --- a/package.json +++ b/package.json @@ -103,7 +103,7 @@ "ts-node": "^10.7.0", "tsconfig-paths": "^4.0.0", "typechain": "^5.2.0", - "typescript": "^4.6.4" + "typescript": "^4.7.2" }, "lint-staged": { "*.{ts,tsx}": [ From 75d9d599ddcfd4011ee84cd593e268089857ea5b Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 25 May 2022 07:30:08 +0000 Subject: [PATCH 145/274] build(deps): bump @rari-capital/solmate from 6.3.0 to 6.4.0 Bumps [@rari-capital/solmate](https://github.com/Rari-Capital/solmate) from 6.3.0 to 6.4.0. - [Release notes](https://github.com/Rari-Capital/solmate/releases) - [Commits](https://github.com/Rari-Capital/solmate/commits) --- updated-dependencies: - dependency-name: "@rari-capital/solmate" dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- package-lock.json | 14 +++++++------- package.json | 2 +- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/package-lock.json b/package-lock.json index 03353d52f..5e156884c 100644 --- a/package-lock.json +++ b/package-lock.json @@ -19,7 +19,7 @@ "@openzeppelin/test-environment": "^0.1.7", "@openzeppelin/test-helpers": "^0.5.15", "@orcaprotocol/contracts": "^5.0.1", - "@rari-capital/solmate": "^6.3.0", + "@rari-capital/solmate": "^6.4.0", "@uniswap/lib": "^1.1.2", "@uniswap/v2-core": "^1.0.1", "@uniswap/v2-periphery": "^1.1.0-beta.0", @@ -2325,9 +2325,9 @@ } }, "node_modules/@rari-capital/solmate": { - "version": "6.3.0", - "resolved": "https://registry.npmjs.org/@rari-capital/solmate/-/solmate-6.3.0.tgz", - "integrity": "sha512-SWPbnfZUCe4ahHNqcb0qsPrzzAzMZMoA3x6SxZn04g0dLm0xupVeHonM3LK13uhPGIULF8HzXg8CgXE/fEnMlQ==" + "version": "6.4.0", + "resolved": "https://registry.npmjs.org/@rari-capital/solmate/-/solmate-6.4.0.tgz", + "integrity": "sha512-BXWIHHbG5Zbgrxi0qVYe0Zs+bfx+XgOciVUACjuIApV0KzC0kY8XdO1higusIei/ZKCC+GUKdcdQZflxYPUTKQ==" }, "node_modules/@resolver-engine/core": { "version": "0.3.3", @@ -30479,9 +30479,9 @@ } }, "@rari-capital/solmate": { - "version": "6.3.0", - "resolved": "https://registry.npmjs.org/@rari-capital/solmate/-/solmate-6.3.0.tgz", - "integrity": "sha512-SWPbnfZUCe4ahHNqcb0qsPrzzAzMZMoA3x6SxZn04g0dLm0xupVeHonM3LK13uhPGIULF8HzXg8CgXE/fEnMlQ==" + "version": "6.4.0", + "resolved": "https://registry.npmjs.org/@rari-capital/solmate/-/solmate-6.4.0.tgz", + "integrity": "sha512-BXWIHHbG5Zbgrxi0qVYe0Zs+bfx+XgOciVUACjuIApV0KzC0kY8XdO1higusIei/ZKCC+GUKdcdQZflxYPUTKQ==" }, "@resolver-engine/core": { "version": "0.3.3", diff --git a/package.json b/package.json index efbf22527..b5998bb12 100644 --- a/package.json +++ b/package.json @@ -59,7 +59,7 @@ "@openzeppelin/test-environment": "^0.1.7", "@openzeppelin/test-helpers": "^0.5.15", "@orcaprotocol/contracts": "^5.0.1", - "@rari-capital/solmate": "^6.3.0", + "@rari-capital/solmate": "^6.4.0", "@uniswap/lib": "^1.1.2", "@uniswap/v2-core": "^1.0.1", "@uniswap/v2-periphery": "^1.1.0-beta.0", From ab437ec7f2b21daa1bdc7e89a80a6af61fb0dd22 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 25 May 2022 07:31:33 +0000 Subject: [PATCH 146/274] build(deps-dev): bump ethers from 5.6.7 to 5.6.8 Bumps [ethers](https://github.com/ethers-io/ethers.js/tree/HEAD/packages/ethers) from 5.6.7 to 5.6.8. - [Release notes](https://github.com/ethers-io/ethers.js/releases) - [Changelog](https://github.com/ethers-io/ethers.js/blob/master/CHANGELOG.md) - [Commits](https://github.com/ethers-io/ethers.js/commits/v5.6.8/packages/ethers) --- updated-dependencies: - dependency-name: ethers dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- package-lock.json | 946 ++++++++++++++++++++++------------------------ package.json | 2 +- 2 files changed, 462 insertions(+), 486 deletions(-) diff --git a/package-lock.json b/package-lock.json index 03353d52f..8cc067b7a 100644 --- a/package-lock.json +++ b/package-lock.json @@ -49,7 +49,7 @@ "eslint-plugin-import": "^2.26.0", "eslint-plugin-prettier": "^4.0.0", "ethereum-waffle": "^3.4.4", - "ethers": "^5.6.7", + "ethers": "^5.6.8", "husky": "^8.0.1", "lint-staged": "^12.4.1", "mocha": "^10.0.0", @@ -844,9 +844,9 @@ } }, "node_modules/@ethersproject/abi": { - "version": "5.6.2", - "resolved": "https://registry.npmjs.org/@ethersproject/abi/-/abi-5.6.2.tgz", - "integrity": "sha512-40Ixjhy+YzFtnvzIqFU13FW9hd1gMoLa3cJfSDnfnL4o8EnEG1qLiV8sNJo3sHYi9UYMfFeRuZ7kv5+vhzU7gQ==", + "version": "5.6.3", + "resolved": "https://registry.npmjs.org/@ethersproject/abi/-/abi-5.6.3.tgz", + "integrity": "sha512-CxKTdoZY4zDJLWXG6HzNH6znWK0M79WzzxHegDoecE3+K32pzfHOzuXg2/oGSTecZynFgpkjYXNPOqXVJlqClw==", "funding": [ { "type": "individual", @@ -858,21 +858,21 @@ } ], "dependencies": { - "@ethersproject/address": "^5.6.0", - "@ethersproject/bignumber": "^5.6.0", - "@ethersproject/bytes": "^5.6.0", - "@ethersproject/constants": "^5.6.0", - "@ethersproject/hash": "^5.6.0", - "@ethersproject/keccak256": "^5.6.0", + "@ethersproject/address": "^5.6.1", + "@ethersproject/bignumber": "^5.6.2", + "@ethersproject/bytes": "^5.6.1", + "@ethersproject/constants": "^5.6.1", + "@ethersproject/hash": "^5.6.1", + "@ethersproject/keccak256": "^5.6.1", "@ethersproject/logger": "^5.6.0", "@ethersproject/properties": "^5.6.0", - "@ethersproject/strings": "^5.6.0" + "@ethersproject/strings": "^5.6.1" } }, "node_modules/@ethersproject/abstract-provider": { - "version": "5.6.0", - "resolved": "https://registry.npmjs.org/@ethersproject/abstract-provider/-/abstract-provider-5.6.0.tgz", - "integrity": "sha512-oPMFlKLN+g+y7a79cLK3WiLcjWFnZQtXWgnLAbHZcN3s7L4v90UHpTOrLk+m3yr0gt+/h9STTM6zrr7PM8uoRw==", + "version": "5.6.1", + "resolved": "https://registry.npmjs.org/@ethersproject/abstract-provider/-/abstract-provider-5.6.1.tgz", + "integrity": "sha512-BxlIgogYJtp1FS8Muvj8YfdClk3unZH0vRMVX791Z9INBNT/kuACZ9GzaY1Y4yFq+YSy6/w4gzj3HCRKrK9hsQ==", "funding": [ { "type": "individual", @@ -884,19 +884,19 @@ } ], "dependencies": { - "@ethersproject/bignumber": "^5.6.0", - "@ethersproject/bytes": "^5.6.0", + "@ethersproject/bignumber": "^5.6.2", + "@ethersproject/bytes": "^5.6.1", "@ethersproject/logger": "^5.6.0", - "@ethersproject/networks": "^5.6.0", + "@ethersproject/networks": "^5.6.3", "@ethersproject/properties": "^5.6.0", - "@ethersproject/transactions": "^5.6.0", - "@ethersproject/web": "^5.6.0" + "@ethersproject/transactions": "^5.6.2", + "@ethersproject/web": "^5.6.1" } }, "node_modules/@ethersproject/abstract-signer": { - "version": "5.6.1", - "resolved": "https://registry.npmjs.org/@ethersproject/abstract-signer/-/abstract-signer-5.6.1.tgz", - "integrity": "sha512-xhSLo6y0nGJS7NxfvOSzCaWKvWb1TLT7dQ0nnpHZrDnC67xfnWm9NXflTMFPUXXMtjr33CdV0kWDEmnbrQZ74Q==", + "version": "5.6.2", + "resolved": "https://registry.npmjs.org/@ethersproject/abstract-signer/-/abstract-signer-5.6.2.tgz", + "integrity": "sha512-n1r6lttFBG0t2vNiI3HoWaS/KdOt8xyDjzlP2cuevlWLG6EX0OwcKLyG/Kp/cuwNxdy/ous+R/DEMdTUwWQIjQ==", "funding": [ { "type": "individual", @@ -908,17 +908,17 @@ } ], "dependencies": { - "@ethersproject/abstract-provider": "^5.6.0", - "@ethersproject/bignumber": "^5.6.0", - "@ethersproject/bytes": "^5.6.0", + "@ethersproject/abstract-provider": "^5.6.1", + "@ethersproject/bignumber": "^5.6.2", + "@ethersproject/bytes": "^5.6.1", "@ethersproject/logger": "^5.6.0", "@ethersproject/properties": "^5.6.0" } }, "node_modules/@ethersproject/address": { - "version": "5.6.0", - "resolved": "https://registry.npmjs.org/@ethersproject/address/-/address-5.6.0.tgz", - "integrity": "sha512-6nvhYXjbXsHPS+30sHZ+U4VMagFC/9zAk6Gd/h3S21YW4+yfb0WfRtaAIZ4kfM4rrVwqiy284LP0GtL5HXGLxQ==", + "version": "5.6.1", + "resolved": "https://registry.npmjs.org/@ethersproject/address/-/address-5.6.1.tgz", + "integrity": "sha512-uOgF0kS5MJv9ZvCz7x6T2EXJSzotiybApn4XlOgoTX0xdtyVIJ7pF+6cGPxiEq/dpBiTfMiw7Yc81JcwhSYA0Q==", "funding": [ { "type": "individual", @@ -930,17 +930,17 @@ } ], "dependencies": { - "@ethersproject/bignumber": "^5.6.0", - "@ethersproject/bytes": "^5.6.0", - "@ethersproject/keccak256": "^5.6.0", + "@ethersproject/bignumber": "^5.6.2", + "@ethersproject/bytes": "^5.6.1", + "@ethersproject/keccak256": "^5.6.1", "@ethersproject/logger": "^5.6.0", - "@ethersproject/rlp": "^5.6.0" + "@ethersproject/rlp": "^5.6.1" } }, "node_modules/@ethersproject/base64": { - "version": "5.6.0", - "resolved": "https://registry.npmjs.org/@ethersproject/base64/-/base64-5.6.0.tgz", - "integrity": "sha512-2Neq8wxJ9xHxCF9TUgmKeSh9BXJ6OAxWfeGWvbauPh8FuHEjamgHilllx8KkSd5ErxyHIX7Xv3Fkcud2kY9ezw==", + "version": "5.6.1", + "resolved": "https://registry.npmjs.org/@ethersproject/base64/-/base64-5.6.1.tgz", + "integrity": "sha512-qB76rjop6a0RIYYMiB4Eh/8n+Hxu2NIZm8S/Q7kNo5pmZfXhHGHmS4MinUainiBC54SCyRnwzL+KZjj8zbsSsw==", "funding": [ { "type": "individual", @@ -952,13 +952,13 @@ } ], "dependencies": { - "@ethersproject/bytes": "^5.6.0" + "@ethersproject/bytes": "^5.6.1" } }, "node_modules/@ethersproject/basex": { - "version": "5.6.0", - "resolved": "https://registry.npmjs.org/@ethersproject/basex/-/basex-5.6.0.tgz", - "integrity": "sha512-qN4T+hQd/Md32MoJpc69rOwLYRUXwjTlhHDIeUkUmiN/JyWkkLLMoG0TqvSQKNqZOMgN5stbUYN6ILC+eD7MEQ==", + "version": "5.6.1", + "resolved": "https://registry.npmjs.org/@ethersproject/basex/-/basex-5.6.1.tgz", + "integrity": "sha512-a52MkVz4vuBXR06nvflPMotld1FJWSj2QT0985v7P/emPZO00PucFAkbcmq2vpVU7Ts7umKiSI6SppiLykVWsA==", "funding": [ { "type": "individual", @@ -970,14 +970,14 @@ } ], "dependencies": { - "@ethersproject/bytes": "^5.6.0", + "@ethersproject/bytes": "^5.6.1", "@ethersproject/properties": "^5.6.0" } }, "node_modules/@ethersproject/bignumber": { - "version": "5.6.1", - "resolved": "https://registry.npmjs.org/@ethersproject/bignumber/-/bignumber-5.6.1.tgz", - "integrity": "sha512-UtMeZ3GaUuF9sx2u9nPZiPP3ULcAFmXyvynR7oHl/tPrM+vldZh7ocMsoa1PqKYGnQnqUZJoqxZnGN6J0qdipA==", + "version": "5.6.2", + "resolved": "https://registry.npmjs.org/@ethersproject/bignumber/-/bignumber-5.6.2.tgz", + "integrity": "sha512-v7+EEUbhGqT3XJ9LMPsKvXYHFc8eHxTowFCG/HgJErmq4XHJ2WR7aeyICg3uTOAQ7Icn0GFHAohXEhxQHq4Ubw==", "funding": [ { "type": "individual", @@ -989,16 +989,11 @@ } ], "dependencies": { - "@ethersproject/bytes": "^5.6.0", + "@ethersproject/bytes": "^5.6.1", "@ethersproject/logger": "^5.6.0", - "bn.js": "^4.11.9" + "bn.js": "^5.2.1" } }, - "node_modules/@ethersproject/bignumber/node_modules/bn.js": { - "version": "4.12.0", - "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.12.0.tgz", - "integrity": "sha512-c98Bf3tPniI+scsdk237ku1Dc3ujXQTSgyiPUDEOe7tRkhrqridvh8klBv0HCEso1OLOYcHuCv/cS6DNxKH+ZA==" - }, "node_modules/@ethersproject/bytes": { "version": "5.6.1", "resolved": "https://registry.npmjs.org/@ethersproject/bytes/-/bytes-5.6.1.tgz", @@ -1018,9 +1013,9 @@ } }, "node_modules/@ethersproject/constants": { - "version": "5.6.0", - "resolved": "https://registry.npmjs.org/@ethersproject/constants/-/constants-5.6.0.tgz", - "integrity": "sha512-SrdaJx2bK0WQl23nSpV/b1aq293Lh0sUaZT/yYKPDKn4tlAbkH96SPJwIhwSwTsoQQZxuh1jnqsKwyymoiBdWA==", + "version": "5.6.1", + "resolved": "https://registry.npmjs.org/@ethersproject/constants/-/constants-5.6.1.tgz", + "integrity": "sha512-QSq9WVnZbxXYFftrjSjZDUshp6/eKp6qrtdBtUCm0QxCV5z1fG/w3kdlcsjMCQuQHUnAclKoK7XpXMezhRDOLg==", "funding": [ { "type": "individual", @@ -1032,13 +1027,13 @@ } ], "dependencies": { - "@ethersproject/bignumber": "^5.6.0" + "@ethersproject/bignumber": "^5.6.2" } }, "node_modules/@ethersproject/contracts": { - "version": "5.6.1", - "resolved": "https://registry.npmjs.org/@ethersproject/contracts/-/contracts-5.6.1.tgz", - "integrity": "sha512-0fpBBDoPqJMsutE6sNjg6pvCJaIcl7tliMQTMRcoUWDACfjO68CpKOJBlsEhEhmzdnu/41KbrfAeg+sB3y35MQ==", + "version": "5.6.2", + "resolved": "https://registry.npmjs.org/@ethersproject/contracts/-/contracts-5.6.2.tgz", + "integrity": "sha512-hguUA57BIKi6WY0kHvZp6PwPlWF87MCeB4B7Z7AbUpTxfFXFdn/3b0GmjZPagIHS+3yhcBJDnuEfU4Xz+Ks/8g==", "funding": [ { "type": "individual", @@ -1050,16 +1045,16 @@ } ], "dependencies": { - "@ethersproject/abi": "^5.6.0", - "@ethersproject/abstract-provider": "^5.6.0", - "@ethersproject/abstract-signer": "^5.6.0", - "@ethersproject/address": "^5.6.0", - "@ethersproject/bignumber": "^5.6.0", - "@ethersproject/bytes": "^5.6.0", - "@ethersproject/constants": "^5.6.0", + "@ethersproject/abi": "^5.6.3", + "@ethersproject/abstract-provider": "^5.6.1", + "@ethersproject/abstract-signer": "^5.6.2", + "@ethersproject/address": "^5.6.1", + "@ethersproject/bignumber": "^5.6.2", + "@ethersproject/bytes": "^5.6.1", + "@ethersproject/constants": "^5.6.1", "@ethersproject/logger": "^5.6.0", "@ethersproject/properties": "^5.6.0", - "@ethersproject/transactions": "^5.6.0" + "@ethersproject/transactions": "^5.6.2" } }, "node_modules/@ethersproject/hardware-wallets": { @@ -1088,9 +1083,9 @@ } }, "node_modules/@ethersproject/hash": { - "version": "5.6.0", - "resolved": "https://registry.npmjs.org/@ethersproject/hash/-/hash-5.6.0.tgz", - "integrity": "sha512-fFd+k9gtczqlr0/BruWLAu7UAOas1uRRJvOR84uDf4lNZ+bTkGl366qvniUZHKtlqxBRU65MkOobkmvmpHU+jA==", + "version": "5.6.1", + "resolved": "https://registry.npmjs.org/@ethersproject/hash/-/hash-5.6.1.tgz", + "integrity": "sha512-L1xAHurbaxG8VVul4ankNX5HgQ8PNCTrnVXEiFnE9xoRnaUcgfD12tZINtDinSllxPLCtGwguQxJ5E6keE84pA==", "funding": [ { "type": "individual", @@ -1102,20 +1097,20 @@ } ], "dependencies": { - "@ethersproject/abstract-signer": "^5.6.0", - "@ethersproject/address": "^5.6.0", - "@ethersproject/bignumber": "^5.6.0", - "@ethersproject/bytes": "^5.6.0", - "@ethersproject/keccak256": "^5.6.0", + "@ethersproject/abstract-signer": "^5.6.2", + "@ethersproject/address": "^5.6.1", + "@ethersproject/bignumber": "^5.6.2", + "@ethersproject/bytes": "^5.6.1", + "@ethersproject/keccak256": "^5.6.1", "@ethersproject/logger": "^5.6.0", "@ethersproject/properties": "^5.6.0", - "@ethersproject/strings": "^5.6.0" + "@ethersproject/strings": "^5.6.1" } }, "node_modules/@ethersproject/hdnode": { - "version": "5.6.1", - "resolved": "https://registry.npmjs.org/@ethersproject/hdnode/-/hdnode-5.6.1.tgz", - "integrity": "sha512-6IuYDmbH5Bv/WH/A2cUd0FjNr4qTLAvyHAECiFZhNZp69pPvU7qIDwJ7CU7VAkwm4IVBzqdYy9mpMAGhQdwCDA==", + "version": "5.6.2", + "resolved": "https://registry.npmjs.org/@ethersproject/hdnode/-/hdnode-5.6.2.tgz", + "integrity": "sha512-tERxW8Ccf9CxW2db3WsN01Qao3wFeRsfYY9TCuhmG0xNpl2IO8wgXU3HtWIZ49gUWPggRy4Yg5axU0ACaEKf1Q==", "funding": [ { "type": "individual", @@ -1127,24 +1122,24 @@ } ], "dependencies": { - "@ethersproject/abstract-signer": "^5.6.0", - "@ethersproject/basex": "^5.6.0", - "@ethersproject/bignumber": "^5.6.0", - "@ethersproject/bytes": "^5.6.0", + "@ethersproject/abstract-signer": "^5.6.2", + "@ethersproject/basex": "^5.6.1", + "@ethersproject/bignumber": "^5.6.2", + "@ethersproject/bytes": "^5.6.1", "@ethersproject/logger": "^5.6.0", - "@ethersproject/pbkdf2": "^5.6.0", + "@ethersproject/pbkdf2": "^5.6.1", "@ethersproject/properties": "^5.6.0", - "@ethersproject/sha2": "^5.6.0", - "@ethersproject/signing-key": "^5.6.0", - "@ethersproject/strings": "^5.6.0", - "@ethersproject/transactions": "^5.6.0", - "@ethersproject/wordlists": "^5.6.0" + "@ethersproject/sha2": "^5.6.1", + "@ethersproject/signing-key": "^5.6.2", + "@ethersproject/strings": "^5.6.1", + "@ethersproject/transactions": "^5.6.2", + "@ethersproject/wordlists": "^5.6.1" } }, "node_modules/@ethersproject/json-wallets": { - "version": "5.6.0", - "resolved": "https://registry.npmjs.org/@ethersproject/json-wallets/-/json-wallets-5.6.0.tgz", - "integrity": "sha512-fmh86jViB9r0ibWXTQipxpAGMiuxoqUf78oqJDlCAJXgnJF024hOOX7qVgqsjtbeoxmcLwpPsXNU0WEe/16qPQ==", + "version": "5.6.1", + "resolved": "https://registry.npmjs.org/@ethersproject/json-wallets/-/json-wallets-5.6.1.tgz", + "integrity": "sha512-KfyJ6Zwz3kGeX25nLihPwZYlDqamO6pfGKNnVMWWfEVVp42lTfCZVXXy5Ie8IZTN0HKwAngpIPi7gk4IJzgmqQ==", "funding": [ { "type": "individual", @@ -1156,17 +1151,17 @@ } ], "dependencies": { - "@ethersproject/abstract-signer": "^5.6.0", - "@ethersproject/address": "^5.6.0", - "@ethersproject/bytes": "^5.6.0", - "@ethersproject/hdnode": "^5.6.0", - "@ethersproject/keccak256": "^5.6.0", + "@ethersproject/abstract-signer": "^5.6.2", + "@ethersproject/address": "^5.6.1", + "@ethersproject/bytes": "^5.6.1", + "@ethersproject/hdnode": "^5.6.2", + "@ethersproject/keccak256": "^5.6.1", "@ethersproject/logger": "^5.6.0", - "@ethersproject/pbkdf2": "^5.6.0", + "@ethersproject/pbkdf2": "^5.6.1", "@ethersproject/properties": "^5.6.0", - "@ethersproject/random": "^5.6.0", - "@ethersproject/strings": "^5.6.0", - "@ethersproject/transactions": "^5.6.0", + "@ethersproject/random": "^5.6.1", + "@ethersproject/strings": "^5.6.1", + "@ethersproject/transactions": "^5.6.2", "aes-js": "3.0.0", "scrypt-js": "3.0.1" } @@ -1177,9 +1172,9 @@ "integrity": "sha1-4h3xCtbCBTKVvLuNq0Cwnb6ofk0=" }, "node_modules/@ethersproject/keccak256": { - "version": "5.6.0", - "resolved": "https://registry.npmjs.org/@ethersproject/keccak256/-/keccak256-5.6.0.tgz", - "integrity": "sha512-tk56BJ96mdj/ksi7HWZVWGjCq0WVl/QvfhFQNeL8fxhBlGoP+L80uDCiQcpJPd+2XxkivS3lwRm3E0CXTfol0w==", + "version": "5.6.1", + "resolved": "https://registry.npmjs.org/@ethersproject/keccak256/-/keccak256-5.6.1.tgz", + "integrity": "sha512-bB7DQHCTRDooZZdL3lk9wpL0+XuG3XLGHLh3cePnybsO3V0rdCAOQGpn/0R3aODmnTOOkCATJiD2hnL+5bwthA==", "funding": [ { "type": "individual", @@ -1191,7 +1186,7 @@ } ], "dependencies": { - "@ethersproject/bytes": "^5.6.0", + "@ethersproject/bytes": "^5.6.1", "js-sha3": "0.8.0" } }, @@ -1229,9 +1224,9 @@ } }, "node_modules/@ethersproject/pbkdf2": { - "version": "5.6.0", - "resolved": "https://registry.npmjs.org/@ethersproject/pbkdf2/-/pbkdf2-5.6.0.tgz", - "integrity": "sha512-Wu1AxTgJo3T3H6MIu/eejLFok9TYoSdgwRr5oGY1LTLfmGesDoSx05pemsbrPT2gG4cQME+baTSCp5sEo2erZQ==", + "version": "5.6.1", + "resolved": "https://registry.npmjs.org/@ethersproject/pbkdf2/-/pbkdf2-5.6.1.tgz", + "integrity": "sha512-k4gRQ+D93zDRPNUfmduNKq065uadC2YjMP/CqwwX5qG6R05f47boq6pLZtV/RnC4NZAYOPH1Cyo54q0c9sshRQ==", "funding": [ { "type": "individual", @@ -1243,8 +1238,8 @@ } ], "dependencies": { - "@ethersproject/bytes": "^5.6.0", - "@ethersproject/sha2": "^5.6.0" + "@ethersproject/bytes": "^5.6.1", + "@ethersproject/sha2": "^5.6.1" } }, "node_modules/@ethersproject/properties": { @@ -1266,9 +1261,9 @@ } }, "node_modules/@ethersproject/providers": { - "version": "5.6.7", - "resolved": "https://registry.npmjs.org/@ethersproject/providers/-/providers-5.6.7.tgz", - "integrity": "sha512-QG7KLxfYk0FA0ycWATKMM8UzMOfOvchtkN89nNORlPqqhX5zatdamJ506dh5ECk+ybcnCkeVOdStlzrOMkkGOA==", + "version": "5.6.8", + "resolved": "https://registry.npmjs.org/@ethersproject/providers/-/providers-5.6.8.tgz", + "integrity": "sha512-Wf+CseT/iOJjrGtAOf3ck9zS7AgPmr2fZ3N97r4+YXN3mBePTG2/bJ8DApl9mVwYL+RpYbNxMEkEp4mPGdwG/w==", "funding": [ { "type": "individual", @@ -1280,32 +1275,32 @@ } ], "dependencies": { - "@ethersproject/abstract-provider": "^5.6.0", - "@ethersproject/abstract-signer": "^5.6.0", - "@ethersproject/address": "^5.6.0", - "@ethersproject/base64": "^5.6.0", - "@ethersproject/basex": "^5.6.0", - "@ethersproject/bignumber": "^5.6.0", - "@ethersproject/bytes": "^5.6.0", - "@ethersproject/constants": "^5.6.0", - "@ethersproject/hash": "^5.6.0", + "@ethersproject/abstract-provider": "^5.6.1", + "@ethersproject/abstract-signer": "^5.6.2", + "@ethersproject/address": "^5.6.1", + "@ethersproject/base64": "^5.6.1", + "@ethersproject/basex": "^5.6.1", + "@ethersproject/bignumber": "^5.6.2", + "@ethersproject/bytes": "^5.6.1", + "@ethersproject/constants": "^5.6.1", + "@ethersproject/hash": "^5.6.1", "@ethersproject/logger": "^5.6.0", - "@ethersproject/networks": "^5.6.0", + "@ethersproject/networks": "^5.6.3", "@ethersproject/properties": "^5.6.0", - "@ethersproject/random": "^5.6.0", - "@ethersproject/rlp": "^5.6.0", - "@ethersproject/sha2": "^5.6.0", - "@ethersproject/strings": "^5.6.0", - "@ethersproject/transactions": "^5.6.0", - "@ethersproject/web": "^5.6.0", + "@ethersproject/random": "^5.6.1", + "@ethersproject/rlp": "^5.6.1", + "@ethersproject/sha2": "^5.6.1", + "@ethersproject/strings": "^5.6.1", + "@ethersproject/transactions": "^5.6.2", + "@ethersproject/web": "^5.6.1", "bech32": "1.1.4", "ws": "7.4.6" } }, "node_modules/@ethersproject/random": { - "version": "5.6.0", - "resolved": "https://registry.npmjs.org/@ethersproject/random/-/random-5.6.0.tgz", - "integrity": "sha512-si0PLcLjq+NG/XHSZz90asNf+YfKEqJGVdxoEkSukzbnBgC8rydbgbUgBbBGLeHN4kAJwUFEKsu3sCXT93YMsw==", + "version": "5.6.1", + "resolved": "https://registry.npmjs.org/@ethersproject/random/-/random-5.6.1.tgz", + "integrity": "sha512-/wtPNHwbmng+5yi3fkipA8YBT59DdkGRoC2vWk09Dci/q5DlgnMkhIycjHlavrvrjJBkFjO/ueLyT+aUDfc4lA==", "funding": [ { "type": "individual", @@ -1317,14 +1312,14 @@ } ], "dependencies": { - "@ethersproject/bytes": "^5.6.0", + "@ethersproject/bytes": "^5.6.1", "@ethersproject/logger": "^5.6.0" } }, "node_modules/@ethersproject/rlp": { - "version": "5.6.0", - "resolved": "https://registry.npmjs.org/@ethersproject/rlp/-/rlp-5.6.0.tgz", - "integrity": "sha512-dz9WR1xpcTL+9DtOT/aDO+YyxSSdO8YIS0jyZwHHSlAmnxA6cKU3TrTd4Xc/bHayctxTgGLYNuVVoiXE4tTq1g==", + "version": "5.6.1", + "resolved": "https://registry.npmjs.org/@ethersproject/rlp/-/rlp-5.6.1.tgz", + "integrity": "sha512-uYjmcZx+DKlFUk7a5/W9aQVaoEC7+1MOBgNtvNg13+RnuUwT4F0zTovC0tmay5SmRslb29V1B7Y5KCri46WhuQ==", "funding": [ { "type": "individual", @@ -1336,14 +1331,14 @@ } ], "dependencies": { - "@ethersproject/bytes": "^5.6.0", + "@ethersproject/bytes": "^5.6.1", "@ethersproject/logger": "^5.6.0" } }, "node_modules/@ethersproject/sha2": { - "version": "5.6.0", - "resolved": "https://registry.npmjs.org/@ethersproject/sha2/-/sha2-5.6.0.tgz", - "integrity": "sha512-1tNWCPFLu1n3JM9t4/kytz35DkuF9MxqkGGEHNauEbaARdm2fafnOyw1s0tIQDPKF/7bkP1u3dbrmjpn5CelyA==", + "version": "5.6.1", + "resolved": "https://registry.npmjs.org/@ethersproject/sha2/-/sha2-5.6.1.tgz", + "integrity": "sha512-5K2GyqcW7G4Yo3uenHegbXRPDgARpWUiXc6RiF7b6i/HXUoWlb7uCARh7BAHg7/qT/Q5ydofNwiZcim9qpjB6g==", "funding": [ { "type": "individual", @@ -1355,15 +1350,15 @@ } ], "dependencies": { - "@ethersproject/bytes": "^5.6.0", + "@ethersproject/bytes": "^5.6.1", "@ethersproject/logger": "^5.6.0", "hash.js": "1.1.7" } }, "node_modules/@ethersproject/signing-key": { - "version": "5.6.1", - "resolved": "https://registry.npmjs.org/@ethersproject/signing-key/-/signing-key-5.6.1.tgz", - "integrity": "sha512-XvqQ20DH0D+bS3qlrrgh+axRMth5kD1xuvqUQUTeezxUTXBOeR6hWz2/C6FBEu39FRytyybIWrYf7YLSAKr1LQ==", + "version": "5.6.2", + "resolved": "https://registry.npmjs.org/@ethersproject/signing-key/-/signing-key-5.6.2.tgz", + "integrity": "sha512-jVbu0RuP7EFpw82vHcL+GP35+KaNruVAZM90GxgQnGqB6crhBqW/ozBfFvdeImtmb4qPko0uxXjn8l9jpn0cwQ==", "funding": [ { "type": "individual", @@ -1375,23 +1370,18 @@ } ], "dependencies": { - "@ethersproject/bytes": "^5.6.0", + "@ethersproject/bytes": "^5.6.1", "@ethersproject/logger": "^5.6.0", "@ethersproject/properties": "^5.6.0", - "bn.js": "^4.11.9", + "bn.js": "^5.2.1", "elliptic": "6.5.4", "hash.js": "1.1.7" } }, - "node_modules/@ethersproject/signing-key/node_modules/bn.js": { - "version": "4.12.0", - "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.12.0.tgz", - "integrity": "sha512-c98Bf3tPniI+scsdk237ku1Dc3ujXQTSgyiPUDEOe7tRkhrqridvh8klBv0HCEso1OLOYcHuCv/cS6DNxKH+ZA==" - }, "node_modules/@ethersproject/solidity": { - "version": "5.6.0", - "resolved": "https://registry.npmjs.org/@ethersproject/solidity/-/solidity-5.6.0.tgz", - "integrity": "sha512-YwF52vTNd50kjDzqKaoNNbC/r9kMDPq3YzDWmsjFTRBcIF1y4JCQJ8gB30wsTfHbaxgxelI5BfxQSxD/PbJOww==", + "version": "5.6.1", + "resolved": "https://registry.npmjs.org/@ethersproject/solidity/-/solidity-5.6.1.tgz", + "integrity": "sha512-KWqVLkUUoLBfL1iwdzUVlkNqAUIFMpbbeH0rgCfKmJp0vFtY4AsaN91gHKo9ZZLkC4UOm3cI3BmMV4N53BOq4g==", "funding": [ { "type": "individual", @@ -1403,18 +1393,18 @@ } ], "dependencies": { - "@ethersproject/bignumber": "^5.6.0", - "@ethersproject/bytes": "^5.6.0", - "@ethersproject/keccak256": "^5.6.0", + "@ethersproject/bignumber": "^5.6.2", + "@ethersproject/bytes": "^5.6.1", + "@ethersproject/keccak256": "^5.6.1", "@ethersproject/logger": "^5.6.0", - "@ethersproject/sha2": "^5.6.0", - "@ethersproject/strings": "^5.6.0" + "@ethersproject/sha2": "^5.6.1", + "@ethersproject/strings": "^5.6.1" } }, "node_modules/@ethersproject/strings": { - "version": "5.6.0", - "resolved": "https://registry.npmjs.org/@ethersproject/strings/-/strings-5.6.0.tgz", - "integrity": "sha512-uv10vTtLTZqrJuqBZR862ZQjTIa724wGPWQqZrofaPI/kUsf53TBG0I0D+hQ1qyNtllbNzaW+PDPHHUI6/65Mg==", + "version": "5.6.1", + "resolved": "https://registry.npmjs.org/@ethersproject/strings/-/strings-5.6.1.tgz", + "integrity": "sha512-2X1Lgk6Jyfg26MUnsHiT456U9ijxKUybz8IM1Vih+NJxYtXhmvKBcHOmvGqpFSVJ0nQ4ZCoIViR8XlRw1v/+Cw==", "funding": [ { "type": "individual", @@ -1426,15 +1416,15 @@ } ], "dependencies": { - "@ethersproject/bytes": "^5.6.0", - "@ethersproject/constants": "^5.6.0", + "@ethersproject/bytes": "^5.6.1", + "@ethersproject/constants": "^5.6.1", "@ethersproject/logger": "^5.6.0" } }, "node_modules/@ethersproject/transactions": { - "version": "5.6.1", - "resolved": "https://registry.npmjs.org/@ethersproject/transactions/-/transactions-5.6.1.tgz", - "integrity": "sha512-oIAC7zBCDnjVlEn0KSG1udbqR7hP9FOurxIV/aG+erCdvdvi+QXEZRUtVP9+lu3WYUe8SMYhdAVwNJtD7dZMRw==", + "version": "5.6.2", + "resolved": "https://registry.npmjs.org/@ethersproject/transactions/-/transactions-5.6.2.tgz", + "integrity": "sha512-BuV63IRPHmJvthNkkt9G70Ullx6AcM+SDc+a8Aw/8Yew6YwT51TcBKEp1P4oOQ/bP25I18JJr7rcFRgFtU9B2Q==", "funding": [ { "type": "individual", @@ -1446,21 +1436,21 @@ } ], "dependencies": { - "@ethersproject/address": "^5.6.0", - "@ethersproject/bignumber": "^5.6.0", - "@ethersproject/bytes": "^5.6.0", - "@ethersproject/constants": "^5.6.0", - "@ethersproject/keccak256": "^5.6.0", + "@ethersproject/address": "^5.6.1", + "@ethersproject/bignumber": "^5.6.2", + "@ethersproject/bytes": "^5.6.1", + "@ethersproject/constants": "^5.6.1", + "@ethersproject/keccak256": "^5.6.1", "@ethersproject/logger": "^5.6.0", "@ethersproject/properties": "^5.6.0", - "@ethersproject/rlp": "^5.6.0", - "@ethersproject/signing-key": "^5.6.0" + "@ethersproject/rlp": "^5.6.1", + "@ethersproject/signing-key": "^5.6.2" } }, "node_modules/@ethersproject/units": { - "version": "5.6.0", - "resolved": "https://registry.npmjs.org/@ethersproject/units/-/units-5.6.0.tgz", - "integrity": "sha512-tig9x0Qmh8qbo1w8/6tmtyrm/QQRviBh389EQ+d8fP4wDsBrJBf08oZfoiz1/uenKK9M78yAP4PoR7SsVoTjsw==", + "version": "5.6.1", + "resolved": "https://registry.npmjs.org/@ethersproject/units/-/units-5.6.1.tgz", + "integrity": "sha512-rEfSEvMQ7obcx3KWD5EWWx77gqv54K6BKiZzKxkQJqtpriVsICrktIQmKl8ReNToPeIYPnFHpXvKpi068YFZXw==", "funding": [ { "type": "individual", @@ -1472,15 +1462,15 @@ } ], "dependencies": { - "@ethersproject/bignumber": "^5.6.0", - "@ethersproject/constants": "^5.6.0", + "@ethersproject/bignumber": "^5.6.2", + "@ethersproject/constants": "^5.6.1", "@ethersproject/logger": "^5.6.0" } }, "node_modules/@ethersproject/wallet": { - "version": "5.6.1", - "resolved": "https://registry.npmjs.org/@ethersproject/wallet/-/wallet-5.6.1.tgz", - "integrity": "sha512-oXWoOslEWtwZiViIMlGVjeKDQz/tI7JF9UkyzN9jaGj8z7sXt2SyFMb0Ev6vSAqjIzrCrNrJ/+MkAhtKnGOfZw==", + "version": "5.6.2", + "resolved": "https://registry.npmjs.org/@ethersproject/wallet/-/wallet-5.6.2.tgz", + "integrity": "sha512-lrgh0FDQPuOnHcF80Q3gHYsSUODp6aJLAdDmDV0xKCN/T7D99ta1jGVhulg3PY8wiXEngD0DfM0I2XKXlrqJfg==", "funding": [ { "type": "individual", @@ -1492,27 +1482,27 @@ } ], "dependencies": { - "@ethersproject/abstract-provider": "^5.6.0", - "@ethersproject/abstract-signer": "^5.6.0", - "@ethersproject/address": "^5.6.0", - "@ethersproject/bignumber": "^5.6.0", - "@ethersproject/bytes": "^5.6.0", - "@ethersproject/hash": "^5.6.0", - "@ethersproject/hdnode": "^5.6.0", - "@ethersproject/json-wallets": "^5.6.0", - "@ethersproject/keccak256": "^5.6.0", + "@ethersproject/abstract-provider": "^5.6.1", + "@ethersproject/abstract-signer": "^5.6.2", + "@ethersproject/address": "^5.6.1", + "@ethersproject/bignumber": "^5.6.2", + "@ethersproject/bytes": "^5.6.1", + "@ethersproject/hash": "^5.6.1", + "@ethersproject/hdnode": "^5.6.2", + "@ethersproject/json-wallets": "^5.6.1", + "@ethersproject/keccak256": "^5.6.1", "@ethersproject/logger": "^5.6.0", "@ethersproject/properties": "^5.6.0", - "@ethersproject/random": "^5.6.0", - "@ethersproject/signing-key": "^5.6.0", - "@ethersproject/transactions": "^5.6.0", - "@ethersproject/wordlists": "^5.6.0" + "@ethersproject/random": "^5.6.1", + "@ethersproject/signing-key": "^5.6.2", + "@ethersproject/transactions": "^5.6.2", + "@ethersproject/wordlists": "^5.6.1" } }, "node_modules/@ethersproject/web": { - "version": "5.6.0", - "resolved": "https://registry.npmjs.org/@ethersproject/web/-/web-5.6.0.tgz", - "integrity": "sha512-G/XHj0hV1FxI2teHRfCGvfBUHFmU+YOSbCxlAMqJklxSa7QMiHFQfAxvwY2PFqgvdkxEKwRNr/eCjfAPEm2Ctg==", + "version": "5.6.1", + "resolved": "https://registry.npmjs.org/@ethersproject/web/-/web-5.6.1.tgz", + "integrity": "sha512-/vSyzaQlNXkO1WV+RneYKqCJwualcUdx/Z3gseVovZP0wIlOFcCE1hkRhKBH8ImKbGQbMl9EAAyJFrJu7V0aqA==", "funding": [ { "type": "individual", @@ -1524,17 +1514,17 @@ } ], "dependencies": { - "@ethersproject/base64": "^5.6.0", - "@ethersproject/bytes": "^5.6.0", + "@ethersproject/base64": "^5.6.1", + "@ethersproject/bytes": "^5.6.1", "@ethersproject/logger": "^5.6.0", "@ethersproject/properties": "^5.6.0", - "@ethersproject/strings": "^5.6.0" + "@ethersproject/strings": "^5.6.1" } }, "node_modules/@ethersproject/wordlists": { - "version": "5.6.0", - "resolved": "https://registry.npmjs.org/@ethersproject/wordlists/-/wordlists-5.6.0.tgz", - "integrity": "sha512-q0bxNBfIX3fUuAo9OmjlEYxP40IB8ABgb7HjEZCL5IKubzV3j30CWi2rqQbjTS2HfoyQbfINoKcTVWP4ejwR7Q==", + "version": "5.6.1", + "resolved": "https://registry.npmjs.org/@ethersproject/wordlists/-/wordlists-5.6.1.tgz", + "integrity": "sha512-wiPRgBpNbNwCQFoCr8bcWO8o5I810cqO6mkdtKfLKFlLxeCWcnzDi4Alu8iyNzlhYuS9npCwivMbRWF19dyblw==", "funding": [ { "type": "individual", @@ -1546,11 +1536,11 @@ } ], "dependencies": { - "@ethersproject/bytes": "^5.6.0", - "@ethersproject/hash": "^5.6.0", + "@ethersproject/bytes": "^5.6.1", + "@ethersproject/hash": "^5.6.1", "@ethersproject/logger": "^5.6.0", "@ethersproject/properties": "^5.6.0", - "@ethersproject/strings": "^5.6.0" + "@ethersproject/strings": "^5.6.1" } }, "node_modules/@gnosis.pm/mock-contract": { @@ -5475,9 +5465,9 @@ "integrity": "sha512-XpNj6GDQzdfW+r2Wnn7xiSAd7TM3jzkxGXBGTtWKuSXv1xUV+azxAm8jdWZN06QTQk+2N2XB9jRDkvbmQmcRtg==" }, "node_modules/bn.js": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-5.2.0.tgz", - "integrity": "sha512-D7iWRBvnZE8ecXiLj/9wbxH7Tk79fAh8IHaTNq1RWRixsS02W+5qS+iE9yq6RYl0asXx5tw0bLhmT5pIfbSquw==" + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-5.2.1.tgz", + "integrity": "sha512-eXRvHzWyYPBuB4NBy0cmYQjGitUrtqwbvlzP3G6VFnNRbsZQIxQ10PbKKHt8gZ/HW/D/747aDl+QkDqg3KQLMQ==" }, "node_modules/body-parser": { "version": "1.20.0", @@ -8924,9 +8914,9 @@ } }, "node_modules/ethers": { - "version": "5.6.7", - "resolved": "https://registry.npmjs.org/ethers/-/ethers-5.6.7.tgz", - "integrity": "sha512-Q8pmMraUENK0cY6cy6IvIe3e9xL/+4kBvxmUvLXg1O7Abob0c7XzWI76E29j5em/HxWMl5hYiSClmOMW3jJmdg==", + "version": "5.6.8", + "resolved": "https://registry.npmjs.org/ethers/-/ethers-5.6.8.tgz", + "integrity": "sha512-YxIGaltAOdvBFPZwIkyHnXbW40f1r8mHUgapW6dxkO+6t7H6wY8POUn0Kbxrd/N7I4hHxyi7YCddMAH/wmho2w==", "funding": [ { "type": "individual", @@ -8938,36 +8928,36 @@ } ], "dependencies": { - "@ethersproject/abi": "5.6.2", - "@ethersproject/abstract-provider": "5.6.0", - "@ethersproject/abstract-signer": "5.6.1", - "@ethersproject/address": "5.6.0", - "@ethersproject/base64": "5.6.0", - "@ethersproject/basex": "5.6.0", - "@ethersproject/bignumber": "5.6.1", + "@ethersproject/abi": "5.6.3", + "@ethersproject/abstract-provider": "5.6.1", + "@ethersproject/abstract-signer": "5.6.2", + "@ethersproject/address": "5.6.1", + "@ethersproject/base64": "5.6.1", + "@ethersproject/basex": "5.6.1", + "@ethersproject/bignumber": "5.6.2", "@ethersproject/bytes": "5.6.1", - "@ethersproject/constants": "5.6.0", - "@ethersproject/contracts": "5.6.1", - "@ethersproject/hash": "5.6.0", - "@ethersproject/hdnode": "5.6.1", - "@ethersproject/json-wallets": "5.6.0", - "@ethersproject/keccak256": "5.6.0", + "@ethersproject/constants": "5.6.1", + "@ethersproject/contracts": "5.6.2", + "@ethersproject/hash": "5.6.1", + "@ethersproject/hdnode": "5.6.2", + "@ethersproject/json-wallets": "5.6.1", + "@ethersproject/keccak256": "5.6.1", "@ethersproject/logger": "5.6.0", "@ethersproject/networks": "5.6.3", - "@ethersproject/pbkdf2": "5.6.0", + "@ethersproject/pbkdf2": "5.6.1", "@ethersproject/properties": "5.6.0", - "@ethersproject/providers": "5.6.7", - "@ethersproject/random": "5.6.0", - "@ethersproject/rlp": "5.6.0", - "@ethersproject/sha2": "5.6.0", - "@ethersproject/signing-key": "5.6.1", - "@ethersproject/solidity": "5.6.0", - "@ethersproject/strings": "5.6.0", - "@ethersproject/transactions": "5.6.1", - "@ethersproject/units": "5.6.0", - "@ethersproject/wallet": "5.6.1", - "@ethersproject/web": "5.6.0", - "@ethersproject/wordlists": "5.6.0" + "@ethersproject/providers": "5.6.8", + "@ethersproject/random": "5.6.1", + "@ethersproject/rlp": "5.6.1", + "@ethersproject/sha2": "5.6.1", + "@ethersproject/signing-key": "5.6.2", + "@ethersproject/solidity": "5.6.1", + "@ethersproject/strings": "5.6.1", + "@ethersproject/transactions": "5.6.2", + "@ethersproject/units": "5.6.1", + "@ethersproject/wallet": "5.6.2", + "@ethersproject/web": "5.6.1", + "@ethersproject/wordlists": "5.6.1" } }, "node_modules/ethjs-abi": { @@ -29398,91 +29388,84 @@ } }, "@ethersproject/abi": { - "version": "5.6.2", - "resolved": "https://registry.npmjs.org/@ethersproject/abi/-/abi-5.6.2.tgz", - "integrity": "sha512-40Ixjhy+YzFtnvzIqFU13FW9hd1gMoLa3cJfSDnfnL4o8EnEG1qLiV8sNJo3sHYi9UYMfFeRuZ7kv5+vhzU7gQ==", - "requires": { - "@ethersproject/address": "^5.6.0", - "@ethersproject/bignumber": "^5.6.0", - "@ethersproject/bytes": "^5.6.0", - "@ethersproject/constants": "^5.6.0", - "@ethersproject/hash": "^5.6.0", - "@ethersproject/keccak256": "^5.6.0", + "version": "5.6.3", + "resolved": "https://registry.npmjs.org/@ethersproject/abi/-/abi-5.6.3.tgz", + "integrity": "sha512-CxKTdoZY4zDJLWXG6HzNH6znWK0M79WzzxHegDoecE3+K32pzfHOzuXg2/oGSTecZynFgpkjYXNPOqXVJlqClw==", + "requires": { + "@ethersproject/address": "^5.6.1", + "@ethersproject/bignumber": "^5.6.2", + "@ethersproject/bytes": "^5.6.1", + "@ethersproject/constants": "^5.6.1", + "@ethersproject/hash": "^5.6.1", + "@ethersproject/keccak256": "^5.6.1", "@ethersproject/logger": "^5.6.0", "@ethersproject/properties": "^5.6.0", - "@ethersproject/strings": "^5.6.0" + "@ethersproject/strings": "^5.6.1" } }, "@ethersproject/abstract-provider": { - "version": "5.6.0", - "resolved": "https://registry.npmjs.org/@ethersproject/abstract-provider/-/abstract-provider-5.6.0.tgz", - "integrity": "sha512-oPMFlKLN+g+y7a79cLK3WiLcjWFnZQtXWgnLAbHZcN3s7L4v90UHpTOrLk+m3yr0gt+/h9STTM6zrr7PM8uoRw==", + "version": "5.6.1", + "resolved": "https://registry.npmjs.org/@ethersproject/abstract-provider/-/abstract-provider-5.6.1.tgz", + "integrity": "sha512-BxlIgogYJtp1FS8Muvj8YfdClk3unZH0vRMVX791Z9INBNT/kuACZ9GzaY1Y4yFq+YSy6/w4gzj3HCRKrK9hsQ==", "requires": { - "@ethersproject/bignumber": "^5.6.0", - "@ethersproject/bytes": "^5.6.0", + "@ethersproject/bignumber": "^5.6.2", + "@ethersproject/bytes": "^5.6.1", "@ethersproject/logger": "^5.6.0", - "@ethersproject/networks": "^5.6.0", + "@ethersproject/networks": "^5.6.3", "@ethersproject/properties": "^5.6.0", - "@ethersproject/transactions": "^5.6.0", - "@ethersproject/web": "^5.6.0" + "@ethersproject/transactions": "^5.6.2", + "@ethersproject/web": "^5.6.1" } }, "@ethersproject/abstract-signer": { - "version": "5.6.1", - "resolved": "https://registry.npmjs.org/@ethersproject/abstract-signer/-/abstract-signer-5.6.1.tgz", - "integrity": "sha512-xhSLo6y0nGJS7NxfvOSzCaWKvWb1TLT7dQ0nnpHZrDnC67xfnWm9NXflTMFPUXXMtjr33CdV0kWDEmnbrQZ74Q==", + "version": "5.6.2", + "resolved": "https://registry.npmjs.org/@ethersproject/abstract-signer/-/abstract-signer-5.6.2.tgz", + "integrity": "sha512-n1r6lttFBG0t2vNiI3HoWaS/KdOt8xyDjzlP2cuevlWLG6EX0OwcKLyG/Kp/cuwNxdy/ous+R/DEMdTUwWQIjQ==", "requires": { - "@ethersproject/abstract-provider": "^5.6.0", - "@ethersproject/bignumber": "^5.6.0", - "@ethersproject/bytes": "^5.6.0", + "@ethersproject/abstract-provider": "^5.6.1", + "@ethersproject/bignumber": "^5.6.2", + "@ethersproject/bytes": "^5.6.1", "@ethersproject/logger": "^5.6.0", "@ethersproject/properties": "^5.6.0" } }, "@ethersproject/address": { - "version": "5.6.0", - "resolved": "https://registry.npmjs.org/@ethersproject/address/-/address-5.6.0.tgz", - "integrity": "sha512-6nvhYXjbXsHPS+30sHZ+U4VMagFC/9zAk6Gd/h3S21YW4+yfb0WfRtaAIZ4kfM4rrVwqiy284LP0GtL5HXGLxQ==", + "version": "5.6.1", + "resolved": "https://registry.npmjs.org/@ethersproject/address/-/address-5.6.1.tgz", + "integrity": "sha512-uOgF0kS5MJv9ZvCz7x6T2EXJSzotiybApn4XlOgoTX0xdtyVIJ7pF+6cGPxiEq/dpBiTfMiw7Yc81JcwhSYA0Q==", "requires": { - "@ethersproject/bignumber": "^5.6.0", - "@ethersproject/bytes": "^5.6.0", - "@ethersproject/keccak256": "^5.6.0", + "@ethersproject/bignumber": "^5.6.2", + "@ethersproject/bytes": "^5.6.1", + "@ethersproject/keccak256": "^5.6.1", "@ethersproject/logger": "^5.6.0", - "@ethersproject/rlp": "^5.6.0" + "@ethersproject/rlp": "^5.6.1" } }, "@ethersproject/base64": { - "version": "5.6.0", - "resolved": "https://registry.npmjs.org/@ethersproject/base64/-/base64-5.6.0.tgz", - "integrity": "sha512-2Neq8wxJ9xHxCF9TUgmKeSh9BXJ6OAxWfeGWvbauPh8FuHEjamgHilllx8KkSd5ErxyHIX7Xv3Fkcud2kY9ezw==", + "version": "5.6.1", + "resolved": "https://registry.npmjs.org/@ethersproject/base64/-/base64-5.6.1.tgz", + "integrity": "sha512-qB76rjop6a0RIYYMiB4Eh/8n+Hxu2NIZm8S/Q7kNo5pmZfXhHGHmS4MinUainiBC54SCyRnwzL+KZjj8zbsSsw==", "requires": { - "@ethersproject/bytes": "^5.6.0" + "@ethersproject/bytes": "^5.6.1" } }, "@ethersproject/basex": { - "version": "5.6.0", - "resolved": "https://registry.npmjs.org/@ethersproject/basex/-/basex-5.6.0.tgz", - "integrity": "sha512-qN4T+hQd/Md32MoJpc69rOwLYRUXwjTlhHDIeUkUmiN/JyWkkLLMoG0TqvSQKNqZOMgN5stbUYN6ILC+eD7MEQ==", + "version": "5.6.1", + "resolved": "https://registry.npmjs.org/@ethersproject/basex/-/basex-5.6.1.tgz", + "integrity": "sha512-a52MkVz4vuBXR06nvflPMotld1FJWSj2QT0985v7P/emPZO00PucFAkbcmq2vpVU7Ts7umKiSI6SppiLykVWsA==", "requires": { - "@ethersproject/bytes": "^5.6.0", + "@ethersproject/bytes": "^5.6.1", "@ethersproject/properties": "^5.6.0" } }, "@ethersproject/bignumber": { - "version": "5.6.1", - "resolved": "https://registry.npmjs.org/@ethersproject/bignumber/-/bignumber-5.6.1.tgz", - "integrity": "sha512-UtMeZ3GaUuF9sx2u9nPZiPP3ULcAFmXyvynR7oHl/tPrM+vldZh7ocMsoa1PqKYGnQnqUZJoqxZnGN6J0qdipA==", + "version": "5.6.2", + "resolved": "https://registry.npmjs.org/@ethersproject/bignumber/-/bignumber-5.6.2.tgz", + "integrity": "sha512-v7+EEUbhGqT3XJ9LMPsKvXYHFc8eHxTowFCG/HgJErmq4XHJ2WR7aeyICg3uTOAQ7Icn0GFHAohXEhxQHq4Ubw==", "requires": { - "@ethersproject/bytes": "^5.6.0", + "@ethersproject/bytes": "^5.6.1", "@ethersproject/logger": "^5.6.0", - "bn.js": "^4.11.9" - }, - "dependencies": { - "bn.js": { - "version": "4.12.0", - "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.12.0.tgz", - "integrity": "sha512-c98Bf3tPniI+scsdk237ku1Dc3ujXQTSgyiPUDEOe7tRkhrqridvh8klBv0HCEso1OLOYcHuCv/cS6DNxKH+ZA==" - } + "bn.js": "^5.2.1" } }, "@ethersproject/bytes": { @@ -29494,28 +29477,28 @@ } }, "@ethersproject/constants": { - "version": "5.6.0", - "resolved": "https://registry.npmjs.org/@ethersproject/constants/-/constants-5.6.0.tgz", - "integrity": "sha512-SrdaJx2bK0WQl23nSpV/b1aq293Lh0sUaZT/yYKPDKn4tlAbkH96SPJwIhwSwTsoQQZxuh1jnqsKwyymoiBdWA==", + "version": "5.6.1", + "resolved": "https://registry.npmjs.org/@ethersproject/constants/-/constants-5.6.1.tgz", + "integrity": "sha512-QSq9WVnZbxXYFftrjSjZDUshp6/eKp6qrtdBtUCm0QxCV5z1fG/w3kdlcsjMCQuQHUnAclKoK7XpXMezhRDOLg==", "requires": { - "@ethersproject/bignumber": "^5.6.0" + "@ethersproject/bignumber": "^5.6.2" } }, "@ethersproject/contracts": { - "version": "5.6.1", - "resolved": "https://registry.npmjs.org/@ethersproject/contracts/-/contracts-5.6.1.tgz", - "integrity": "sha512-0fpBBDoPqJMsutE6sNjg6pvCJaIcl7tliMQTMRcoUWDACfjO68CpKOJBlsEhEhmzdnu/41KbrfAeg+sB3y35MQ==", - "requires": { - "@ethersproject/abi": "^5.6.0", - "@ethersproject/abstract-provider": "^5.6.0", - "@ethersproject/abstract-signer": "^5.6.0", - "@ethersproject/address": "^5.6.0", - "@ethersproject/bignumber": "^5.6.0", - "@ethersproject/bytes": "^5.6.0", - "@ethersproject/constants": "^5.6.0", + "version": "5.6.2", + "resolved": "https://registry.npmjs.org/@ethersproject/contracts/-/contracts-5.6.2.tgz", + "integrity": "sha512-hguUA57BIKi6WY0kHvZp6PwPlWF87MCeB4B7Z7AbUpTxfFXFdn/3b0GmjZPagIHS+3yhcBJDnuEfU4Xz+Ks/8g==", + "requires": { + "@ethersproject/abi": "^5.6.3", + "@ethersproject/abstract-provider": "^5.6.1", + "@ethersproject/abstract-signer": "^5.6.2", + "@ethersproject/address": "^5.6.1", + "@ethersproject/bignumber": "^5.6.2", + "@ethersproject/bytes": "^5.6.1", + "@ethersproject/constants": "^5.6.1", "@ethersproject/logger": "^5.6.0", "@ethersproject/properties": "^5.6.0", - "@ethersproject/transactions": "^5.6.0" + "@ethersproject/transactions": "^5.6.2" } }, "@ethersproject/hardware-wallets": { @@ -29532,55 +29515,55 @@ } }, "@ethersproject/hash": { - "version": "5.6.0", - "resolved": "https://registry.npmjs.org/@ethersproject/hash/-/hash-5.6.0.tgz", - "integrity": "sha512-fFd+k9gtczqlr0/BruWLAu7UAOas1uRRJvOR84uDf4lNZ+bTkGl366qvniUZHKtlqxBRU65MkOobkmvmpHU+jA==", - "requires": { - "@ethersproject/abstract-signer": "^5.6.0", - "@ethersproject/address": "^5.6.0", - "@ethersproject/bignumber": "^5.6.0", - "@ethersproject/bytes": "^5.6.0", - "@ethersproject/keccak256": "^5.6.0", + "version": "5.6.1", + "resolved": "https://registry.npmjs.org/@ethersproject/hash/-/hash-5.6.1.tgz", + "integrity": "sha512-L1xAHurbaxG8VVul4ankNX5HgQ8PNCTrnVXEiFnE9xoRnaUcgfD12tZINtDinSllxPLCtGwguQxJ5E6keE84pA==", + "requires": { + "@ethersproject/abstract-signer": "^5.6.2", + "@ethersproject/address": "^5.6.1", + "@ethersproject/bignumber": "^5.6.2", + "@ethersproject/bytes": "^5.6.1", + "@ethersproject/keccak256": "^5.6.1", "@ethersproject/logger": "^5.6.0", "@ethersproject/properties": "^5.6.0", - "@ethersproject/strings": "^5.6.0" + "@ethersproject/strings": "^5.6.1" } }, "@ethersproject/hdnode": { - "version": "5.6.1", - "resolved": "https://registry.npmjs.org/@ethersproject/hdnode/-/hdnode-5.6.1.tgz", - "integrity": "sha512-6IuYDmbH5Bv/WH/A2cUd0FjNr4qTLAvyHAECiFZhNZp69pPvU7qIDwJ7CU7VAkwm4IVBzqdYy9mpMAGhQdwCDA==", + "version": "5.6.2", + "resolved": "https://registry.npmjs.org/@ethersproject/hdnode/-/hdnode-5.6.2.tgz", + "integrity": "sha512-tERxW8Ccf9CxW2db3WsN01Qao3wFeRsfYY9TCuhmG0xNpl2IO8wgXU3HtWIZ49gUWPggRy4Yg5axU0ACaEKf1Q==", "requires": { - "@ethersproject/abstract-signer": "^5.6.0", - "@ethersproject/basex": "^5.6.0", - "@ethersproject/bignumber": "^5.6.0", - "@ethersproject/bytes": "^5.6.0", + "@ethersproject/abstract-signer": "^5.6.2", + "@ethersproject/basex": "^5.6.1", + "@ethersproject/bignumber": "^5.6.2", + "@ethersproject/bytes": "^5.6.1", "@ethersproject/logger": "^5.6.0", - "@ethersproject/pbkdf2": "^5.6.0", + "@ethersproject/pbkdf2": "^5.6.1", "@ethersproject/properties": "^5.6.0", - "@ethersproject/sha2": "^5.6.0", - "@ethersproject/signing-key": "^5.6.0", - "@ethersproject/strings": "^5.6.0", - "@ethersproject/transactions": "^5.6.0", - "@ethersproject/wordlists": "^5.6.0" + "@ethersproject/sha2": "^5.6.1", + "@ethersproject/signing-key": "^5.6.2", + "@ethersproject/strings": "^5.6.1", + "@ethersproject/transactions": "^5.6.2", + "@ethersproject/wordlists": "^5.6.1" } }, "@ethersproject/json-wallets": { - "version": "5.6.0", - "resolved": "https://registry.npmjs.org/@ethersproject/json-wallets/-/json-wallets-5.6.0.tgz", - "integrity": "sha512-fmh86jViB9r0ibWXTQipxpAGMiuxoqUf78oqJDlCAJXgnJF024hOOX7qVgqsjtbeoxmcLwpPsXNU0WEe/16qPQ==", - "requires": { - "@ethersproject/abstract-signer": "^5.6.0", - "@ethersproject/address": "^5.6.0", - "@ethersproject/bytes": "^5.6.0", - "@ethersproject/hdnode": "^5.6.0", - "@ethersproject/keccak256": "^5.6.0", + "version": "5.6.1", + "resolved": "https://registry.npmjs.org/@ethersproject/json-wallets/-/json-wallets-5.6.1.tgz", + "integrity": "sha512-KfyJ6Zwz3kGeX25nLihPwZYlDqamO6pfGKNnVMWWfEVVp42lTfCZVXXy5Ie8IZTN0HKwAngpIPi7gk4IJzgmqQ==", + "requires": { + "@ethersproject/abstract-signer": "^5.6.2", + "@ethersproject/address": "^5.6.1", + "@ethersproject/bytes": "^5.6.1", + "@ethersproject/hdnode": "^5.6.2", + "@ethersproject/keccak256": "^5.6.1", "@ethersproject/logger": "^5.6.0", - "@ethersproject/pbkdf2": "^5.6.0", + "@ethersproject/pbkdf2": "^5.6.1", "@ethersproject/properties": "^5.6.0", - "@ethersproject/random": "^5.6.0", - "@ethersproject/strings": "^5.6.0", - "@ethersproject/transactions": "^5.6.0", + "@ethersproject/random": "^5.6.1", + "@ethersproject/strings": "^5.6.1", + "@ethersproject/transactions": "^5.6.2", "aes-js": "3.0.0", "scrypt-js": "3.0.1" }, @@ -29593,11 +29576,11 @@ } }, "@ethersproject/keccak256": { - "version": "5.6.0", - "resolved": "https://registry.npmjs.org/@ethersproject/keccak256/-/keccak256-5.6.0.tgz", - "integrity": "sha512-tk56BJ96mdj/ksi7HWZVWGjCq0WVl/QvfhFQNeL8fxhBlGoP+L80uDCiQcpJPd+2XxkivS3lwRm3E0CXTfol0w==", + "version": "5.6.1", + "resolved": "https://registry.npmjs.org/@ethersproject/keccak256/-/keccak256-5.6.1.tgz", + "integrity": "sha512-bB7DQHCTRDooZZdL3lk9wpL0+XuG3XLGHLh3cePnybsO3V0rdCAOQGpn/0R3aODmnTOOkCATJiD2hnL+5bwthA==", "requires": { - "@ethersproject/bytes": "^5.6.0", + "@ethersproject/bytes": "^5.6.1", "js-sha3": "0.8.0" } }, @@ -29615,12 +29598,12 @@ } }, "@ethersproject/pbkdf2": { - "version": "5.6.0", - "resolved": "https://registry.npmjs.org/@ethersproject/pbkdf2/-/pbkdf2-5.6.0.tgz", - "integrity": "sha512-Wu1AxTgJo3T3H6MIu/eejLFok9TYoSdgwRr5oGY1LTLfmGesDoSx05pemsbrPT2gG4cQME+baTSCp5sEo2erZQ==", + "version": "5.6.1", + "resolved": "https://registry.npmjs.org/@ethersproject/pbkdf2/-/pbkdf2-5.6.1.tgz", + "integrity": "sha512-k4gRQ+D93zDRPNUfmduNKq065uadC2YjMP/CqwwX5qG6R05f47boq6pLZtV/RnC4NZAYOPH1Cyo54q0c9sshRQ==", "requires": { - "@ethersproject/bytes": "^5.6.0", - "@ethersproject/sha2": "^5.6.0" + "@ethersproject/bytes": "^5.6.1", + "@ethersproject/sha2": "^5.6.1" } }, "@ethersproject/properties": { @@ -29632,173 +29615,166 @@ } }, "@ethersproject/providers": { - "version": "5.6.7", - "resolved": "https://registry.npmjs.org/@ethersproject/providers/-/providers-5.6.7.tgz", - "integrity": "sha512-QG7KLxfYk0FA0ycWATKMM8UzMOfOvchtkN89nNORlPqqhX5zatdamJ506dh5ECk+ybcnCkeVOdStlzrOMkkGOA==", - "requires": { - "@ethersproject/abstract-provider": "^5.6.0", - "@ethersproject/abstract-signer": "^5.6.0", - "@ethersproject/address": "^5.6.0", - "@ethersproject/base64": "^5.6.0", - "@ethersproject/basex": "^5.6.0", - "@ethersproject/bignumber": "^5.6.0", - "@ethersproject/bytes": "^5.6.0", - "@ethersproject/constants": "^5.6.0", - "@ethersproject/hash": "^5.6.0", + "version": "5.6.8", + "resolved": "https://registry.npmjs.org/@ethersproject/providers/-/providers-5.6.8.tgz", + "integrity": "sha512-Wf+CseT/iOJjrGtAOf3ck9zS7AgPmr2fZ3N97r4+YXN3mBePTG2/bJ8DApl9mVwYL+RpYbNxMEkEp4mPGdwG/w==", + "requires": { + "@ethersproject/abstract-provider": "^5.6.1", + "@ethersproject/abstract-signer": "^5.6.2", + "@ethersproject/address": "^5.6.1", + "@ethersproject/base64": "^5.6.1", + "@ethersproject/basex": "^5.6.1", + "@ethersproject/bignumber": "^5.6.2", + "@ethersproject/bytes": "^5.6.1", + "@ethersproject/constants": "^5.6.1", + "@ethersproject/hash": "^5.6.1", "@ethersproject/logger": "^5.6.0", - "@ethersproject/networks": "^5.6.0", + "@ethersproject/networks": "^5.6.3", "@ethersproject/properties": "^5.6.0", - "@ethersproject/random": "^5.6.0", - "@ethersproject/rlp": "^5.6.0", - "@ethersproject/sha2": "^5.6.0", - "@ethersproject/strings": "^5.6.0", - "@ethersproject/transactions": "^5.6.0", - "@ethersproject/web": "^5.6.0", + "@ethersproject/random": "^5.6.1", + "@ethersproject/rlp": "^5.6.1", + "@ethersproject/sha2": "^5.6.1", + "@ethersproject/strings": "^5.6.1", + "@ethersproject/transactions": "^5.6.2", + "@ethersproject/web": "^5.6.1", "bech32": "1.1.4", "ws": "7.4.6" } }, "@ethersproject/random": { - "version": "5.6.0", - "resolved": "https://registry.npmjs.org/@ethersproject/random/-/random-5.6.0.tgz", - "integrity": "sha512-si0PLcLjq+NG/XHSZz90asNf+YfKEqJGVdxoEkSukzbnBgC8rydbgbUgBbBGLeHN4kAJwUFEKsu3sCXT93YMsw==", + "version": "5.6.1", + "resolved": "https://registry.npmjs.org/@ethersproject/random/-/random-5.6.1.tgz", + "integrity": "sha512-/wtPNHwbmng+5yi3fkipA8YBT59DdkGRoC2vWk09Dci/q5DlgnMkhIycjHlavrvrjJBkFjO/ueLyT+aUDfc4lA==", "requires": { - "@ethersproject/bytes": "^5.6.0", + "@ethersproject/bytes": "^5.6.1", "@ethersproject/logger": "^5.6.0" } }, "@ethersproject/rlp": { - "version": "5.6.0", - "resolved": "https://registry.npmjs.org/@ethersproject/rlp/-/rlp-5.6.0.tgz", - "integrity": "sha512-dz9WR1xpcTL+9DtOT/aDO+YyxSSdO8YIS0jyZwHHSlAmnxA6cKU3TrTd4Xc/bHayctxTgGLYNuVVoiXE4tTq1g==", + "version": "5.6.1", + "resolved": "https://registry.npmjs.org/@ethersproject/rlp/-/rlp-5.6.1.tgz", + "integrity": "sha512-uYjmcZx+DKlFUk7a5/W9aQVaoEC7+1MOBgNtvNg13+RnuUwT4F0zTovC0tmay5SmRslb29V1B7Y5KCri46WhuQ==", "requires": { - "@ethersproject/bytes": "^5.6.0", + "@ethersproject/bytes": "^5.6.1", "@ethersproject/logger": "^5.6.0" } }, "@ethersproject/sha2": { - "version": "5.6.0", - "resolved": "https://registry.npmjs.org/@ethersproject/sha2/-/sha2-5.6.0.tgz", - "integrity": "sha512-1tNWCPFLu1n3JM9t4/kytz35DkuF9MxqkGGEHNauEbaARdm2fafnOyw1s0tIQDPKF/7bkP1u3dbrmjpn5CelyA==", + "version": "5.6.1", + "resolved": "https://registry.npmjs.org/@ethersproject/sha2/-/sha2-5.6.1.tgz", + "integrity": "sha512-5K2GyqcW7G4Yo3uenHegbXRPDgARpWUiXc6RiF7b6i/HXUoWlb7uCARh7BAHg7/qT/Q5ydofNwiZcim9qpjB6g==", "requires": { - "@ethersproject/bytes": "^5.6.0", + "@ethersproject/bytes": "^5.6.1", "@ethersproject/logger": "^5.6.0", "hash.js": "1.1.7" } }, "@ethersproject/signing-key": { - "version": "5.6.1", - "resolved": "https://registry.npmjs.org/@ethersproject/signing-key/-/signing-key-5.6.1.tgz", - "integrity": "sha512-XvqQ20DH0D+bS3qlrrgh+axRMth5kD1xuvqUQUTeezxUTXBOeR6hWz2/C6FBEu39FRytyybIWrYf7YLSAKr1LQ==", + "version": "5.6.2", + "resolved": "https://registry.npmjs.org/@ethersproject/signing-key/-/signing-key-5.6.2.tgz", + "integrity": "sha512-jVbu0RuP7EFpw82vHcL+GP35+KaNruVAZM90GxgQnGqB6crhBqW/ozBfFvdeImtmb4qPko0uxXjn8l9jpn0cwQ==", "requires": { - "@ethersproject/bytes": "^5.6.0", + "@ethersproject/bytes": "^5.6.1", "@ethersproject/logger": "^5.6.0", "@ethersproject/properties": "^5.6.0", - "bn.js": "^4.11.9", + "bn.js": "^5.2.1", "elliptic": "6.5.4", "hash.js": "1.1.7" - }, - "dependencies": { - "bn.js": { - "version": "4.12.0", - "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.12.0.tgz", - "integrity": "sha512-c98Bf3tPniI+scsdk237ku1Dc3ujXQTSgyiPUDEOe7tRkhrqridvh8klBv0HCEso1OLOYcHuCv/cS6DNxKH+ZA==" - } } }, "@ethersproject/solidity": { - "version": "5.6.0", - "resolved": "https://registry.npmjs.org/@ethersproject/solidity/-/solidity-5.6.0.tgz", - "integrity": "sha512-YwF52vTNd50kjDzqKaoNNbC/r9kMDPq3YzDWmsjFTRBcIF1y4JCQJ8gB30wsTfHbaxgxelI5BfxQSxD/PbJOww==", + "version": "5.6.1", + "resolved": "https://registry.npmjs.org/@ethersproject/solidity/-/solidity-5.6.1.tgz", + "integrity": "sha512-KWqVLkUUoLBfL1iwdzUVlkNqAUIFMpbbeH0rgCfKmJp0vFtY4AsaN91gHKo9ZZLkC4UOm3cI3BmMV4N53BOq4g==", "requires": { - "@ethersproject/bignumber": "^5.6.0", - "@ethersproject/bytes": "^5.6.0", - "@ethersproject/keccak256": "^5.6.0", + "@ethersproject/bignumber": "^5.6.2", + "@ethersproject/bytes": "^5.6.1", + "@ethersproject/keccak256": "^5.6.1", "@ethersproject/logger": "^5.6.0", - "@ethersproject/sha2": "^5.6.0", - "@ethersproject/strings": "^5.6.0" + "@ethersproject/sha2": "^5.6.1", + "@ethersproject/strings": "^5.6.1" } }, "@ethersproject/strings": { - "version": "5.6.0", - "resolved": "https://registry.npmjs.org/@ethersproject/strings/-/strings-5.6.0.tgz", - "integrity": "sha512-uv10vTtLTZqrJuqBZR862ZQjTIa724wGPWQqZrofaPI/kUsf53TBG0I0D+hQ1qyNtllbNzaW+PDPHHUI6/65Mg==", + "version": "5.6.1", + "resolved": "https://registry.npmjs.org/@ethersproject/strings/-/strings-5.6.1.tgz", + "integrity": "sha512-2X1Lgk6Jyfg26MUnsHiT456U9ijxKUybz8IM1Vih+NJxYtXhmvKBcHOmvGqpFSVJ0nQ4ZCoIViR8XlRw1v/+Cw==", "requires": { - "@ethersproject/bytes": "^5.6.0", - "@ethersproject/constants": "^5.6.0", + "@ethersproject/bytes": "^5.6.1", + "@ethersproject/constants": "^5.6.1", "@ethersproject/logger": "^5.6.0" } }, "@ethersproject/transactions": { - "version": "5.6.1", - "resolved": "https://registry.npmjs.org/@ethersproject/transactions/-/transactions-5.6.1.tgz", - "integrity": "sha512-oIAC7zBCDnjVlEn0KSG1udbqR7hP9FOurxIV/aG+erCdvdvi+QXEZRUtVP9+lu3WYUe8SMYhdAVwNJtD7dZMRw==", - "requires": { - "@ethersproject/address": "^5.6.0", - "@ethersproject/bignumber": "^5.6.0", - "@ethersproject/bytes": "^5.6.0", - "@ethersproject/constants": "^5.6.0", - "@ethersproject/keccak256": "^5.6.0", + "version": "5.6.2", + "resolved": "https://registry.npmjs.org/@ethersproject/transactions/-/transactions-5.6.2.tgz", + "integrity": "sha512-BuV63IRPHmJvthNkkt9G70Ullx6AcM+SDc+a8Aw/8Yew6YwT51TcBKEp1P4oOQ/bP25I18JJr7rcFRgFtU9B2Q==", + "requires": { + "@ethersproject/address": "^5.6.1", + "@ethersproject/bignumber": "^5.6.2", + "@ethersproject/bytes": "^5.6.1", + "@ethersproject/constants": "^5.6.1", + "@ethersproject/keccak256": "^5.6.1", "@ethersproject/logger": "^5.6.0", "@ethersproject/properties": "^5.6.0", - "@ethersproject/rlp": "^5.6.0", - "@ethersproject/signing-key": "^5.6.0" + "@ethersproject/rlp": "^5.6.1", + "@ethersproject/signing-key": "^5.6.2" } }, "@ethersproject/units": { - "version": "5.6.0", - "resolved": "https://registry.npmjs.org/@ethersproject/units/-/units-5.6.0.tgz", - "integrity": "sha512-tig9x0Qmh8qbo1w8/6tmtyrm/QQRviBh389EQ+d8fP4wDsBrJBf08oZfoiz1/uenKK9M78yAP4PoR7SsVoTjsw==", + "version": "5.6.1", + "resolved": "https://registry.npmjs.org/@ethersproject/units/-/units-5.6.1.tgz", + "integrity": "sha512-rEfSEvMQ7obcx3KWD5EWWx77gqv54K6BKiZzKxkQJqtpriVsICrktIQmKl8ReNToPeIYPnFHpXvKpi068YFZXw==", "requires": { - "@ethersproject/bignumber": "^5.6.0", - "@ethersproject/constants": "^5.6.0", + "@ethersproject/bignumber": "^5.6.2", + "@ethersproject/constants": "^5.6.1", "@ethersproject/logger": "^5.6.0" } }, "@ethersproject/wallet": { - "version": "5.6.1", - "resolved": "https://registry.npmjs.org/@ethersproject/wallet/-/wallet-5.6.1.tgz", - "integrity": "sha512-oXWoOslEWtwZiViIMlGVjeKDQz/tI7JF9UkyzN9jaGj8z7sXt2SyFMb0Ev6vSAqjIzrCrNrJ/+MkAhtKnGOfZw==", - "requires": { - "@ethersproject/abstract-provider": "^5.6.0", - "@ethersproject/abstract-signer": "^5.6.0", - "@ethersproject/address": "^5.6.0", - "@ethersproject/bignumber": "^5.6.0", - "@ethersproject/bytes": "^5.6.0", - "@ethersproject/hash": "^5.6.0", - "@ethersproject/hdnode": "^5.6.0", - "@ethersproject/json-wallets": "^5.6.0", - "@ethersproject/keccak256": "^5.6.0", + "version": "5.6.2", + "resolved": "https://registry.npmjs.org/@ethersproject/wallet/-/wallet-5.6.2.tgz", + "integrity": "sha512-lrgh0FDQPuOnHcF80Q3gHYsSUODp6aJLAdDmDV0xKCN/T7D99ta1jGVhulg3PY8wiXEngD0DfM0I2XKXlrqJfg==", + "requires": { + "@ethersproject/abstract-provider": "^5.6.1", + "@ethersproject/abstract-signer": "^5.6.2", + "@ethersproject/address": "^5.6.1", + "@ethersproject/bignumber": "^5.6.2", + "@ethersproject/bytes": "^5.6.1", + "@ethersproject/hash": "^5.6.1", + "@ethersproject/hdnode": "^5.6.2", + "@ethersproject/json-wallets": "^5.6.1", + "@ethersproject/keccak256": "^5.6.1", "@ethersproject/logger": "^5.6.0", "@ethersproject/properties": "^5.6.0", - "@ethersproject/random": "^5.6.0", - "@ethersproject/signing-key": "^5.6.0", - "@ethersproject/transactions": "^5.6.0", - "@ethersproject/wordlists": "^5.6.0" + "@ethersproject/random": "^5.6.1", + "@ethersproject/signing-key": "^5.6.2", + "@ethersproject/transactions": "^5.6.2", + "@ethersproject/wordlists": "^5.6.1" } }, "@ethersproject/web": { - "version": "5.6.0", - "resolved": "https://registry.npmjs.org/@ethersproject/web/-/web-5.6.0.tgz", - "integrity": "sha512-G/XHj0hV1FxI2teHRfCGvfBUHFmU+YOSbCxlAMqJklxSa7QMiHFQfAxvwY2PFqgvdkxEKwRNr/eCjfAPEm2Ctg==", + "version": "5.6.1", + "resolved": "https://registry.npmjs.org/@ethersproject/web/-/web-5.6.1.tgz", + "integrity": "sha512-/vSyzaQlNXkO1WV+RneYKqCJwualcUdx/Z3gseVovZP0wIlOFcCE1hkRhKBH8ImKbGQbMl9EAAyJFrJu7V0aqA==", "requires": { - "@ethersproject/base64": "^5.6.0", - "@ethersproject/bytes": "^5.6.0", + "@ethersproject/base64": "^5.6.1", + "@ethersproject/bytes": "^5.6.1", "@ethersproject/logger": "^5.6.0", "@ethersproject/properties": "^5.6.0", - "@ethersproject/strings": "^5.6.0" + "@ethersproject/strings": "^5.6.1" } }, "@ethersproject/wordlists": { - "version": "5.6.0", - "resolved": "https://registry.npmjs.org/@ethersproject/wordlists/-/wordlists-5.6.0.tgz", - "integrity": "sha512-q0bxNBfIX3fUuAo9OmjlEYxP40IB8ABgb7HjEZCL5IKubzV3j30CWi2rqQbjTS2HfoyQbfINoKcTVWP4ejwR7Q==", + "version": "5.6.1", + "resolved": "https://registry.npmjs.org/@ethersproject/wordlists/-/wordlists-5.6.1.tgz", + "integrity": "sha512-wiPRgBpNbNwCQFoCr8bcWO8o5I810cqO6mkdtKfLKFlLxeCWcnzDi4Alu8iyNzlhYuS9npCwivMbRWF19dyblw==", "requires": { - "@ethersproject/bytes": "^5.6.0", - "@ethersproject/hash": "^5.6.0", + "@ethersproject/bytes": "^5.6.1", + "@ethersproject/hash": "^5.6.1", "@ethersproject/logger": "^5.6.0", "@ethersproject/properties": "^5.6.0", - "@ethersproject/strings": "^5.6.0" + "@ethersproject/strings": "^5.6.1" } }, "@gnosis.pm/mock-contract": { @@ -33157,9 +33133,9 @@ "integrity": "sha512-XpNj6GDQzdfW+r2Wnn7xiSAd7TM3jzkxGXBGTtWKuSXv1xUV+azxAm8jdWZN06QTQk+2N2XB9jRDkvbmQmcRtg==" }, "bn.js": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-5.2.0.tgz", - "integrity": "sha512-D7iWRBvnZE8ecXiLj/9wbxH7Tk79fAh8IHaTNq1RWRixsS02W+5qS+iE9yq6RYl0asXx5tw0bLhmT5pIfbSquw==" + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-5.2.1.tgz", + "integrity": "sha512-eXRvHzWyYPBuB4NBy0cmYQjGitUrtqwbvlzP3G6VFnNRbsZQIxQ10PbKKHt8gZ/HW/D/747aDl+QkDqg3KQLMQ==" }, "body-parser": { "version": "1.20.0", @@ -35930,40 +35906,40 @@ } }, "ethers": { - "version": "5.6.7", - "resolved": "https://registry.npmjs.org/ethers/-/ethers-5.6.7.tgz", - "integrity": "sha512-Q8pmMraUENK0cY6cy6IvIe3e9xL/+4kBvxmUvLXg1O7Abob0c7XzWI76E29j5em/HxWMl5hYiSClmOMW3jJmdg==", - "requires": { - "@ethersproject/abi": "5.6.2", - "@ethersproject/abstract-provider": "5.6.0", - "@ethersproject/abstract-signer": "5.6.1", - "@ethersproject/address": "5.6.0", - "@ethersproject/base64": "5.6.0", - "@ethersproject/basex": "5.6.0", - "@ethersproject/bignumber": "5.6.1", + "version": "5.6.8", + "resolved": "https://registry.npmjs.org/ethers/-/ethers-5.6.8.tgz", + "integrity": "sha512-YxIGaltAOdvBFPZwIkyHnXbW40f1r8mHUgapW6dxkO+6t7H6wY8POUn0Kbxrd/N7I4hHxyi7YCddMAH/wmho2w==", + "requires": { + "@ethersproject/abi": "5.6.3", + "@ethersproject/abstract-provider": "5.6.1", + "@ethersproject/abstract-signer": "5.6.2", + "@ethersproject/address": "5.6.1", + "@ethersproject/base64": "5.6.1", + "@ethersproject/basex": "5.6.1", + "@ethersproject/bignumber": "5.6.2", "@ethersproject/bytes": "5.6.1", - "@ethersproject/constants": "5.6.0", - "@ethersproject/contracts": "5.6.1", - "@ethersproject/hash": "5.6.0", - "@ethersproject/hdnode": "5.6.1", - "@ethersproject/json-wallets": "5.6.0", - "@ethersproject/keccak256": "5.6.0", + "@ethersproject/constants": "5.6.1", + "@ethersproject/contracts": "5.6.2", + "@ethersproject/hash": "5.6.1", + "@ethersproject/hdnode": "5.6.2", + "@ethersproject/json-wallets": "5.6.1", + "@ethersproject/keccak256": "5.6.1", "@ethersproject/logger": "5.6.0", "@ethersproject/networks": "5.6.3", - "@ethersproject/pbkdf2": "5.6.0", + "@ethersproject/pbkdf2": "5.6.1", "@ethersproject/properties": "5.6.0", - "@ethersproject/providers": "5.6.7", - "@ethersproject/random": "5.6.0", - "@ethersproject/rlp": "5.6.0", - "@ethersproject/sha2": "5.6.0", - "@ethersproject/signing-key": "5.6.1", - "@ethersproject/solidity": "5.6.0", - "@ethersproject/strings": "5.6.0", - "@ethersproject/transactions": "5.6.1", - "@ethersproject/units": "5.6.0", - "@ethersproject/wallet": "5.6.1", - "@ethersproject/web": "5.6.0", - "@ethersproject/wordlists": "5.6.0" + "@ethersproject/providers": "5.6.8", + "@ethersproject/random": "5.6.1", + "@ethersproject/rlp": "5.6.1", + "@ethersproject/sha2": "5.6.1", + "@ethersproject/signing-key": "5.6.2", + "@ethersproject/solidity": "5.6.1", + "@ethersproject/strings": "5.6.1", + "@ethersproject/transactions": "5.6.2", + "@ethersproject/units": "5.6.1", + "@ethersproject/wallet": "5.6.2", + "@ethersproject/web": "5.6.1", + "@ethersproject/wordlists": "5.6.1" } }, "ethjs-abi": { diff --git a/package.json b/package.json index efbf22527..5db265065 100644 --- a/package.json +++ b/package.json @@ -89,7 +89,7 @@ "eslint-plugin-import": "^2.26.0", "eslint-plugin-prettier": "^4.0.0", "ethereum-waffle": "^3.4.4", - "ethers": "^5.6.7", + "ethers": "^5.6.8", "husky": "^8.0.1", "lint-staged": "^12.4.1", "mocha": "^10.0.0", From 909cd23e72a243e1f6ceca9cd8a80f9cd918f6b0 Mon Sep 17 00:00:00 2001 From: Caleb Ditchfield Date: Wed, 25 May 2022 12:22:45 -0700 Subject: [PATCH 147/274] PR Templates Must Be in Default Branch --- .github/pull_request_template.md | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 .github/pull_request_template.md diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md new file mode 100644 index 000000000..6ecadab03 --- /dev/null +++ b/.github/pull_request_template.md @@ -0,0 +1,9 @@ +# Pull Request Template Test + +## Is This Working? + +[ ] A checkbox +[ ] Another checkbox! +[ ] And another one! + +## Yay. From 59126f149a83c21101fa5f9071382d81470c7084 Mon Sep 17 00:00:00 2001 From: Caleb Ditchfield Date: Wed, 25 May 2022 12:34:11 -0700 Subject: [PATCH 148/274] PR Template Update --- .github/pull_request_template.md | 30 ++++++++++++++++++++++++------ 1 file changed, 24 insertions(+), 6 deletions(-) diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md index 6ecadab03..fe9992db4 100644 --- a/.github/pull_request_template.md +++ b/.github/pull_request_template.md @@ -1,9 +1,27 @@ -# Pull Request Template Test +# PR Type: Feature|Bug|Release -## Is This Working? +# PR Title: A Fancy Title Here Please -[ ] A checkbox -[ ] Another checkbox! -[ ] And another one! +### PR Description: Replace this text with a description of the PR. It doesn't need to be a novel, but a few sentences should do. Probably about the length of this sample description; perhaps longer if there are enough details. By the way, make sure to delete the checklists not applicable below. Praise Vitalik. -## Yay. +## PR Checklist - Feature (Proposal) + +- [ ] All Tests Passing +- [ ] Proposal Added to ProposalsConfig +- [ ] Fork Block Correct +- [ ] Remove Any .only's on Tests +- [ ] Update Documentation If Needed +- [ ] Update Roles Config +- [ ] Proposal Submitted + +## PR Checklist - Feature (Non-Proposal) | Bug + +- [ ] All Tests Passing +- [ ] Remove Any .only's on Tests + +## PR Checklist - Release + +- [ ] All Tests Passing +- [ ] Clean/Empty Proposals Config +- [ ] Update Fork Block +- [ ] Update Docs If Needed From 0899883fa1d846c1f1087605df4c24d05bb7e235 Mon Sep 17 00:00:00 2001 From: thomas-waite Date: Wed, 25 May 2022 21:42:38 +0200 Subject: [PATCH 149/274] feat: add TC proposal to grant roles --- proposals/dao/register_proposal.ts | 59 ++++++++++++++++++++++ proposals/description/register_proposal.ts | 52 +++++++++++++++++++ 2 files changed, 111 insertions(+) create mode 100644 proposals/dao/register_proposal.ts create mode 100644 proposals/description/register_proposal.ts diff --git a/proposals/dao/register_proposal.ts b/proposals/dao/register_proposal.ts new file mode 100644 index 000000000..8eb70081a --- /dev/null +++ b/proposals/dao/register_proposal.ts @@ -0,0 +1,59 @@ +import hre, { ethers, artifacts } from 'hardhat'; +import { expect } from 'chai'; +import { + DeployUpgradeFunc, + NamedAddresses, + SetupUpgradeFunc, + TeardownUpgradeFunc, + ValidateUpgradeFunc +} from '@custom-types/types'; +import { Core } from '@custom-types/contracts'; + +/* + +TC Proposal: Register Balance Metadata and grant POD_METADATA_ROLES + +*/ + +const fipNumber = 'register_pod_metadata'; + +// Do any deployments +// This should exclusively include new contract deployments +const deploy: DeployUpgradeFunc = async (deployAddress: string, addresses: NamedAddresses, logging: boolean) => { + console.log(`No deploy actions for fip${fipNumber}`); + return { + // put returned contract objects here + }; +}; + +// Do any setup necessary for running the test. +// This could include setting up Hardhat to impersonate accounts, +// ensuring contracts have a specific state, etc. +const setup: SetupUpgradeFunc = async (addresses, oldContracts, contracts, logging) => { + console.log(`No actions to complete in setup for fip${fipNumber}`); +}; + +// Tears down any changes made in setup() that need to be +// cleaned up before doing any validation checks. +const teardown: TeardownUpgradeFunc = async (addresses, oldContracts, contracts, logging) => { + console.log(`No actions to complete in teardown for fip${fipNumber}`); +}; + +// Run any validations required on the fip using mocha or console logging +// IE check balances, check state of contracts, etc. +const validate: ValidateUpgradeFunc = async (addresses, oldContracts, contracts, logging) => { + const core = contracts.core; + const podMetadataRole = ethers.utils.id('POD_METADATA_REGISTER_ROLE'); + + const deployer1 = '0x5346b4ff3e924508d33d93f352d11e392a7a9d3b'; // Caleb + const deployer2 = '0x64c4Bffb220818F0f2ee6DAe7A2F17D92b359c5d'; // Tom + const deployer3 = '0xE2388f22cf5e328C197D6530663809cc0408a510'; // Joey + const deployer4 = '0xcE96fE7Eb7186E9F894DE7703B4DF8ea60E2dD77'; // Erwan + + expect(await core.hasRole(podMetadataRole, deployer1)); + expect(await core.hasRole(podMetadataRole, deployer2)); + expect(await core.hasRole(podMetadataRole, deployer3)); + expect(await core.hasRole(podMetadataRole, deployer4)); +}; + +export { deploy, setup, teardown, validate }; diff --git a/proposals/description/register_proposal.ts b/proposals/description/register_proposal.ts new file mode 100644 index 000000000..54330b01e --- /dev/null +++ b/proposals/description/register_proposal.ts @@ -0,0 +1,52 @@ +import { ProposalDescription } from '@custom-types/types'; + +const register_proposal: ProposalDescription = { + title: 'Register TC Proposal and grant pod metadata roles', + commands: [ + { + target: 'core', + values: '0', + method: 'grantRole(bytes32,address)', + arguments: [ + '0xf62a46a499242191aaab61084d4912c2c0a8c48e3d70edfb5a9be2bc9e92622f', // POD_METADATA_REGISTER_ROLE + '0x64c4Bffb220818F0f2ee6DAe7A2F17D92b359c5d' + ], + description: 'Grant Fei dev, Tom, POD_METADATA_REGISTER_ROLE to register proposal metadata' + }, + { + target: 'core', + values: '0', + method: 'grantRole(bytes32,address)', + arguments: [ + '0xf62a46a499242191aaab61084d4912c2c0a8c48e3d70edfb5a9be2bc9e92622f', // POD_METADATA_REGISTER_ROLE + '0x5346b4ff3e924508d33d93f352d11e392a7a9d3b' + ], + description: 'Grant Fei dev, Caleb, POD_METADATA_REGISTER_ROLE to register proposal metadata' + }, + { + target: 'core', + values: '0', + method: 'grantRole(bytes32,address)', + arguments: [ + '0xf62a46a499242191aaab61084d4912c2c0a8c48e3d70edfb5a9be2bc9e92622f', // POD_METADATA_REGISTER_ROLE + '0xcE96fE7Eb7186E9F894DE7703B4DF8ea60E2dD77' + ], + description: 'Grant Fei dev, Erwan, POD_METADATA_REGISTER_ROLE to register proposal metadata' + }, + { + target: 'core', + values: '0', + method: 'grantRole(bytes32,address)', + arguments: [ + '0xf62a46a499242191aaab61084d4912c2c0a8c48e3d70edfb5a9be2bc9e92622f', // POD_METADATA_REGISTER_ROLE + '0xE2388f22cf5e328C197D6530663809cc0408a510' + ], + description: 'Grant Fei dev, Joey, POD_METADATA_REGISTER_ROLE to register proposal metadata' + } + ], + description: ` + Grant Fei engineers the POD_METADATA_REGISTER_ROLE so they are able to register pod proposal metadata + ` +}; + +export default register_proposal; From 7989655cbf864ad020cfac0cc14f2b16d8ca7bb1 Mon Sep 17 00:00:00 2001 From: thomas-waite Date: Wed, 25 May 2022 21:44:44 +0200 Subject: [PATCH 150/274] feat: add to proposal config --- block.txt | 2 +- test/integration/proposals_config.ts | 51 ++++++---------------------- 2 files changed, 11 insertions(+), 42 deletions(-) diff --git a/block.txt b/block.txt index b1a280ab3..5803c88c5 100644 --- a/block.txt +++ b/block.txt @@ -1 +1 @@ -14811496 +14843722 diff --git a/test/integration/proposals_config.ts b/test/integration/proposals_config.ts index 9de785854..4b2edd143 100644 --- a/test/integration/proposals_config.ts +++ b/test/integration/proposals_config.ts @@ -1,50 +1,10 @@ import { ProposalCategory, ProposalsConfigMap } from '@custom-types/types'; -import fip_104 from '@proposals/description/fip_104'; +import register_proposal from '@proposals/description/register_proposal'; // import fip_xx_proposal from '@proposals/description/fip_xx'; import balancer_gauge_fix from '@proposals/description/balancer_gauge_fix'; const proposals: ProposalsConfigMap = { - fip_104: { - deploy: false, // deploy flag for whether to run deploy action during e2e tests or use mainnet state - totalValue: 0, // amount of ETH to send to DAO execution - proposal: fip_104, // full proposal file, imported from '@proposals/description/fip_xx.ts' - proposalId: '31578302030309093637065801555854148925062532860791705694822567566349182964602', - affectedContractSignoff: [ - 'daiFixedPricePSMFeiSkimmer', - 'core', - 'compoundDaiPCVDeposit', - 'dpiToDaiLBPSwapper', - 'dpiToDaiLensDai', - 'dpiToDaiLensDpi', - 'collateralizationOracle', - 'tribalCouncilTimelock', - 'tribalCouncilSafe', - 'nopeDAO', - 'compoundEthPCVDeposit', - 'aaveEthPCVDeposit', - 'pcvGuardianNew', - 'uniswapPCVDeposit' - ], - deprecatedContractSignoff: [ - 'rariPool31FeiPCVDepositWrapper', - 'rariPool25FeiPCVDepositWrapper', - 'rariPool9RaiPCVDepositWrapper', - 'aaveRaiPCVDepositWrapper', - 'rariPool19DpiPCVDepositWrapper', - 'liquityFusePoolLusdPCVDeposit', - 'rariPool72FeiPCVDepositWrapper', - 'raiDepositWrapper', - 'rariPool31FeiPCVDeposit', - 'rariPool25FeiPCVDeposit', - 'rariPool9RaiPCVDeposit', - 'aaveRaiPCVDeposit', - 'rariPool19DpiPCVDeposit', - 'rariPool72FeiPCVDeposit', - 'dpiDepositWrapper' - ], - category: ProposalCategory.DAO - }, balancer_gauge_fix: { deploy: false, // deploy flag for whether to run deploy action during e2e tests or use mainnet state totalValue: 0, // amount of ETH to send to DAO execution @@ -62,6 +22,15 @@ const proposals: ProposalsConfigMap = { ], deprecatedContractSignoff: ['balancerLensBpt30Fei70WethOld'], category: ProposalCategory.TC + }, + register_proposal: { + deploy: false, // deploy flag for whether to run deploy action during e2e tests or use mainnet state + totalValue: 0, // amount of ETH to send to DAO execution + proposal: register_proposal, // full proposal file, imported from '@proposals/description/fip_xx.ts' + proposalId: null, + affectedContractSignoff: ['core'], + deprecatedContractSignoff: [], + category: ProposalCategory.TC } }; From 31a6bc550f9ac7b19066ad4aead309348c85f184 Mon Sep 17 00:00:00 2001 From: Caleb Ditchfield Date: Wed, 25 May 2022 12:47:05 -0700 Subject: [PATCH 151/274] update readme and template --- .github/pull_request_template.md | 6 +-- README.md | 68 +++++++++++++++++++------------- 2 files changed, 44 insertions(+), 30 deletions(-) diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md index fe9992db4..3b1b4f201 100644 --- a/.github/pull_request_template.md +++ b/.github/pull_request_template.md @@ -4,7 +4,7 @@ ### PR Description: Replace this text with a description of the PR. It doesn't need to be a novel, but a few sentences should do. Probably about the length of this sample description; perhaps longer if there are enough details. By the way, make sure to delete the checklists not applicable below. Praise Vitalik. -## PR Checklist - Feature (Proposal) +### PR Checklist - Feature (Proposal) - [ ] All Tests Passing - [ ] Proposal Added to ProposalsConfig @@ -14,12 +14,12 @@ - [ ] Update Roles Config - [ ] Proposal Submitted -## PR Checklist - Feature (Non-Proposal) | Bug +### PR Checklist - Feature (Non-Proposal) | Bug - [ ] All Tests Passing - [ ] Remove Any .only's on Tests -## PR Checklist - Release +### PR Checklist - Release - [ ] All Tests Passing - [ ] Clean/Empty Proposals Config diff --git a/README.md b/README.md index 216e86721..7ab17c476 100644 --- a/README.md +++ b/README.md @@ -3,57 +3,71 @@ Smart contract code for Fei Protocol and the FEI stablecoin ## To get started: + 1. Git clone this repo: git clone git@github.com:fei-protocol/fei-protocol-core.git 2. Install dependencies: `npm install` 3. Set the relevant environment variables in a gitignored `.env`: `MAINNET_ALCHEMY_API_KEY` and `ETH_PRIVATE_KEY`. You can use the `.env.example` as a base 4. To run the Hardhat based unit tests, run `npm run test:hardhat` ### Setting up Forge + Fei makes use of Forge as a smart contract development framework alongside Hardhat. To set this up run: `npm run setup` ## Dependencies - Note that this has only been tested on Linux; you may encounter issues running on other operating systems. - - - Node v12 or v16 (you can manage Node versions easily with [NVM](https://github.com/nvm-sh/nvm)) + +Note that this has only been tested on Linux; you may encounter issues running on other operating systems. + +- Node v12 or v16 (you can manage Node versions easily with [NVM](https://github.com/nvm-sh/nvm)) ## Usage - - run `npm run test` to run Forge based unit tests - - run `npm run test:hardhat` to run Hardhat based unit tests - - run `npm run test:integration` to run Solidity integration tests, forked from a pinned Mainnet block - - run `npm run test:integration:latest` to run Solidity integration tests, forked from the latest block - - run `npm run test:e2e` to run end-to-end/integration tests - - run `npm run test:all` to run all tests - - run `npm run lint` to lint ts files and sol files - - run `npm lint:all` to lint ts AND js files - - run `npm run lint:sol` to lint .sol files - - run `npm run lint:fix` to fix linting errors, if fixable automatically - - run `npm run prettier:ts` to run prettier and automatically format all ts files - automatically - - run `npm run prettier:sol` to run prettier and automatically format all Solidity files - automatically - - run `npm run prettier` to run prettier and format all files - - run `npm run coverage:hardhat` to run smart-contract coverage based off of all tests - - run `npm run calldata` to generage calldata for a proposal - - run `npm run check-proposal` to run tests for a specific dao proposal - - run `npm run compile` to compile smart contracts, if needed + +- run `npm run test` to run Forge based unit tests +- run `npm run test:hardhat` to run Hardhat based unit tests +- run `npm run test:integration` to run Solidity integration tests, forked from a pinned Mainnet block +- run `npm run test:integration:latest` to run Solidity integration tests, forked from the latest block +- run `npm run test:e2e` to run end-to-end/integration tests +- run `npm run test:all` to run all tests +- run `npm run lint` to lint ts files and sol files +- run `npm lint:all` to lint ts AND js files +- run `npm run lint:sol` to lint .sol files +- run `npm run lint:fix` to fix linting errors, if fixable automatically +- run `npm run prettier:ts` to run prettier and automatically format all ts files + automatically +- run `npm run prettier:sol` to run prettier and automatically format all Solidity files + automatically +- run `npm run prettier` to run prettier and format all files +- run `npm run coverage:hardhat` to run smart-contract coverage based off of all tests +- run `npm run calldata` to generage calldata for a proposal +- run `npm run check-proposal` to run tests for a specific dao proposal +- run `npm run compile` to compile smart contracts, if needed ## Documentation + See the [docs](https://docs.fei.money) ## Release Process + Every Thursday, do the following for the weekly release: - 1) Update the current release branch's fixed hardhat block to something within the last hour - 2) Clean the release branch if necessary: +### Release Fei-Protocol-Core + +1. Update the current release branch's fixed hardhat block to something within the last hour +2. Clean the release branch if necessary: - fix any failing tests - clear out proposals-config - 3) Merge the release branch into master. Create a release via the github UI, using the version number of the release branch. - 4) Merge master back into develop to ensure that any fixes added are pulled back into develop, and so that the hardcoded fork block is set correctly for the most recent release. - 5) Create a new branch off of develop of the format release/major.minor.patch, using an incremented minor version number +3. Merge the release branch into master. Create a release via the github UI, using the version number of the release branch. +4. Merge master back into develop to ensure that any fixes added are pulled back into develop, and so that the hardcoded fork block is set correctly for the most recent release. +5. Create a new branch off of develop of the format release/major.minor.patch, using an incremented minor version number For hotfix releases or bugfixes to master, branch off of master, add in the necessary fixes, and merge back into master. Then tag that commit with a new release number (increment the patch version number here). Finally merge master back into develop. +### Release Docs (If Applicable) + +1. @Joey should update this, because I am confused about the difference between the gh-pages and the master branch. Which one should we update, + and which one should we run commands on? Also, do we need to change the default branch of this repo? + ## License + Fei Protocol is under [the AGPL v3 license](https://github.com/fei-protocol/fei-protocol-core/tree/7160dda163d45e6d6c7092ef021c365e0031a71f/LICENSE.md) From 74472480e4d9cc6dcc4fcbd3974609d9762909ee Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 25 May 2022 20:01:58 +0000 Subject: [PATCH 152/274] build(deps-dev): bump lint-staged from 12.4.1 to 12.4.2 Bumps [lint-staged](https://github.com/okonet/lint-staged) from 12.4.1 to 12.4.2. - [Release notes](https://github.com/okonet/lint-staged/releases) - [Commits](https://github.com/okonet/lint-staged/compare/v12.4.1...v12.4.2) --- updated-dependencies: - dependency-name: lint-staged dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- package-lock.json | 974 ++++++++++++++++++++++------------------------ package.json | 6 +- 2 files changed, 478 insertions(+), 502 deletions(-) diff --git a/package-lock.json b/package-lock.json index 03353d52f..229af97f3 100644 --- a/package-lock.json +++ b/package-lock.json @@ -49,9 +49,9 @@ "eslint-plugin-import": "^2.26.0", "eslint-plugin-prettier": "^4.0.0", "ethereum-waffle": "^3.4.4", - "ethers": "^5.6.7", + "ethers": "^5.6.8", "husky": "^8.0.1", - "lint-staged": "^12.4.1", + "lint-staged": "^12.4.2", "mocha": "^10.0.0", "mocha-junit-reporter": "^2.0.2", "mocha-multi-reporters": "^1.5.1", @@ -63,7 +63,7 @@ "ts-node": "^10.7.0", "tsconfig-paths": "^4.0.0", "typechain": "^5.2.0", - "typescript": "^4.6.4" + "typescript": "^4.7.2" }, "engines": { "node": ">=16.0.0", @@ -844,9 +844,9 @@ } }, "node_modules/@ethersproject/abi": { - "version": "5.6.2", - "resolved": "https://registry.npmjs.org/@ethersproject/abi/-/abi-5.6.2.tgz", - "integrity": "sha512-40Ixjhy+YzFtnvzIqFU13FW9hd1gMoLa3cJfSDnfnL4o8EnEG1qLiV8sNJo3sHYi9UYMfFeRuZ7kv5+vhzU7gQ==", + "version": "5.6.3", + "resolved": "https://registry.npmjs.org/@ethersproject/abi/-/abi-5.6.3.tgz", + "integrity": "sha512-CxKTdoZY4zDJLWXG6HzNH6znWK0M79WzzxHegDoecE3+K32pzfHOzuXg2/oGSTecZynFgpkjYXNPOqXVJlqClw==", "funding": [ { "type": "individual", @@ -858,21 +858,21 @@ } ], "dependencies": { - "@ethersproject/address": "^5.6.0", - "@ethersproject/bignumber": "^5.6.0", - "@ethersproject/bytes": "^5.6.0", - "@ethersproject/constants": "^5.6.0", - "@ethersproject/hash": "^5.6.0", - "@ethersproject/keccak256": "^5.6.0", + "@ethersproject/address": "^5.6.1", + "@ethersproject/bignumber": "^5.6.2", + "@ethersproject/bytes": "^5.6.1", + "@ethersproject/constants": "^5.6.1", + "@ethersproject/hash": "^5.6.1", + "@ethersproject/keccak256": "^5.6.1", "@ethersproject/logger": "^5.6.0", "@ethersproject/properties": "^5.6.0", - "@ethersproject/strings": "^5.6.0" + "@ethersproject/strings": "^5.6.1" } }, "node_modules/@ethersproject/abstract-provider": { - "version": "5.6.0", - "resolved": "https://registry.npmjs.org/@ethersproject/abstract-provider/-/abstract-provider-5.6.0.tgz", - "integrity": "sha512-oPMFlKLN+g+y7a79cLK3WiLcjWFnZQtXWgnLAbHZcN3s7L4v90UHpTOrLk+m3yr0gt+/h9STTM6zrr7PM8uoRw==", + "version": "5.6.1", + "resolved": "https://registry.npmjs.org/@ethersproject/abstract-provider/-/abstract-provider-5.6.1.tgz", + "integrity": "sha512-BxlIgogYJtp1FS8Muvj8YfdClk3unZH0vRMVX791Z9INBNT/kuACZ9GzaY1Y4yFq+YSy6/w4gzj3HCRKrK9hsQ==", "funding": [ { "type": "individual", @@ -884,19 +884,19 @@ } ], "dependencies": { - "@ethersproject/bignumber": "^5.6.0", - "@ethersproject/bytes": "^5.6.0", + "@ethersproject/bignumber": "^5.6.2", + "@ethersproject/bytes": "^5.6.1", "@ethersproject/logger": "^5.6.0", - "@ethersproject/networks": "^5.6.0", + "@ethersproject/networks": "^5.6.3", "@ethersproject/properties": "^5.6.0", - "@ethersproject/transactions": "^5.6.0", - "@ethersproject/web": "^5.6.0" + "@ethersproject/transactions": "^5.6.2", + "@ethersproject/web": "^5.6.1" } }, "node_modules/@ethersproject/abstract-signer": { - "version": "5.6.1", - "resolved": "https://registry.npmjs.org/@ethersproject/abstract-signer/-/abstract-signer-5.6.1.tgz", - "integrity": "sha512-xhSLo6y0nGJS7NxfvOSzCaWKvWb1TLT7dQ0nnpHZrDnC67xfnWm9NXflTMFPUXXMtjr33CdV0kWDEmnbrQZ74Q==", + "version": "5.6.2", + "resolved": "https://registry.npmjs.org/@ethersproject/abstract-signer/-/abstract-signer-5.6.2.tgz", + "integrity": "sha512-n1r6lttFBG0t2vNiI3HoWaS/KdOt8xyDjzlP2cuevlWLG6EX0OwcKLyG/Kp/cuwNxdy/ous+R/DEMdTUwWQIjQ==", "funding": [ { "type": "individual", @@ -908,17 +908,17 @@ } ], "dependencies": { - "@ethersproject/abstract-provider": "^5.6.0", - "@ethersproject/bignumber": "^5.6.0", - "@ethersproject/bytes": "^5.6.0", + "@ethersproject/abstract-provider": "^5.6.1", + "@ethersproject/bignumber": "^5.6.2", + "@ethersproject/bytes": "^5.6.1", "@ethersproject/logger": "^5.6.0", "@ethersproject/properties": "^5.6.0" } }, "node_modules/@ethersproject/address": { - "version": "5.6.0", - "resolved": "https://registry.npmjs.org/@ethersproject/address/-/address-5.6.0.tgz", - "integrity": "sha512-6nvhYXjbXsHPS+30sHZ+U4VMagFC/9zAk6Gd/h3S21YW4+yfb0WfRtaAIZ4kfM4rrVwqiy284LP0GtL5HXGLxQ==", + "version": "5.6.1", + "resolved": "https://registry.npmjs.org/@ethersproject/address/-/address-5.6.1.tgz", + "integrity": "sha512-uOgF0kS5MJv9ZvCz7x6T2EXJSzotiybApn4XlOgoTX0xdtyVIJ7pF+6cGPxiEq/dpBiTfMiw7Yc81JcwhSYA0Q==", "funding": [ { "type": "individual", @@ -930,17 +930,17 @@ } ], "dependencies": { - "@ethersproject/bignumber": "^5.6.0", - "@ethersproject/bytes": "^5.6.0", - "@ethersproject/keccak256": "^5.6.0", + "@ethersproject/bignumber": "^5.6.2", + "@ethersproject/bytes": "^5.6.1", + "@ethersproject/keccak256": "^5.6.1", "@ethersproject/logger": "^5.6.0", - "@ethersproject/rlp": "^5.6.0" + "@ethersproject/rlp": "^5.6.1" } }, "node_modules/@ethersproject/base64": { - "version": "5.6.0", - "resolved": "https://registry.npmjs.org/@ethersproject/base64/-/base64-5.6.0.tgz", - "integrity": "sha512-2Neq8wxJ9xHxCF9TUgmKeSh9BXJ6OAxWfeGWvbauPh8FuHEjamgHilllx8KkSd5ErxyHIX7Xv3Fkcud2kY9ezw==", + "version": "5.6.1", + "resolved": "https://registry.npmjs.org/@ethersproject/base64/-/base64-5.6.1.tgz", + "integrity": "sha512-qB76rjop6a0RIYYMiB4Eh/8n+Hxu2NIZm8S/Q7kNo5pmZfXhHGHmS4MinUainiBC54SCyRnwzL+KZjj8zbsSsw==", "funding": [ { "type": "individual", @@ -952,13 +952,13 @@ } ], "dependencies": { - "@ethersproject/bytes": "^5.6.0" + "@ethersproject/bytes": "^5.6.1" } }, "node_modules/@ethersproject/basex": { - "version": "5.6.0", - "resolved": "https://registry.npmjs.org/@ethersproject/basex/-/basex-5.6.0.tgz", - "integrity": "sha512-qN4T+hQd/Md32MoJpc69rOwLYRUXwjTlhHDIeUkUmiN/JyWkkLLMoG0TqvSQKNqZOMgN5stbUYN6ILC+eD7MEQ==", + "version": "5.6.1", + "resolved": "https://registry.npmjs.org/@ethersproject/basex/-/basex-5.6.1.tgz", + "integrity": "sha512-a52MkVz4vuBXR06nvflPMotld1FJWSj2QT0985v7P/emPZO00PucFAkbcmq2vpVU7Ts7umKiSI6SppiLykVWsA==", "funding": [ { "type": "individual", @@ -970,14 +970,14 @@ } ], "dependencies": { - "@ethersproject/bytes": "^5.6.0", + "@ethersproject/bytes": "^5.6.1", "@ethersproject/properties": "^5.6.0" } }, "node_modules/@ethersproject/bignumber": { - "version": "5.6.1", - "resolved": "https://registry.npmjs.org/@ethersproject/bignumber/-/bignumber-5.6.1.tgz", - "integrity": "sha512-UtMeZ3GaUuF9sx2u9nPZiPP3ULcAFmXyvynR7oHl/tPrM+vldZh7ocMsoa1PqKYGnQnqUZJoqxZnGN6J0qdipA==", + "version": "5.6.2", + "resolved": "https://registry.npmjs.org/@ethersproject/bignumber/-/bignumber-5.6.2.tgz", + "integrity": "sha512-v7+EEUbhGqT3XJ9LMPsKvXYHFc8eHxTowFCG/HgJErmq4XHJ2WR7aeyICg3uTOAQ7Icn0GFHAohXEhxQHq4Ubw==", "funding": [ { "type": "individual", @@ -989,16 +989,11 @@ } ], "dependencies": { - "@ethersproject/bytes": "^5.6.0", + "@ethersproject/bytes": "^5.6.1", "@ethersproject/logger": "^5.6.0", - "bn.js": "^4.11.9" + "bn.js": "^5.2.1" } }, - "node_modules/@ethersproject/bignumber/node_modules/bn.js": { - "version": "4.12.0", - "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.12.0.tgz", - "integrity": "sha512-c98Bf3tPniI+scsdk237ku1Dc3ujXQTSgyiPUDEOe7tRkhrqridvh8klBv0HCEso1OLOYcHuCv/cS6DNxKH+ZA==" - }, "node_modules/@ethersproject/bytes": { "version": "5.6.1", "resolved": "https://registry.npmjs.org/@ethersproject/bytes/-/bytes-5.6.1.tgz", @@ -1018,9 +1013,9 @@ } }, "node_modules/@ethersproject/constants": { - "version": "5.6.0", - "resolved": "https://registry.npmjs.org/@ethersproject/constants/-/constants-5.6.0.tgz", - "integrity": "sha512-SrdaJx2bK0WQl23nSpV/b1aq293Lh0sUaZT/yYKPDKn4tlAbkH96SPJwIhwSwTsoQQZxuh1jnqsKwyymoiBdWA==", + "version": "5.6.1", + "resolved": "https://registry.npmjs.org/@ethersproject/constants/-/constants-5.6.1.tgz", + "integrity": "sha512-QSq9WVnZbxXYFftrjSjZDUshp6/eKp6qrtdBtUCm0QxCV5z1fG/w3kdlcsjMCQuQHUnAclKoK7XpXMezhRDOLg==", "funding": [ { "type": "individual", @@ -1032,13 +1027,13 @@ } ], "dependencies": { - "@ethersproject/bignumber": "^5.6.0" + "@ethersproject/bignumber": "^5.6.2" } }, "node_modules/@ethersproject/contracts": { - "version": "5.6.1", - "resolved": "https://registry.npmjs.org/@ethersproject/contracts/-/contracts-5.6.1.tgz", - "integrity": "sha512-0fpBBDoPqJMsutE6sNjg6pvCJaIcl7tliMQTMRcoUWDACfjO68CpKOJBlsEhEhmzdnu/41KbrfAeg+sB3y35MQ==", + "version": "5.6.2", + "resolved": "https://registry.npmjs.org/@ethersproject/contracts/-/contracts-5.6.2.tgz", + "integrity": "sha512-hguUA57BIKi6WY0kHvZp6PwPlWF87MCeB4B7Z7AbUpTxfFXFdn/3b0GmjZPagIHS+3yhcBJDnuEfU4Xz+Ks/8g==", "funding": [ { "type": "individual", @@ -1050,16 +1045,16 @@ } ], "dependencies": { - "@ethersproject/abi": "^5.6.0", - "@ethersproject/abstract-provider": "^5.6.0", - "@ethersproject/abstract-signer": "^5.6.0", - "@ethersproject/address": "^5.6.0", - "@ethersproject/bignumber": "^5.6.0", - "@ethersproject/bytes": "^5.6.0", - "@ethersproject/constants": "^5.6.0", + "@ethersproject/abi": "^5.6.3", + "@ethersproject/abstract-provider": "^5.6.1", + "@ethersproject/abstract-signer": "^5.6.2", + "@ethersproject/address": "^5.6.1", + "@ethersproject/bignumber": "^5.6.2", + "@ethersproject/bytes": "^5.6.1", + "@ethersproject/constants": "^5.6.1", "@ethersproject/logger": "^5.6.0", "@ethersproject/properties": "^5.6.0", - "@ethersproject/transactions": "^5.6.0" + "@ethersproject/transactions": "^5.6.2" } }, "node_modules/@ethersproject/hardware-wallets": { @@ -1088,9 +1083,9 @@ } }, "node_modules/@ethersproject/hash": { - "version": "5.6.0", - "resolved": "https://registry.npmjs.org/@ethersproject/hash/-/hash-5.6.0.tgz", - "integrity": "sha512-fFd+k9gtczqlr0/BruWLAu7UAOas1uRRJvOR84uDf4lNZ+bTkGl366qvniUZHKtlqxBRU65MkOobkmvmpHU+jA==", + "version": "5.6.1", + "resolved": "https://registry.npmjs.org/@ethersproject/hash/-/hash-5.6.1.tgz", + "integrity": "sha512-L1xAHurbaxG8VVul4ankNX5HgQ8PNCTrnVXEiFnE9xoRnaUcgfD12tZINtDinSllxPLCtGwguQxJ5E6keE84pA==", "funding": [ { "type": "individual", @@ -1102,20 +1097,20 @@ } ], "dependencies": { - "@ethersproject/abstract-signer": "^5.6.0", - "@ethersproject/address": "^5.6.0", - "@ethersproject/bignumber": "^5.6.0", - "@ethersproject/bytes": "^5.6.0", - "@ethersproject/keccak256": "^5.6.0", + "@ethersproject/abstract-signer": "^5.6.2", + "@ethersproject/address": "^5.6.1", + "@ethersproject/bignumber": "^5.6.2", + "@ethersproject/bytes": "^5.6.1", + "@ethersproject/keccak256": "^5.6.1", "@ethersproject/logger": "^5.6.0", "@ethersproject/properties": "^5.6.0", - "@ethersproject/strings": "^5.6.0" + "@ethersproject/strings": "^5.6.1" } }, "node_modules/@ethersproject/hdnode": { - "version": "5.6.1", - "resolved": "https://registry.npmjs.org/@ethersproject/hdnode/-/hdnode-5.6.1.tgz", - "integrity": "sha512-6IuYDmbH5Bv/WH/A2cUd0FjNr4qTLAvyHAECiFZhNZp69pPvU7qIDwJ7CU7VAkwm4IVBzqdYy9mpMAGhQdwCDA==", + "version": "5.6.2", + "resolved": "https://registry.npmjs.org/@ethersproject/hdnode/-/hdnode-5.6.2.tgz", + "integrity": "sha512-tERxW8Ccf9CxW2db3WsN01Qao3wFeRsfYY9TCuhmG0xNpl2IO8wgXU3HtWIZ49gUWPggRy4Yg5axU0ACaEKf1Q==", "funding": [ { "type": "individual", @@ -1127,24 +1122,24 @@ } ], "dependencies": { - "@ethersproject/abstract-signer": "^5.6.0", - "@ethersproject/basex": "^5.6.0", - "@ethersproject/bignumber": "^5.6.0", - "@ethersproject/bytes": "^5.6.0", + "@ethersproject/abstract-signer": "^5.6.2", + "@ethersproject/basex": "^5.6.1", + "@ethersproject/bignumber": "^5.6.2", + "@ethersproject/bytes": "^5.6.1", "@ethersproject/logger": "^5.6.0", - "@ethersproject/pbkdf2": "^5.6.0", + "@ethersproject/pbkdf2": "^5.6.1", "@ethersproject/properties": "^5.6.0", - "@ethersproject/sha2": "^5.6.0", - "@ethersproject/signing-key": "^5.6.0", - "@ethersproject/strings": "^5.6.0", - "@ethersproject/transactions": "^5.6.0", - "@ethersproject/wordlists": "^5.6.0" + "@ethersproject/sha2": "^5.6.1", + "@ethersproject/signing-key": "^5.6.2", + "@ethersproject/strings": "^5.6.1", + "@ethersproject/transactions": "^5.6.2", + "@ethersproject/wordlists": "^5.6.1" } }, "node_modules/@ethersproject/json-wallets": { - "version": "5.6.0", - "resolved": "https://registry.npmjs.org/@ethersproject/json-wallets/-/json-wallets-5.6.0.tgz", - "integrity": "sha512-fmh86jViB9r0ibWXTQipxpAGMiuxoqUf78oqJDlCAJXgnJF024hOOX7qVgqsjtbeoxmcLwpPsXNU0WEe/16qPQ==", + "version": "5.6.1", + "resolved": "https://registry.npmjs.org/@ethersproject/json-wallets/-/json-wallets-5.6.1.tgz", + "integrity": "sha512-KfyJ6Zwz3kGeX25nLihPwZYlDqamO6pfGKNnVMWWfEVVp42lTfCZVXXy5Ie8IZTN0HKwAngpIPi7gk4IJzgmqQ==", "funding": [ { "type": "individual", @@ -1156,17 +1151,17 @@ } ], "dependencies": { - "@ethersproject/abstract-signer": "^5.6.0", - "@ethersproject/address": "^5.6.0", - "@ethersproject/bytes": "^5.6.0", - "@ethersproject/hdnode": "^5.6.0", - "@ethersproject/keccak256": "^5.6.0", + "@ethersproject/abstract-signer": "^5.6.2", + "@ethersproject/address": "^5.6.1", + "@ethersproject/bytes": "^5.6.1", + "@ethersproject/hdnode": "^5.6.2", + "@ethersproject/keccak256": "^5.6.1", "@ethersproject/logger": "^5.6.0", - "@ethersproject/pbkdf2": "^5.6.0", + "@ethersproject/pbkdf2": "^5.6.1", "@ethersproject/properties": "^5.6.0", - "@ethersproject/random": "^5.6.0", - "@ethersproject/strings": "^5.6.0", - "@ethersproject/transactions": "^5.6.0", + "@ethersproject/random": "^5.6.1", + "@ethersproject/strings": "^5.6.1", + "@ethersproject/transactions": "^5.6.2", "aes-js": "3.0.0", "scrypt-js": "3.0.1" } @@ -1177,9 +1172,9 @@ "integrity": "sha1-4h3xCtbCBTKVvLuNq0Cwnb6ofk0=" }, "node_modules/@ethersproject/keccak256": { - "version": "5.6.0", - "resolved": "https://registry.npmjs.org/@ethersproject/keccak256/-/keccak256-5.6.0.tgz", - "integrity": "sha512-tk56BJ96mdj/ksi7HWZVWGjCq0WVl/QvfhFQNeL8fxhBlGoP+L80uDCiQcpJPd+2XxkivS3lwRm3E0CXTfol0w==", + "version": "5.6.1", + "resolved": "https://registry.npmjs.org/@ethersproject/keccak256/-/keccak256-5.6.1.tgz", + "integrity": "sha512-bB7DQHCTRDooZZdL3lk9wpL0+XuG3XLGHLh3cePnybsO3V0rdCAOQGpn/0R3aODmnTOOkCATJiD2hnL+5bwthA==", "funding": [ { "type": "individual", @@ -1191,7 +1186,7 @@ } ], "dependencies": { - "@ethersproject/bytes": "^5.6.0", + "@ethersproject/bytes": "^5.6.1", "js-sha3": "0.8.0" } }, @@ -1229,9 +1224,9 @@ } }, "node_modules/@ethersproject/pbkdf2": { - "version": "5.6.0", - "resolved": "https://registry.npmjs.org/@ethersproject/pbkdf2/-/pbkdf2-5.6.0.tgz", - "integrity": "sha512-Wu1AxTgJo3T3H6MIu/eejLFok9TYoSdgwRr5oGY1LTLfmGesDoSx05pemsbrPT2gG4cQME+baTSCp5sEo2erZQ==", + "version": "5.6.1", + "resolved": "https://registry.npmjs.org/@ethersproject/pbkdf2/-/pbkdf2-5.6.1.tgz", + "integrity": "sha512-k4gRQ+D93zDRPNUfmduNKq065uadC2YjMP/CqwwX5qG6R05f47boq6pLZtV/RnC4NZAYOPH1Cyo54q0c9sshRQ==", "funding": [ { "type": "individual", @@ -1243,8 +1238,8 @@ } ], "dependencies": { - "@ethersproject/bytes": "^5.6.0", - "@ethersproject/sha2": "^5.6.0" + "@ethersproject/bytes": "^5.6.1", + "@ethersproject/sha2": "^5.6.1" } }, "node_modules/@ethersproject/properties": { @@ -1266,9 +1261,9 @@ } }, "node_modules/@ethersproject/providers": { - "version": "5.6.7", - "resolved": "https://registry.npmjs.org/@ethersproject/providers/-/providers-5.6.7.tgz", - "integrity": "sha512-QG7KLxfYk0FA0ycWATKMM8UzMOfOvchtkN89nNORlPqqhX5zatdamJ506dh5ECk+ybcnCkeVOdStlzrOMkkGOA==", + "version": "5.6.8", + "resolved": "https://registry.npmjs.org/@ethersproject/providers/-/providers-5.6.8.tgz", + "integrity": "sha512-Wf+CseT/iOJjrGtAOf3ck9zS7AgPmr2fZ3N97r4+YXN3mBePTG2/bJ8DApl9mVwYL+RpYbNxMEkEp4mPGdwG/w==", "funding": [ { "type": "individual", @@ -1280,32 +1275,32 @@ } ], "dependencies": { - "@ethersproject/abstract-provider": "^5.6.0", - "@ethersproject/abstract-signer": "^5.6.0", - "@ethersproject/address": "^5.6.0", - "@ethersproject/base64": "^5.6.0", - "@ethersproject/basex": "^5.6.0", - "@ethersproject/bignumber": "^5.6.0", - "@ethersproject/bytes": "^5.6.0", - "@ethersproject/constants": "^5.6.0", - "@ethersproject/hash": "^5.6.0", + "@ethersproject/abstract-provider": "^5.6.1", + "@ethersproject/abstract-signer": "^5.6.2", + "@ethersproject/address": "^5.6.1", + "@ethersproject/base64": "^5.6.1", + "@ethersproject/basex": "^5.6.1", + "@ethersproject/bignumber": "^5.6.2", + "@ethersproject/bytes": "^5.6.1", + "@ethersproject/constants": "^5.6.1", + "@ethersproject/hash": "^5.6.1", "@ethersproject/logger": "^5.6.0", - "@ethersproject/networks": "^5.6.0", + "@ethersproject/networks": "^5.6.3", "@ethersproject/properties": "^5.6.0", - "@ethersproject/random": "^5.6.0", - "@ethersproject/rlp": "^5.6.0", - "@ethersproject/sha2": "^5.6.0", - "@ethersproject/strings": "^5.6.0", - "@ethersproject/transactions": "^5.6.0", - "@ethersproject/web": "^5.6.0", + "@ethersproject/random": "^5.6.1", + "@ethersproject/rlp": "^5.6.1", + "@ethersproject/sha2": "^5.6.1", + "@ethersproject/strings": "^5.6.1", + "@ethersproject/transactions": "^5.6.2", + "@ethersproject/web": "^5.6.1", "bech32": "1.1.4", "ws": "7.4.6" } }, "node_modules/@ethersproject/random": { - "version": "5.6.0", - "resolved": "https://registry.npmjs.org/@ethersproject/random/-/random-5.6.0.tgz", - "integrity": "sha512-si0PLcLjq+NG/XHSZz90asNf+YfKEqJGVdxoEkSukzbnBgC8rydbgbUgBbBGLeHN4kAJwUFEKsu3sCXT93YMsw==", + "version": "5.6.1", + "resolved": "https://registry.npmjs.org/@ethersproject/random/-/random-5.6.1.tgz", + "integrity": "sha512-/wtPNHwbmng+5yi3fkipA8YBT59DdkGRoC2vWk09Dci/q5DlgnMkhIycjHlavrvrjJBkFjO/ueLyT+aUDfc4lA==", "funding": [ { "type": "individual", @@ -1317,14 +1312,14 @@ } ], "dependencies": { - "@ethersproject/bytes": "^5.6.0", + "@ethersproject/bytes": "^5.6.1", "@ethersproject/logger": "^5.6.0" } }, "node_modules/@ethersproject/rlp": { - "version": "5.6.0", - "resolved": "https://registry.npmjs.org/@ethersproject/rlp/-/rlp-5.6.0.tgz", - "integrity": "sha512-dz9WR1xpcTL+9DtOT/aDO+YyxSSdO8YIS0jyZwHHSlAmnxA6cKU3TrTd4Xc/bHayctxTgGLYNuVVoiXE4tTq1g==", + "version": "5.6.1", + "resolved": "https://registry.npmjs.org/@ethersproject/rlp/-/rlp-5.6.1.tgz", + "integrity": "sha512-uYjmcZx+DKlFUk7a5/W9aQVaoEC7+1MOBgNtvNg13+RnuUwT4F0zTovC0tmay5SmRslb29V1B7Y5KCri46WhuQ==", "funding": [ { "type": "individual", @@ -1336,14 +1331,14 @@ } ], "dependencies": { - "@ethersproject/bytes": "^5.6.0", + "@ethersproject/bytes": "^5.6.1", "@ethersproject/logger": "^5.6.0" } }, "node_modules/@ethersproject/sha2": { - "version": "5.6.0", - "resolved": "https://registry.npmjs.org/@ethersproject/sha2/-/sha2-5.6.0.tgz", - "integrity": "sha512-1tNWCPFLu1n3JM9t4/kytz35DkuF9MxqkGGEHNauEbaARdm2fafnOyw1s0tIQDPKF/7bkP1u3dbrmjpn5CelyA==", + "version": "5.6.1", + "resolved": "https://registry.npmjs.org/@ethersproject/sha2/-/sha2-5.6.1.tgz", + "integrity": "sha512-5K2GyqcW7G4Yo3uenHegbXRPDgARpWUiXc6RiF7b6i/HXUoWlb7uCARh7BAHg7/qT/Q5ydofNwiZcim9qpjB6g==", "funding": [ { "type": "individual", @@ -1355,15 +1350,15 @@ } ], "dependencies": { - "@ethersproject/bytes": "^5.6.0", + "@ethersproject/bytes": "^5.6.1", "@ethersproject/logger": "^5.6.0", "hash.js": "1.1.7" } }, "node_modules/@ethersproject/signing-key": { - "version": "5.6.1", - "resolved": "https://registry.npmjs.org/@ethersproject/signing-key/-/signing-key-5.6.1.tgz", - "integrity": "sha512-XvqQ20DH0D+bS3qlrrgh+axRMth5kD1xuvqUQUTeezxUTXBOeR6hWz2/C6FBEu39FRytyybIWrYf7YLSAKr1LQ==", + "version": "5.6.2", + "resolved": "https://registry.npmjs.org/@ethersproject/signing-key/-/signing-key-5.6.2.tgz", + "integrity": "sha512-jVbu0RuP7EFpw82vHcL+GP35+KaNruVAZM90GxgQnGqB6crhBqW/ozBfFvdeImtmb4qPko0uxXjn8l9jpn0cwQ==", "funding": [ { "type": "individual", @@ -1375,23 +1370,18 @@ } ], "dependencies": { - "@ethersproject/bytes": "^5.6.0", + "@ethersproject/bytes": "^5.6.1", "@ethersproject/logger": "^5.6.0", "@ethersproject/properties": "^5.6.0", - "bn.js": "^4.11.9", + "bn.js": "^5.2.1", "elliptic": "6.5.4", "hash.js": "1.1.7" } }, - "node_modules/@ethersproject/signing-key/node_modules/bn.js": { - "version": "4.12.0", - "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.12.0.tgz", - "integrity": "sha512-c98Bf3tPniI+scsdk237ku1Dc3ujXQTSgyiPUDEOe7tRkhrqridvh8klBv0HCEso1OLOYcHuCv/cS6DNxKH+ZA==" - }, "node_modules/@ethersproject/solidity": { - "version": "5.6.0", - "resolved": "https://registry.npmjs.org/@ethersproject/solidity/-/solidity-5.6.0.tgz", - "integrity": "sha512-YwF52vTNd50kjDzqKaoNNbC/r9kMDPq3YzDWmsjFTRBcIF1y4JCQJ8gB30wsTfHbaxgxelI5BfxQSxD/PbJOww==", + "version": "5.6.1", + "resolved": "https://registry.npmjs.org/@ethersproject/solidity/-/solidity-5.6.1.tgz", + "integrity": "sha512-KWqVLkUUoLBfL1iwdzUVlkNqAUIFMpbbeH0rgCfKmJp0vFtY4AsaN91gHKo9ZZLkC4UOm3cI3BmMV4N53BOq4g==", "funding": [ { "type": "individual", @@ -1403,18 +1393,18 @@ } ], "dependencies": { - "@ethersproject/bignumber": "^5.6.0", - "@ethersproject/bytes": "^5.6.0", - "@ethersproject/keccak256": "^5.6.0", + "@ethersproject/bignumber": "^5.6.2", + "@ethersproject/bytes": "^5.6.1", + "@ethersproject/keccak256": "^5.6.1", "@ethersproject/logger": "^5.6.0", - "@ethersproject/sha2": "^5.6.0", - "@ethersproject/strings": "^5.6.0" + "@ethersproject/sha2": "^5.6.1", + "@ethersproject/strings": "^5.6.1" } }, "node_modules/@ethersproject/strings": { - "version": "5.6.0", - "resolved": "https://registry.npmjs.org/@ethersproject/strings/-/strings-5.6.0.tgz", - "integrity": "sha512-uv10vTtLTZqrJuqBZR862ZQjTIa724wGPWQqZrofaPI/kUsf53TBG0I0D+hQ1qyNtllbNzaW+PDPHHUI6/65Mg==", + "version": "5.6.1", + "resolved": "https://registry.npmjs.org/@ethersproject/strings/-/strings-5.6.1.tgz", + "integrity": "sha512-2X1Lgk6Jyfg26MUnsHiT456U9ijxKUybz8IM1Vih+NJxYtXhmvKBcHOmvGqpFSVJ0nQ4ZCoIViR8XlRw1v/+Cw==", "funding": [ { "type": "individual", @@ -1426,15 +1416,15 @@ } ], "dependencies": { - "@ethersproject/bytes": "^5.6.0", - "@ethersproject/constants": "^5.6.0", + "@ethersproject/bytes": "^5.6.1", + "@ethersproject/constants": "^5.6.1", "@ethersproject/logger": "^5.6.0" } }, "node_modules/@ethersproject/transactions": { - "version": "5.6.1", - "resolved": "https://registry.npmjs.org/@ethersproject/transactions/-/transactions-5.6.1.tgz", - "integrity": "sha512-oIAC7zBCDnjVlEn0KSG1udbqR7hP9FOurxIV/aG+erCdvdvi+QXEZRUtVP9+lu3WYUe8SMYhdAVwNJtD7dZMRw==", + "version": "5.6.2", + "resolved": "https://registry.npmjs.org/@ethersproject/transactions/-/transactions-5.6.2.tgz", + "integrity": "sha512-BuV63IRPHmJvthNkkt9G70Ullx6AcM+SDc+a8Aw/8Yew6YwT51TcBKEp1P4oOQ/bP25I18JJr7rcFRgFtU9B2Q==", "funding": [ { "type": "individual", @@ -1446,21 +1436,21 @@ } ], "dependencies": { - "@ethersproject/address": "^5.6.0", - "@ethersproject/bignumber": "^5.6.0", - "@ethersproject/bytes": "^5.6.0", - "@ethersproject/constants": "^5.6.0", - "@ethersproject/keccak256": "^5.6.0", + "@ethersproject/address": "^5.6.1", + "@ethersproject/bignumber": "^5.6.2", + "@ethersproject/bytes": "^5.6.1", + "@ethersproject/constants": "^5.6.1", + "@ethersproject/keccak256": "^5.6.1", "@ethersproject/logger": "^5.6.0", "@ethersproject/properties": "^5.6.0", - "@ethersproject/rlp": "^5.6.0", - "@ethersproject/signing-key": "^5.6.0" + "@ethersproject/rlp": "^5.6.1", + "@ethersproject/signing-key": "^5.6.2" } }, "node_modules/@ethersproject/units": { - "version": "5.6.0", - "resolved": "https://registry.npmjs.org/@ethersproject/units/-/units-5.6.0.tgz", - "integrity": "sha512-tig9x0Qmh8qbo1w8/6tmtyrm/QQRviBh389EQ+d8fP4wDsBrJBf08oZfoiz1/uenKK9M78yAP4PoR7SsVoTjsw==", + "version": "5.6.1", + "resolved": "https://registry.npmjs.org/@ethersproject/units/-/units-5.6.1.tgz", + "integrity": "sha512-rEfSEvMQ7obcx3KWD5EWWx77gqv54K6BKiZzKxkQJqtpriVsICrktIQmKl8ReNToPeIYPnFHpXvKpi068YFZXw==", "funding": [ { "type": "individual", @@ -1472,15 +1462,15 @@ } ], "dependencies": { - "@ethersproject/bignumber": "^5.6.0", - "@ethersproject/constants": "^5.6.0", + "@ethersproject/bignumber": "^5.6.2", + "@ethersproject/constants": "^5.6.1", "@ethersproject/logger": "^5.6.0" } }, "node_modules/@ethersproject/wallet": { - "version": "5.6.1", - "resolved": "https://registry.npmjs.org/@ethersproject/wallet/-/wallet-5.6.1.tgz", - "integrity": "sha512-oXWoOslEWtwZiViIMlGVjeKDQz/tI7JF9UkyzN9jaGj8z7sXt2SyFMb0Ev6vSAqjIzrCrNrJ/+MkAhtKnGOfZw==", + "version": "5.6.2", + "resolved": "https://registry.npmjs.org/@ethersproject/wallet/-/wallet-5.6.2.tgz", + "integrity": "sha512-lrgh0FDQPuOnHcF80Q3gHYsSUODp6aJLAdDmDV0xKCN/T7D99ta1jGVhulg3PY8wiXEngD0DfM0I2XKXlrqJfg==", "funding": [ { "type": "individual", @@ -1492,27 +1482,27 @@ } ], "dependencies": { - "@ethersproject/abstract-provider": "^5.6.0", - "@ethersproject/abstract-signer": "^5.6.0", - "@ethersproject/address": "^5.6.0", - "@ethersproject/bignumber": "^5.6.0", - "@ethersproject/bytes": "^5.6.0", - "@ethersproject/hash": "^5.6.0", - "@ethersproject/hdnode": "^5.6.0", - "@ethersproject/json-wallets": "^5.6.0", - "@ethersproject/keccak256": "^5.6.0", + "@ethersproject/abstract-provider": "^5.6.1", + "@ethersproject/abstract-signer": "^5.6.2", + "@ethersproject/address": "^5.6.1", + "@ethersproject/bignumber": "^5.6.2", + "@ethersproject/bytes": "^5.6.1", + "@ethersproject/hash": "^5.6.1", + "@ethersproject/hdnode": "^5.6.2", + "@ethersproject/json-wallets": "^5.6.1", + "@ethersproject/keccak256": "^5.6.1", "@ethersproject/logger": "^5.6.0", "@ethersproject/properties": "^5.6.0", - "@ethersproject/random": "^5.6.0", - "@ethersproject/signing-key": "^5.6.0", - "@ethersproject/transactions": "^5.6.0", - "@ethersproject/wordlists": "^5.6.0" + "@ethersproject/random": "^5.6.1", + "@ethersproject/signing-key": "^5.6.2", + "@ethersproject/transactions": "^5.6.2", + "@ethersproject/wordlists": "^5.6.1" } }, "node_modules/@ethersproject/web": { - "version": "5.6.0", - "resolved": "https://registry.npmjs.org/@ethersproject/web/-/web-5.6.0.tgz", - "integrity": "sha512-G/XHj0hV1FxI2teHRfCGvfBUHFmU+YOSbCxlAMqJklxSa7QMiHFQfAxvwY2PFqgvdkxEKwRNr/eCjfAPEm2Ctg==", + "version": "5.6.1", + "resolved": "https://registry.npmjs.org/@ethersproject/web/-/web-5.6.1.tgz", + "integrity": "sha512-/vSyzaQlNXkO1WV+RneYKqCJwualcUdx/Z3gseVovZP0wIlOFcCE1hkRhKBH8ImKbGQbMl9EAAyJFrJu7V0aqA==", "funding": [ { "type": "individual", @@ -1524,17 +1514,17 @@ } ], "dependencies": { - "@ethersproject/base64": "^5.6.0", - "@ethersproject/bytes": "^5.6.0", + "@ethersproject/base64": "^5.6.1", + "@ethersproject/bytes": "^5.6.1", "@ethersproject/logger": "^5.6.0", "@ethersproject/properties": "^5.6.0", - "@ethersproject/strings": "^5.6.0" + "@ethersproject/strings": "^5.6.1" } }, "node_modules/@ethersproject/wordlists": { - "version": "5.6.0", - "resolved": "https://registry.npmjs.org/@ethersproject/wordlists/-/wordlists-5.6.0.tgz", - "integrity": "sha512-q0bxNBfIX3fUuAo9OmjlEYxP40IB8ABgb7HjEZCL5IKubzV3j30CWi2rqQbjTS2HfoyQbfINoKcTVWP4ejwR7Q==", + "version": "5.6.1", + "resolved": "https://registry.npmjs.org/@ethersproject/wordlists/-/wordlists-5.6.1.tgz", + "integrity": "sha512-wiPRgBpNbNwCQFoCr8bcWO8o5I810cqO6mkdtKfLKFlLxeCWcnzDi4Alu8iyNzlhYuS9npCwivMbRWF19dyblw==", "funding": [ { "type": "individual", @@ -1546,11 +1536,11 @@ } ], "dependencies": { - "@ethersproject/bytes": "^5.6.0", - "@ethersproject/hash": "^5.6.0", + "@ethersproject/bytes": "^5.6.1", + "@ethersproject/hash": "^5.6.1", "@ethersproject/logger": "^5.6.0", "@ethersproject/properties": "^5.6.0", - "@ethersproject/strings": "^5.6.0" + "@ethersproject/strings": "^5.6.1" } }, "node_modules/@gnosis.pm/mock-contract": { @@ -5475,9 +5465,9 @@ "integrity": "sha512-XpNj6GDQzdfW+r2Wnn7xiSAd7TM3jzkxGXBGTtWKuSXv1xUV+azxAm8jdWZN06QTQk+2N2XB9jRDkvbmQmcRtg==" }, "node_modules/bn.js": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-5.2.0.tgz", - "integrity": "sha512-D7iWRBvnZE8ecXiLj/9wbxH7Tk79fAh8IHaTNq1RWRixsS02W+5qS+iE9yq6RYl0asXx5tw0bLhmT5pIfbSquw==" + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-5.2.1.tgz", + "integrity": "sha512-eXRvHzWyYPBuB4NBy0cmYQjGitUrtqwbvlzP3G6VFnNRbsZQIxQ10PbKKHt8gZ/HW/D/747aDl+QkDqg3KQLMQ==" }, "node_modules/body-parser": { "version": "1.20.0", @@ -8924,9 +8914,9 @@ } }, "node_modules/ethers": { - "version": "5.6.7", - "resolved": "https://registry.npmjs.org/ethers/-/ethers-5.6.7.tgz", - "integrity": "sha512-Q8pmMraUENK0cY6cy6IvIe3e9xL/+4kBvxmUvLXg1O7Abob0c7XzWI76E29j5em/HxWMl5hYiSClmOMW3jJmdg==", + "version": "5.6.8", + "resolved": "https://registry.npmjs.org/ethers/-/ethers-5.6.8.tgz", + "integrity": "sha512-YxIGaltAOdvBFPZwIkyHnXbW40f1r8mHUgapW6dxkO+6t7H6wY8POUn0Kbxrd/N7I4hHxyi7YCddMAH/wmho2w==", "funding": [ { "type": "individual", @@ -8938,36 +8928,36 @@ } ], "dependencies": { - "@ethersproject/abi": "5.6.2", - "@ethersproject/abstract-provider": "5.6.0", - "@ethersproject/abstract-signer": "5.6.1", - "@ethersproject/address": "5.6.0", - "@ethersproject/base64": "5.6.0", - "@ethersproject/basex": "5.6.0", - "@ethersproject/bignumber": "5.6.1", + "@ethersproject/abi": "5.6.3", + "@ethersproject/abstract-provider": "5.6.1", + "@ethersproject/abstract-signer": "5.6.2", + "@ethersproject/address": "5.6.1", + "@ethersproject/base64": "5.6.1", + "@ethersproject/basex": "5.6.1", + "@ethersproject/bignumber": "5.6.2", "@ethersproject/bytes": "5.6.1", - "@ethersproject/constants": "5.6.0", - "@ethersproject/contracts": "5.6.1", - "@ethersproject/hash": "5.6.0", - "@ethersproject/hdnode": "5.6.1", - "@ethersproject/json-wallets": "5.6.0", - "@ethersproject/keccak256": "5.6.0", + "@ethersproject/constants": "5.6.1", + "@ethersproject/contracts": "5.6.2", + "@ethersproject/hash": "5.6.1", + "@ethersproject/hdnode": "5.6.2", + "@ethersproject/json-wallets": "5.6.1", + "@ethersproject/keccak256": "5.6.1", "@ethersproject/logger": "5.6.0", "@ethersproject/networks": "5.6.3", - "@ethersproject/pbkdf2": "5.6.0", + "@ethersproject/pbkdf2": "5.6.1", "@ethersproject/properties": "5.6.0", - "@ethersproject/providers": "5.6.7", - "@ethersproject/random": "5.6.0", - "@ethersproject/rlp": "5.6.0", - "@ethersproject/sha2": "5.6.0", - "@ethersproject/signing-key": "5.6.1", - "@ethersproject/solidity": "5.6.0", - "@ethersproject/strings": "5.6.0", - "@ethersproject/transactions": "5.6.1", - "@ethersproject/units": "5.6.0", - "@ethersproject/wallet": "5.6.1", - "@ethersproject/web": "5.6.0", - "@ethersproject/wordlists": "5.6.0" + "@ethersproject/providers": "5.6.8", + "@ethersproject/random": "5.6.1", + "@ethersproject/rlp": "5.6.1", + "@ethersproject/sha2": "5.6.1", + "@ethersproject/signing-key": "5.6.2", + "@ethersproject/solidity": "5.6.1", + "@ethersproject/strings": "5.6.1", + "@ethersproject/transactions": "5.6.2", + "@ethersproject/units": "5.6.1", + "@ethersproject/wallet": "5.6.2", + "@ethersproject/web": "5.6.1", + "@ethersproject/wordlists": "5.6.1" } }, "node_modules/ethjs-abi": { @@ -20581,9 +20571,9 @@ } }, "node_modules/lint-staged": { - "version": "12.4.1", - "resolved": "https://registry.npmjs.org/lint-staged/-/lint-staged-12.4.1.tgz", - "integrity": "sha512-PTXgzpflrQ+pODQTG116QNB+Q6uUTDg5B5HqGvNhoQSGt8Qy+MA/6zSnR8n38+sxP5TapzeQGTvoKni0KRS8Vg==", + "version": "12.4.2", + "resolved": "https://registry.npmjs.org/lint-staged/-/lint-staged-12.4.2.tgz", + "integrity": "sha512-JAJGIzY/OioIUtrRePr8go6qUxij//mL+RGGoFKU3VWQRtIHgWoHizSqH0QVn2OwrbXS9Q6CICQjfj+E5qvrXg==", "dev": true, "dependencies": { "cli-truncate": "^3.1.0", @@ -27514,9 +27504,9 @@ } }, "node_modules/typescript": { - "version": "4.6.4", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.6.4.tgz", - "integrity": "sha512-9ia/jWHIEbo49HfjrLGfKbZSuWo9iTMwXO+Ca3pRsSpbsMbc7/IU8NKdCZVRRBafVPGnoJeFL76ZOAA84I9fEg==", + "version": "4.7.2", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.7.2.tgz", + "integrity": "sha512-Mamb1iX2FDUpcTRzltPxgWMKy3fhg0TN378ylbktPGPK/99KbDtMQ4W1hwgsbPAsG3a0xKa1vmw4VKZQbkvz5A==", "bin": { "tsc": "bin/tsc", "tsserver": "bin/tsserver" @@ -29398,91 +29388,84 @@ } }, "@ethersproject/abi": { - "version": "5.6.2", - "resolved": "https://registry.npmjs.org/@ethersproject/abi/-/abi-5.6.2.tgz", - "integrity": "sha512-40Ixjhy+YzFtnvzIqFU13FW9hd1gMoLa3cJfSDnfnL4o8EnEG1qLiV8sNJo3sHYi9UYMfFeRuZ7kv5+vhzU7gQ==", - "requires": { - "@ethersproject/address": "^5.6.0", - "@ethersproject/bignumber": "^5.6.0", - "@ethersproject/bytes": "^5.6.0", - "@ethersproject/constants": "^5.6.0", - "@ethersproject/hash": "^5.6.0", - "@ethersproject/keccak256": "^5.6.0", + "version": "5.6.3", + "resolved": "https://registry.npmjs.org/@ethersproject/abi/-/abi-5.6.3.tgz", + "integrity": "sha512-CxKTdoZY4zDJLWXG6HzNH6znWK0M79WzzxHegDoecE3+K32pzfHOzuXg2/oGSTecZynFgpkjYXNPOqXVJlqClw==", + "requires": { + "@ethersproject/address": "^5.6.1", + "@ethersproject/bignumber": "^5.6.2", + "@ethersproject/bytes": "^5.6.1", + "@ethersproject/constants": "^5.6.1", + "@ethersproject/hash": "^5.6.1", + "@ethersproject/keccak256": "^5.6.1", "@ethersproject/logger": "^5.6.0", "@ethersproject/properties": "^5.6.0", - "@ethersproject/strings": "^5.6.0" + "@ethersproject/strings": "^5.6.1" } }, "@ethersproject/abstract-provider": { - "version": "5.6.0", - "resolved": "https://registry.npmjs.org/@ethersproject/abstract-provider/-/abstract-provider-5.6.0.tgz", - "integrity": "sha512-oPMFlKLN+g+y7a79cLK3WiLcjWFnZQtXWgnLAbHZcN3s7L4v90UHpTOrLk+m3yr0gt+/h9STTM6zrr7PM8uoRw==", + "version": "5.6.1", + "resolved": "https://registry.npmjs.org/@ethersproject/abstract-provider/-/abstract-provider-5.6.1.tgz", + "integrity": "sha512-BxlIgogYJtp1FS8Muvj8YfdClk3unZH0vRMVX791Z9INBNT/kuACZ9GzaY1Y4yFq+YSy6/w4gzj3HCRKrK9hsQ==", "requires": { - "@ethersproject/bignumber": "^5.6.0", - "@ethersproject/bytes": "^5.6.0", + "@ethersproject/bignumber": "^5.6.2", + "@ethersproject/bytes": "^5.6.1", "@ethersproject/logger": "^5.6.0", - "@ethersproject/networks": "^5.6.0", + "@ethersproject/networks": "^5.6.3", "@ethersproject/properties": "^5.6.0", - "@ethersproject/transactions": "^5.6.0", - "@ethersproject/web": "^5.6.0" + "@ethersproject/transactions": "^5.6.2", + "@ethersproject/web": "^5.6.1" } }, "@ethersproject/abstract-signer": { - "version": "5.6.1", - "resolved": "https://registry.npmjs.org/@ethersproject/abstract-signer/-/abstract-signer-5.6.1.tgz", - "integrity": "sha512-xhSLo6y0nGJS7NxfvOSzCaWKvWb1TLT7dQ0nnpHZrDnC67xfnWm9NXflTMFPUXXMtjr33CdV0kWDEmnbrQZ74Q==", + "version": "5.6.2", + "resolved": "https://registry.npmjs.org/@ethersproject/abstract-signer/-/abstract-signer-5.6.2.tgz", + "integrity": "sha512-n1r6lttFBG0t2vNiI3HoWaS/KdOt8xyDjzlP2cuevlWLG6EX0OwcKLyG/Kp/cuwNxdy/ous+R/DEMdTUwWQIjQ==", "requires": { - "@ethersproject/abstract-provider": "^5.6.0", - "@ethersproject/bignumber": "^5.6.0", - "@ethersproject/bytes": "^5.6.0", + "@ethersproject/abstract-provider": "^5.6.1", + "@ethersproject/bignumber": "^5.6.2", + "@ethersproject/bytes": "^5.6.1", "@ethersproject/logger": "^5.6.0", "@ethersproject/properties": "^5.6.0" } }, "@ethersproject/address": { - "version": "5.6.0", - "resolved": "https://registry.npmjs.org/@ethersproject/address/-/address-5.6.0.tgz", - "integrity": "sha512-6nvhYXjbXsHPS+30sHZ+U4VMagFC/9zAk6Gd/h3S21YW4+yfb0WfRtaAIZ4kfM4rrVwqiy284LP0GtL5HXGLxQ==", + "version": "5.6.1", + "resolved": "https://registry.npmjs.org/@ethersproject/address/-/address-5.6.1.tgz", + "integrity": "sha512-uOgF0kS5MJv9ZvCz7x6T2EXJSzotiybApn4XlOgoTX0xdtyVIJ7pF+6cGPxiEq/dpBiTfMiw7Yc81JcwhSYA0Q==", "requires": { - "@ethersproject/bignumber": "^5.6.0", - "@ethersproject/bytes": "^5.6.0", - "@ethersproject/keccak256": "^5.6.0", + "@ethersproject/bignumber": "^5.6.2", + "@ethersproject/bytes": "^5.6.1", + "@ethersproject/keccak256": "^5.6.1", "@ethersproject/logger": "^5.6.0", - "@ethersproject/rlp": "^5.6.0" + "@ethersproject/rlp": "^5.6.1" } }, "@ethersproject/base64": { - "version": "5.6.0", - "resolved": "https://registry.npmjs.org/@ethersproject/base64/-/base64-5.6.0.tgz", - "integrity": "sha512-2Neq8wxJ9xHxCF9TUgmKeSh9BXJ6OAxWfeGWvbauPh8FuHEjamgHilllx8KkSd5ErxyHIX7Xv3Fkcud2kY9ezw==", + "version": "5.6.1", + "resolved": "https://registry.npmjs.org/@ethersproject/base64/-/base64-5.6.1.tgz", + "integrity": "sha512-qB76rjop6a0RIYYMiB4Eh/8n+Hxu2NIZm8S/Q7kNo5pmZfXhHGHmS4MinUainiBC54SCyRnwzL+KZjj8zbsSsw==", "requires": { - "@ethersproject/bytes": "^5.6.0" + "@ethersproject/bytes": "^5.6.1" } }, "@ethersproject/basex": { - "version": "5.6.0", - "resolved": "https://registry.npmjs.org/@ethersproject/basex/-/basex-5.6.0.tgz", - "integrity": "sha512-qN4T+hQd/Md32MoJpc69rOwLYRUXwjTlhHDIeUkUmiN/JyWkkLLMoG0TqvSQKNqZOMgN5stbUYN6ILC+eD7MEQ==", + "version": "5.6.1", + "resolved": "https://registry.npmjs.org/@ethersproject/basex/-/basex-5.6.1.tgz", + "integrity": "sha512-a52MkVz4vuBXR06nvflPMotld1FJWSj2QT0985v7P/emPZO00PucFAkbcmq2vpVU7Ts7umKiSI6SppiLykVWsA==", "requires": { - "@ethersproject/bytes": "^5.6.0", + "@ethersproject/bytes": "^5.6.1", "@ethersproject/properties": "^5.6.0" } }, "@ethersproject/bignumber": { - "version": "5.6.1", - "resolved": "https://registry.npmjs.org/@ethersproject/bignumber/-/bignumber-5.6.1.tgz", - "integrity": "sha512-UtMeZ3GaUuF9sx2u9nPZiPP3ULcAFmXyvynR7oHl/tPrM+vldZh7ocMsoa1PqKYGnQnqUZJoqxZnGN6J0qdipA==", + "version": "5.6.2", + "resolved": "https://registry.npmjs.org/@ethersproject/bignumber/-/bignumber-5.6.2.tgz", + "integrity": "sha512-v7+EEUbhGqT3XJ9LMPsKvXYHFc8eHxTowFCG/HgJErmq4XHJ2WR7aeyICg3uTOAQ7Icn0GFHAohXEhxQHq4Ubw==", "requires": { - "@ethersproject/bytes": "^5.6.0", + "@ethersproject/bytes": "^5.6.1", "@ethersproject/logger": "^5.6.0", - "bn.js": "^4.11.9" - }, - "dependencies": { - "bn.js": { - "version": "4.12.0", - "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.12.0.tgz", - "integrity": "sha512-c98Bf3tPniI+scsdk237ku1Dc3ujXQTSgyiPUDEOe7tRkhrqridvh8klBv0HCEso1OLOYcHuCv/cS6DNxKH+ZA==" - } + "bn.js": "^5.2.1" } }, "@ethersproject/bytes": { @@ -29494,28 +29477,28 @@ } }, "@ethersproject/constants": { - "version": "5.6.0", - "resolved": "https://registry.npmjs.org/@ethersproject/constants/-/constants-5.6.0.tgz", - "integrity": "sha512-SrdaJx2bK0WQl23nSpV/b1aq293Lh0sUaZT/yYKPDKn4tlAbkH96SPJwIhwSwTsoQQZxuh1jnqsKwyymoiBdWA==", + "version": "5.6.1", + "resolved": "https://registry.npmjs.org/@ethersproject/constants/-/constants-5.6.1.tgz", + "integrity": "sha512-QSq9WVnZbxXYFftrjSjZDUshp6/eKp6qrtdBtUCm0QxCV5z1fG/w3kdlcsjMCQuQHUnAclKoK7XpXMezhRDOLg==", "requires": { - "@ethersproject/bignumber": "^5.6.0" + "@ethersproject/bignumber": "^5.6.2" } }, "@ethersproject/contracts": { - "version": "5.6.1", - "resolved": "https://registry.npmjs.org/@ethersproject/contracts/-/contracts-5.6.1.tgz", - "integrity": "sha512-0fpBBDoPqJMsutE6sNjg6pvCJaIcl7tliMQTMRcoUWDACfjO68CpKOJBlsEhEhmzdnu/41KbrfAeg+sB3y35MQ==", - "requires": { - "@ethersproject/abi": "^5.6.0", - "@ethersproject/abstract-provider": "^5.6.0", - "@ethersproject/abstract-signer": "^5.6.0", - "@ethersproject/address": "^5.6.0", - "@ethersproject/bignumber": "^5.6.0", - "@ethersproject/bytes": "^5.6.0", - "@ethersproject/constants": "^5.6.0", + "version": "5.6.2", + "resolved": "https://registry.npmjs.org/@ethersproject/contracts/-/contracts-5.6.2.tgz", + "integrity": "sha512-hguUA57BIKi6WY0kHvZp6PwPlWF87MCeB4B7Z7AbUpTxfFXFdn/3b0GmjZPagIHS+3yhcBJDnuEfU4Xz+Ks/8g==", + "requires": { + "@ethersproject/abi": "^5.6.3", + "@ethersproject/abstract-provider": "^5.6.1", + "@ethersproject/abstract-signer": "^5.6.2", + "@ethersproject/address": "^5.6.1", + "@ethersproject/bignumber": "^5.6.2", + "@ethersproject/bytes": "^5.6.1", + "@ethersproject/constants": "^5.6.1", "@ethersproject/logger": "^5.6.0", "@ethersproject/properties": "^5.6.0", - "@ethersproject/transactions": "^5.6.0" + "@ethersproject/transactions": "^5.6.2" } }, "@ethersproject/hardware-wallets": { @@ -29532,55 +29515,55 @@ } }, "@ethersproject/hash": { - "version": "5.6.0", - "resolved": "https://registry.npmjs.org/@ethersproject/hash/-/hash-5.6.0.tgz", - "integrity": "sha512-fFd+k9gtczqlr0/BruWLAu7UAOas1uRRJvOR84uDf4lNZ+bTkGl366qvniUZHKtlqxBRU65MkOobkmvmpHU+jA==", - "requires": { - "@ethersproject/abstract-signer": "^5.6.0", - "@ethersproject/address": "^5.6.0", - "@ethersproject/bignumber": "^5.6.0", - "@ethersproject/bytes": "^5.6.0", - "@ethersproject/keccak256": "^5.6.0", + "version": "5.6.1", + "resolved": "https://registry.npmjs.org/@ethersproject/hash/-/hash-5.6.1.tgz", + "integrity": "sha512-L1xAHurbaxG8VVul4ankNX5HgQ8PNCTrnVXEiFnE9xoRnaUcgfD12tZINtDinSllxPLCtGwguQxJ5E6keE84pA==", + "requires": { + "@ethersproject/abstract-signer": "^5.6.2", + "@ethersproject/address": "^5.6.1", + "@ethersproject/bignumber": "^5.6.2", + "@ethersproject/bytes": "^5.6.1", + "@ethersproject/keccak256": "^5.6.1", "@ethersproject/logger": "^5.6.0", "@ethersproject/properties": "^5.6.0", - "@ethersproject/strings": "^5.6.0" + "@ethersproject/strings": "^5.6.1" } }, "@ethersproject/hdnode": { - "version": "5.6.1", - "resolved": "https://registry.npmjs.org/@ethersproject/hdnode/-/hdnode-5.6.1.tgz", - "integrity": "sha512-6IuYDmbH5Bv/WH/A2cUd0FjNr4qTLAvyHAECiFZhNZp69pPvU7qIDwJ7CU7VAkwm4IVBzqdYy9mpMAGhQdwCDA==", + "version": "5.6.2", + "resolved": "https://registry.npmjs.org/@ethersproject/hdnode/-/hdnode-5.6.2.tgz", + "integrity": "sha512-tERxW8Ccf9CxW2db3WsN01Qao3wFeRsfYY9TCuhmG0xNpl2IO8wgXU3HtWIZ49gUWPggRy4Yg5axU0ACaEKf1Q==", "requires": { - "@ethersproject/abstract-signer": "^5.6.0", - "@ethersproject/basex": "^5.6.0", - "@ethersproject/bignumber": "^5.6.0", - "@ethersproject/bytes": "^5.6.0", + "@ethersproject/abstract-signer": "^5.6.2", + "@ethersproject/basex": "^5.6.1", + "@ethersproject/bignumber": "^5.6.2", + "@ethersproject/bytes": "^5.6.1", "@ethersproject/logger": "^5.6.0", - "@ethersproject/pbkdf2": "^5.6.0", + "@ethersproject/pbkdf2": "^5.6.1", "@ethersproject/properties": "^5.6.0", - "@ethersproject/sha2": "^5.6.0", - "@ethersproject/signing-key": "^5.6.0", - "@ethersproject/strings": "^5.6.0", - "@ethersproject/transactions": "^5.6.0", - "@ethersproject/wordlists": "^5.6.0" + "@ethersproject/sha2": "^5.6.1", + "@ethersproject/signing-key": "^5.6.2", + "@ethersproject/strings": "^5.6.1", + "@ethersproject/transactions": "^5.6.2", + "@ethersproject/wordlists": "^5.6.1" } }, "@ethersproject/json-wallets": { - "version": "5.6.0", - "resolved": "https://registry.npmjs.org/@ethersproject/json-wallets/-/json-wallets-5.6.0.tgz", - "integrity": "sha512-fmh86jViB9r0ibWXTQipxpAGMiuxoqUf78oqJDlCAJXgnJF024hOOX7qVgqsjtbeoxmcLwpPsXNU0WEe/16qPQ==", - "requires": { - "@ethersproject/abstract-signer": "^5.6.0", - "@ethersproject/address": "^5.6.0", - "@ethersproject/bytes": "^5.6.0", - "@ethersproject/hdnode": "^5.6.0", - "@ethersproject/keccak256": "^5.6.0", + "version": "5.6.1", + "resolved": "https://registry.npmjs.org/@ethersproject/json-wallets/-/json-wallets-5.6.1.tgz", + "integrity": "sha512-KfyJ6Zwz3kGeX25nLihPwZYlDqamO6pfGKNnVMWWfEVVp42lTfCZVXXy5Ie8IZTN0HKwAngpIPi7gk4IJzgmqQ==", + "requires": { + "@ethersproject/abstract-signer": "^5.6.2", + "@ethersproject/address": "^5.6.1", + "@ethersproject/bytes": "^5.6.1", + "@ethersproject/hdnode": "^5.6.2", + "@ethersproject/keccak256": "^5.6.1", "@ethersproject/logger": "^5.6.0", - "@ethersproject/pbkdf2": "^5.6.0", + "@ethersproject/pbkdf2": "^5.6.1", "@ethersproject/properties": "^5.6.0", - "@ethersproject/random": "^5.6.0", - "@ethersproject/strings": "^5.6.0", - "@ethersproject/transactions": "^5.6.0", + "@ethersproject/random": "^5.6.1", + "@ethersproject/strings": "^5.6.1", + "@ethersproject/transactions": "^5.6.2", "aes-js": "3.0.0", "scrypt-js": "3.0.1" }, @@ -29593,11 +29576,11 @@ } }, "@ethersproject/keccak256": { - "version": "5.6.0", - "resolved": "https://registry.npmjs.org/@ethersproject/keccak256/-/keccak256-5.6.0.tgz", - "integrity": "sha512-tk56BJ96mdj/ksi7HWZVWGjCq0WVl/QvfhFQNeL8fxhBlGoP+L80uDCiQcpJPd+2XxkivS3lwRm3E0CXTfol0w==", + "version": "5.6.1", + "resolved": "https://registry.npmjs.org/@ethersproject/keccak256/-/keccak256-5.6.1.tgz", + "integrity": "sha512-bB7DQHCTRDooZZdL3lk9wpL0+XuG3XLGHLh3cePnybsO3V0rdCAOQGpn/0R3aODmnTOOkCATJiD2hnL+5bwthA==", "requires": { - "@ethersproject/bytes": "^5.6.0", + "@ethersproject/bytes": "^5.6.1", "js-sha3": "0.8.0" } }, @@ -29615,12 +29598,12 @@ } }, "@ethersproject/pbkdf2": { - "version": "5.6.0", - "resolved": "https://registry.npmjs.org/@ethersproject/pbkdf2/-/pbkdf2-5.6.0.tgz", - "integrity": "sha512-Wu1AxTgJo3T3H6MIu/eejLFok9TYoSdgwRr5oGY1LTLfmGesDoSx05pemsbrPT2gG4cQME+baTSCp5sEo2erZQ==", + "version": "5.6.1", + "resolved": "https://registry.npmjs.org/@ethersproject/pbkdf2/-/pbkdf2-5.6.1.tgz", + "integrity": "sha512-k4gRQ+D93zDRPNUfmduNKq065uadC2YjMP/CqwwX5qG6R05f47boq6pLZtV/RnC4NZAYOPH1Cyo54q0c9sshRQ==", "requires": { - "@ethersproject/bytes": "^5.6.0", - "@ethersproject/sha2": "^5.6.0" + "@ethersproject/bytes": "^5.6.1", + "@ethersproject/sha2": "^5.6.1" } }, "@ethersproject/properties": { @@ -29632,173 +29615,166 @@ } }, "@ethersproject/providers": { - "version": "5.6.7", - "resolved": "https://registry.npmjs.org/@ethersproject/providers/-/providers-5.6.7.tgz", - "integrity": "sha512-QG7KLxfYk0FA0ycWATKMM8UzMOfOvchtkN89nNORlPqqhX5zatdamJ506dh5ECk+ybcnCkeVOdStlzrOMkkGOA==", - "requires": { - "@ethersproject/abstract-provider": "^5.6.0", - "@ethersproject/abstract-signer": "^5.6.0", - "@ethersproject/address": "^5.6.0", - "@ethersproject/base64": "^5.6.0", - "@ethersproject/basex": "^5.6.0", - "@ethersproject/bignumber": "^5.6.0", - "@ethersproject/bytes": "^5.6.0", - "@ethersproject/constants": "^5.6.0", - "@ethersproject/hash": "^5.6.0", + "version": "5.6.8", + "resolved": "https://registry.npmjs.org/@ethersproject/providers/-/providers-5.6.8.tgz", + "integrity": "sha512-Wf+CseT/iOJjrGtAOf3ck9zS7AgPmr2fZ3N97r4+YXN3mBePTG2/bJ8DApl9mVwYL+RpYbNxMEkEp4mPGdwG/w==", + "requires": { + "@ethersproject/abstract-provider": "^5.6.1", + "@ethersproject/abstract-signer": "^5.6.2", + "@ethersproject/address": "^5.6.1", + "@ethersproject/base64": "^5.6.1", + "@ethersproject/basex": "^5.6.1", + "@ethersproject/bignumber": "^5.6.2", + "@ethersproject/bytes": "^5.6.1", + "@ethersproject/constants": "^5.6.1", + "@ethersproject/hash": "^5.6.1", "@ethersproject/logger": "^5.6.0", - "@ethersproject/networks": "^5.6.0", + "@ethersproject/networks": "^5.6.3", "@ethersproject/properties": "^5.6.0", - "@ethersproject/random": "^5.6.0", - "@ethersproject/rlp": "^5.6.0", - "@ethersproject/sha2": "^5.6.0", - "@ethersproject/strings": "^5.6.0", - "@ethersproject/transactions": "^5.6.0", - "@ethersproject/web": "^5.6.0", + "@ethersproject/random": "^5.6.1", + "@ethersproject/rlp": "^5.6.1", + "@ethersproject/sha2": "^5.6.1", + "@ethersproject/strings": "^5.6.1", + "@ethersproject/transactions": "^5.6.2", + "@ethersproject/web": "^5.6.1", "bech32": "1.1.4", "ws": "7.4.6" } }, "@ethersproject/random": { - "version": "5.6.0", - "resolved": "https://registry.npmjs.org/@ethersproject/random/-/random-5.6.0.tgz", - "integrity": "sha512-si0PLcLjq+NG/XHSZz90asNf+YfKEqJGVdxoEkSukzbnBgC8rydbgbUgBbBGLeHN4kAJwUFEKsu3sCXT93YMsw==", + "version": "5.6.1", + "resolved": "https://registry.npmjs.org/@ethersproject/random/-/random-5.6.1.tgz", + "integrity": "sha512-/wtPNHwbmng+5yi3fkipA8YBT59DdkGRoC2vWk09Dci/q5DlgnMkhIycjHlavrvrjJBkFjO/ueLyT+aUDfc4lA==", "requires": { - "@ethersproject/bytes": "^5.6.0", + "@ethersproject/bytes": "^5.6.1", "@ethersproject/logger": "^5.6.0" } }, "@ethersproject/rlp": { - "version": "5.6.0", - "resolved": "https://registry.npmjs.org/@ethersproject/rlp/-/rlp-5.6.0.tgz", - "integrity": "sha512-dz9WR1xpcTL+9DtOT/aDO+YyxSSdO8YIS0jyZwHHSlAmnxA6cKU3TrTd4Xc/bHayctxTgGLYNuVVoiXE4tTq1g==", + "version": "5.6.1", + "resolved": "https://registry.npmjs.org/@ethersproject/rlp/-/rlp-5.6.1.tgz", + "integrity": "sha512-uYjmcZx+DKlFUk7a5/W9aQVaoEC7+1MOBgNtvNg13+RnuUwT4F0zTovC0tmay5SmRslb29V1B7Y5KCri46WhuQ==", "requires": { - "@ethersproject/bytes": "^5.6.0", + "@ethersproject/bytes": "^5.6.1", "@ethersproject/logger": "^5.6.0" } }, "@ethersproject/sha2": { - "version": "5.6.0", - "resolved": "https://registry.npmjs.org/@ethersproject/sha2/-/sha2-5.6.0.tgz", - "integrity": "sha512-1tNWCPFLu1n3JM9t4/kytz35DkuF9MxqkGGEHNauEbaARdm2fafnOyw1s0tIQDPKF/7bkP1u3dbrmjpn5CelyA==", + "version": "5.6.1", + "resolved": "https://registry.npmjs.org/@ethersproject/sha2/-/sha2-5.6.1.tgz", + "integrity": "sha512-5K2GyqcW7G4Yo3uenHegbXRPDgARpWUiXc6RiF7b6i/HXUoWlb7uCARh7BAHg7/qT/Q5ydofNwiZcim9qpjB6g==", "requires": { - "@ethersproject/bytes": "^5.6.0", + "@ethersproject/bytes": "^5.6.1", "@ethersproject/logger": "^5.6.0", "hash.js": "1.1.7" } }, "@ethersproject/signing-key": { - "version": "5.6.1", - "resolved": "https://registry.npmjs.org/@ethersproject/signing-key/-/signing-key-5.6.1.tgz", - "integrity": "sha512-XvqQ20DH0D+bS3qlrrgh+axRMth5kD1xuvqUQUTeezxUTXBOeR6hWz2/C6FBEu39FRytyybIWrYf7YLSAKr1LQ==", + "version": "5.6.2", + "resolved": "https://registry.npmjs.org/@ethersproject/signing-key/-/signing-key-5.6.2.tgz", + "integrity": "sha512-jVbu0RuP7EFpw82vHcL+GP35+KaNruVAZM90GxgQnGqB6crhBqW/ozBfFvdeImtmb4qPko0uxXjn8l9jpn0cwQ==", "requires": { - "@ethersproject/bytes": "^5.6.0", + "@ethersproject/bytes": "^5.6.1", "@ethersproject/logger": "^5.6.0", "@ethersproject/properties": "^5.6.0", - "bn.js": "^4.11.9", + "bn.js": "^5.2.1", "elliptic": "6.5.4", "hash.js": "1.1.7" - }, - "dependencies": { - "bn.js": { - "version": "4.12.0", - "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.12.0.tgz", - "integrity": "sha512-c98Bf3tPniI+scsdk237ku1Dc3ujXQTSgyiPUDEOe7tRkhrqridvh8klBv0HCEso1OLOYcHuCv/cS6DNxKH+ZA==" - } } }, "@ethersproject/solidity": { - "version": "5.6.0", - "resolved": "https://registry.npmjs.org/@ethersproject/solidity/-/solidity-5.6.0.tgz", - "integrity": "sha512-YwF52vTNd50kjDzqKaoNNbC/r9kMDPq3YzDWmsjFTRBcIF1y4JCQJ8gB30wsTfHbaxgxelI5BfxQSxD/PbJOww==", + "version": "5.6.1", + "resolved": "https://registry.npmjs.org/@ethersproject/solidity/-/solidity-5.6.1.tgz", + "integrity": "sha512-KWqVLkUUoLBfL1iwdzUVlkNqAUIFMpbbeH0rgCfKmJp0vFtY4AsaN91gHKo9ZZLkC4UOm3cI3BmMV4N53BOq4g==", "requires": { - "@ethersproject/bignumber": "^5.6.0", - "@ethersproject/bytes": "^5.6.0", - "@ethersproject/keccak256": "^5.6.0", + "@ethersproject/bignumber": "^5.6.2", + "@ethersproject/bytes": "^5.6.1", + "@ethersproject/keccak256": "^5.6.1", "@ethersproject/logger": "^5.6.0", - "@ethersproject/sha2": "^5.6.0", - "@ethersproject/strings": "^5.6.0" + "@ethersproject/sha2": "^5.6.1", + "@ethersproject/strings": "^5.6.1" } }, "@ethersproject/strings": { - "version": "5.6.0", - "resolved": "https://registry.npmjs.org/@ethersproject/strings/-/strings-5.6.0.tgz", - "integrity": "sha512-uv10vTtLTZqrJuqBZR862ZQjTIa724wGPWQqZrofaPI/kUsf53TBG0I0D+hQ1qyNtllbNzaW+PDPHHUI6/65Mg==", + "version": "5.6.1", + "resolved": "https://registry.npmjs.org/@ethersproject/strings/-/strings-5.6.1.tgz", + "integrity": "sha512-2X1Lgk6Jyfg26MUnsHiT456U9ijxKUybz8IM1Vih+NJxYtXhmvKBcHOmvGqpFSVJ0nQ4ZCoIViR8XlRw1v/+Cw==", "requires": { - "@ethersproject/bytes": "^5.6.0", - "@ethersproject/constants": "^5.6.0", + "@ethersproject/bytes": "^5.6.1", + "@ethersproject/constants": "^5.6.1", "@ethersproject/logger": "^5.6.0" } }, "@ethersproject/transactions": { - "version": "5.6.1", - "resolved": "https://registry.npmjs.org/@ethersproject/transactions/-/transactions-5.6.1.tgz", - "integrity": "sha512-oIAC7zBCDnjVlEn0KSG1udbqR7hP9FOurxIV/aG+erCdvdvi+QXEZRUtVP9+lu3WYUe8SMYhdAVwNJtD7dZMRw==", - "requires": { - "@ethersproject/address": "^5.6.0", - "@ethersproject/bignumber": "^5.6.0", - "@ethersproject/bytes": "^5.6.0", - "@ethersproject/constants": "^5.6.0", - "@ethersproject/keccak256": "^5.6.0", + "version": "5.6.2", + "resolved": "https://registry.npmjs.org/@ethersproject/transactions/-/transactions-5.6.2.tgz", + "integrity": "sha512-BuV63IRPHmJvthNkkt9G70Ullx6AcM+SDc+a8Aw/8Yew6YwT51TcBKEp1P4oOQ/bP25I18JJr7rcFRgFtU9B2Q==", + "requires": { + "@ethersproject/address": "^5.6.1", + "@ethersproject/bignumber": "^5.6.2", + "@ethersproject/bytes": "^5.6.1", + "@ethersproject/constants": "^5.6.1", + "@ethersproject/keccak256": "^5.6.1", "@ethersproject/logger": "^5.6.0", "@ethersproject/properties": "^5.6.0", - "@ethersproject/rlp": "^5.6.0", - "@ethersproject/signing-key": "^5.6.0" + "@ethersproject/rlp": "^5.6.1", + "@ethersproject/signing-key": "^5.6.2" } }, "@ethersproject/units": { - "version": "5.6.0", - "resolved": "https://registry.npmjs.org/@ethersproject/units/-/units-5.6.0.tgz", - "integrity": "sha512-tig9x0Qmh8qbo1w8/6tmtyrm/QQRviBh389EQ+d8fP4wDsBrJBf08oZfoiz1/uenKK9M78yAP4PoR7SsVoTjsw==", + "version": "5.6.1", + "resolved": "https://registry.npmjs.org/@ethersproject/units/-/units-5.6.1.tgz", + "integrity": "sha512-rEfSEvMQ7obcx3KWD5EWWx77gqv54K6BKiZzKxkQJqtpriVsICrktIQmKl8ReNToPeIYPnFHpXvKpi068YFZXw==", "requires": { - "@ethersproject/bignumber": "^5.6.0", - "@ethersproject/constants": "^5.6.0", + "@ethersproject/bignumber": "^5.6.2", + "@ethersproject/constants": "^5.6.1", "@ethersproject/logger": "^5.6.0" } }, "@ethersproject/wallet": { - "version": "5.6.1", - "resolved": "https://registry.npmjs.org/@ethersproject/wallet/-/wallet-5.6.1.tgz", - "integrity": "sha512-oXWoOslEWtwZiViIMlGVjeKDQz/tI7JF9UkyzN9jaGj8z7sXt2SyFMb0Ev6vSAqjIzrCrNrJ/+MkAhtKnGOfZw==", - "requires": { - "@ethersproject/abstract-provider": "^5.6.0", - "@ethersproject/abstract-signer": "^5.6.0", - "@ethersproject/address": "^5.6.0", - "@ethersproject/bignumber": "^5.6.0", - "@ethersproject/bytes": "^5.6.0", - "@ethersproject/hash": "^5.6.0", - "@ethersproject/hdnode": "^5.6.0", - "@ethersproject/json-wallets": "^5.6.0", - "@ethersproject/keccak256": "^5.6.0", + "version": "5.6.2", + "resolved": "https://registry.npmjs.org/@ethersproject/wallet/-/wallet-5.6.2.tgz", + "integrity": "sha512-lrgh0FDQPuOnHcF80Q3gHYsSUODp6aJLAdDmDV0xKCN/T7D99ta1jGVhulg3PY8wiXEngD0DfM0I2XKXlrqJfg==", + "requires": { + "@ethersproject/abstract-provider": "^5.6.1", + "@ethersproject/abstract-signer": "^5.6.2", + "@ethersproject/address": "^5.6.1", + "@ethersproject/bignumber": "^5.6.2", + "@ethersproject/bytes": "^5.6.1", + "@ethersproject/hash": "^5.6.1", + "@ethersproject/hdnode": "^5.6.2", + "@ethersproject/json-wallets": "^5.6.1", + "@ethersproject/keccak256": "^5.6.1", "@ethersproject/logger": "^5.6.0", "@ethersproject/properties": "^5.6.0", - "@ethersproject/random": "^5.6.0", - "@ethersproject/signing-key": "^5.6.0", - "@ethersproject/transactions": "^5.6.0", - "@ethersproject/wordlists": "^5.6.0" + "@ethersproject/random": "^5.6.1", + "@ethersproject/signing-key": "^5.6.2", + "@ethersproject/transactions": "^5.6.2", + "@ethersproject/wordlists": "^5.6.1" } }, "@ethersproject/web": { - "version": "5.6.0", - "resolved": "https://registry.npmjs.org/@ethersproject/web/-/web-5.6.0.tgz", - "integrity": "sha512-G/XHj0hV1FxI2teHRfCGvfBUHFmU+YOSbCxlAMqJklxSa7QMiHFQfAxvwY2PFqgvdkxEKwRNr/eCjfAPEm2Ctg==", + "version": "5.6.1", + "resolved": "https://registry.npmjs.org/@ethersproject/web/-/web-5.6.1.tgz", + "integrity": "sha512-/vSyzaQlNXkO1WV+RneYKqCJwualcUdx/Z3gseVovZP0wIlOFcCE1hkRhKBH8ImKbGQbMl9EAAyJFrJu7V0aqA==", "requires": { - "@ethersproject/base64": "^5.6.0", - "@ethersproject/bytes": "^5.6.0", + "@ethersproject/base64": "^5.6.1", + "@ethersproject/bytes": "^5.6.1", "@ethersproject/logger": "^5.6.0", "@ethersproject/properties": "^5.6.0", - "@ethersproject/strings": "^5.6.0" + "@ethersproject/strings": "^5.6.1" } }, "@ethersproject/wordlists": { - "version": "5.6.0", - "resolved": "https://registry.npmjs.org/@ethersproject/wordlists/-/wordlists-5.6.0.tgz", - "integrity": "sha512-q0bxNBfIX3fUuAo9OmjlEYxP40IB8ABgb7HjEZCL5IKubzV3j30CWi2rqQbjTS2HfoyQbfINoKcTVWP4ejwR7Q==", + "version": "5.6.1", + "resolved": "https://registry.npmjs.org/@ethersproject/wordlists/-/wordlists-5.6.1.tgz", + "integrity": "sha512-wiPRgBpNbNwCQFoCr8bcWO8o5I810cqO6mkdtKfLKFlLxeCWcnzDi4Alu8iyNzlhYuS9npCwivMbRWF19dyblw==", "requires": { - "@ethersproject/bytes": "^5.6.0", - "@ethersproject/hash": "^5.6.0", + "@ethersproject/bytes": "^5.6.1", + "@ethersproject/hash": "^5.6.1", "@ethersproject/logger": "^5.6.0", "@ethersproject/properties": "^5.6.0", - "@ethersproject/strings": "^5.6.0" + "@ethersproject/strings": "^5.6.1" } }, "@gnosis.pm/mock-contract": { @@ -33157,9 +33133,9 @@ "integrity": "sha512-XpNj6GDQzdfW+r2Wnn7xiSAd7TM3jzkxGXBGTtWKuSXv1xUV+azxAm8jdWZN06QTQk+2N2XB9jRDkvbmQmcRtg==" }, "bn.js": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-5.2.0.tgz", - "integrity": "sha512-D7iWRBvnZE8ecXiLj/9wbxH7Tk79fAh8IHaTNq1RWRixsS02W+5qS+iE9yq6RYl0asXx5tw0bLhmT5pIfbSquw==" + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-5.2.1.tgz", + "integrity": "sha512-eXRvHzWyYPBuB4NBy0cmYQjGitUrtqwbvlzP3G6VFnNRbsZQIxQ10PbKKHt8gZ/HW/D/747aDl+QkDqg3KQLMQ==" }, "body-parser": { "version": "1.20.0", @@ -35930,40 +35906,40 @@ } }, "ethers": { - "version": "5.6.7", - "resolved": "https://registry.npmjs.org/ethers/-/ethers-5.6.7.tgz", - "integrity": "sha512-Q8pmMraUENK0cY6cy6IvIe3e9xL/+4kBvxmUvLXg1O7Abob0c7XzWI76E29j5em/HxWMl5hYiSClmOMW3jJmdg==", - "requires": { - "@ethersproject/abi": "5.6.2", - "@ethersproject/abstract-provider": "5.6.0", - "@ethersproject/abstract-signer": "5.6.1", - "@ethersproject/address": "5.6.0", - "@ethersproject/base64": "5.6.0", - "@ethersproject/basex": "5.6.0", - "@ethersproject/bignumber": "5.6.1", + "version": "5.6.8", + "resolved": "https://registry.npmjs.org/ethers/-/ethers-5.6.8.tgz", + "integrity": "sha512-YxIGaltAOdvBFPZwIkyHnXbW40f1r8mHUgapW6dxkO+6t7H6wY8POUn0Kbxrd/N7I4hHxyi7YCddMAH/wmho2w==", + "requires": { + "@ethersproject/abi": "5.6.3", + "@ethersproject/abstract-provider": "5.6.1", + "@ethersproject/abstract-signer": "5.6.2", + "@ethersproject/address": "5.6.1", + "@ethersproject/base64": "5.6.1", + "@ethersproject/basex": "5.6.1", + "@ethersproject/bignumber": "5.6.2", "@ethersproject/bytes": "5.6.1", - "@ethersproject/constants": "5.6.0", - "@ethersproject/contracts": "5.6.1", - "@ethersproject/hash": "5.6.0", - "@ethersproject/hdnode": "5.6.1", - "@ethersproject/json-wallets": "5.6.0", - "@ethersproject/keccak256": "5.6.0", + "@ethersproject/constants": "5.6.1", + "@ethersproject/contracts": "5.6.2", + "@ethersproject/hash": "5.6.1", + "@ethersproject/hdnode": "5.6.2", + "@ethersproject/json-wallets": "5.6.1", + "@ethersproject/keccak256": "5.6.1", "@ethersproject/logger": "5.6.0", "@ethersproject/networks": "5.6.3", - "@ethersproject/pbkdf2": "5.6.0", + "@ethersproject/pbkdf2": "5.6.1", "@ethersproject/properties": "5.6.0", - "@ethersproject/providers": "5.6.7", - "@ethersproject/random": "5.6.0", - "@ethersproject/rlp": "5.6.0", - "@ethersproject/sha2": "5.6.0", - "@ethersproject/signing-key": "5.6.1", - "@ethersproject/solidity": "5.6.0", - "@ethersproject/strings": "5.6.0", - "@ethersproject/transactions": "5.6.1", - "@ethersproject/units": "5.6.0", - "@ethersproject/wallet": "5.6.1", - "@ethersproject/web": "5.6.0", - "@ethersproject/wordlists": "5.6.0" + "@ethersproject/providers": "5.6.8", + "@ethersproject/random": "5.6.1", + "@ethersproject/rlp": "5.6.1", + "@ethersproject/sha2": "5.6.1", + "@ethersproject/signing-key": "5.6.2", + "@ethersproject/solidity": "5.6.1", + "@ethersproject/strings": "5.6.1", + "@ethersproject/transactions": "5.6.2", + "@ethersproject/units": "5.6.1", + "@ethersproject/wallet": "5.6.2", + "@ethersproject/web": "5.6.1", + "@ethersproject/wordlists": "5.6.1" } }, "ethjs-abi": { @@ -44627,9 +44603,9 @@ "dev": true }, "lint-staged": { - "version": "12.4.1", - "resolved": "https://registry.npmjs.org/lint-staged/-/lint-staged-12.4.1.tgz", - "integrity": "sha512-PTXgzpflrQ+pODQTG116QNB+Q6uUTDg5B5HqGvNhoQSGt8Qy+MA/6zSnR8n38+sxP5TapzeQGTvoKni0KRS8Vg==", + "version": "12.4.2", + "resolved": "https://registry.npmjs.org/lint-staged/-/lint-staged-12.4.2.tgz", + "integrity": "sha512-JAJGIzY/OioIUtrRePr8go6qUxij//mL+RGGoFKU3VWQRtIHgWoHizSqH0QVn2OwrbXS9Q6CICQjfj+E5qvrXg==", "dev": true, "requires": { "cli-truncate": "^3.1.0", @@ -50012,9 +49988,9 @@ } }, "typescript": { - "version": "4.6.4", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.6.4.tgz", - "integrity": "sha512-9ia/jWHIEbo49HfjrLGfKbZSuWo9iTMwXO+Ca3pRsSpbsMbc7/IU8NKdCZVRRBafVPGnoJeFL76ZOAA84I9fEg==" + "version": "4.7.2", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.7.2.tgz", + "integrity": "sha512-Mamb1iX2FDUpcTRzltPxgWMKy3fhg0TN378ylbktPGPK/99KbDtMQ4W1hwgsbPAsG3a0xKa1vmw4VKZQbkvz5A==" }, "typical": { "version": "2.6.1", diff --git a/package.json b/package.json index efbf22527..a1876ba85 100644 --- a/package.json +++ b/package.json @@ -89,9 +89,9 @@ "eslint-plugin-import": "^2.26.0", "eslint-plugin-prettier": "^4.0.0", "ethereum-waffle": "^3.4.4", - "ethers": "^5.6.7", + "ethers": "^5.6.8", "husky": "^8.0.1", - "lint-staged": "^12.4.1", + "lint-staged": "^12.4.2", "mocha": "^10.0.0", "mocha-junit-reporter": "^2.0.2", "mocha-multi-reporters": "^1.5.1", @@ -103,7 +103,7 @@ "ts-node": "^10.7.0", "tsconfig-paths": "^4.0.0", "typechain": "^5.2.0", - "typescript": "^4.6.4" + "typescript": "^4.7.2" }, "lint-staged": { "*.{ts,tsx}": [ From 1bb62e5b4c58a7f744baf55f860d85e0e2bc382e Mon Sep 17 00:00:00 2001 From: thomas-waite Date: Wed, 25 May 2022 22:24:34 +0200 Subject: [PATCH 153/274] refactor: update permission mapping --- protocol-configuration/mainnetAddresses.ts | 20 ++++++++++++++++++++ protocol-configuration/permissions.ts | 8 +++++++- 2 files changed, 27 insertions(+), 1 deletion(-) diff --git a/protocol-configuration/mainnetAddresses.ts b/protocol-configuration/mainnetAddresses.ts index 17dae8d74..32a6621be 100644 --- a/protocol-configuration/mainnetAddresses.ts +++ b/protocol-configuration/mainnetAddresses.ts @@ -2115,6 +2115,26 @@ const MainnetAddresses: MainnetAddresses = { artifactName: 'RoleBastion', address: '0x8096314D9014EbB69Fc777ED3791DDE6FFbaFAed', category: AddressCategory.Governance + }, + feiDev1Deployer: { + artifactName: 'unknown', + address: '0x64c4Bffb220818F0f2ee6DAe7A2F17D92b359c5d', + category: AddressCategory.External + }, + feiDev2Deployer: { + artifactName: 'unknown', + address: '0xcE96fE7Eb7186E9F894DE7703B4DF8ea60E2dD77', + category: AddressCategory.External + }, + feiDev3Deployer: { + artifactName: 'unknown', + address: '0xE2388f22cf5e328C197D6530663809cc0408a510', + category: AddressCategory.External + }, + feiDev4Deployer: { + artifactName: 'unknown', + address: '0x5346b4ff3e924508d33d93f352d11e392a7a9d3b', + category: AddressCategory.External } }; diff --git a/protocol-configuration/permissions.ts b/protocol-configuration/permissions.ts index 98913d65b..85fa94c7a 100644 --- a/protocol-configuration/permissions.ts +++ b/protocol-configuration/permissions.ts @@ -45,7 +45,13 @@ export const permissions = { METAGOVERNANCE_TOKEN_STAKING: ['feiDAOTimelock', 'opsOptimisticTimelock'], METAGOVERNANCE_GAUGE_ADMIN: ['feiDAOTimelock', 'optimisticTimelock', 'tribalCouncilTimelock'], ROLE_ADMIN: ['feiDAOTimelock', 'tribalCouncilTimelock'], - POD_METADATA_REGISTER_ROLE: ['tribalCouncilSafe'], + POD_METADATA_REGISTER_ROLE: [ + 'tribalCouncilSafe', + 'feiDev1Deployer', + 'feiDev2Deployer', + 'feiDev3Deployer', + 'feiDev4Deployer' + ], FEI_MINT_ADMIN: ['feiDAOTimelock', 'tribalCouncilTimelock'], POD_VETO_ADMIN: ['nopeDAO'], POD_ADMIN: ['tribalCouncilTimelock', 'podFactory'], From 2b0a32041b1f5c4f06eb9bc6a49e5d0b9120305a Mon Sep 17 00:00:00 2001 From: Caleb Ditchfield Date: Wed, 25 May 2022 13:31:18 -0700 Subject: [PATCH 154/274] Review feedback --- contracts/utils/FuseFixer.sol | 53 ++++++++------ proposals/dao/repay_fuse_bad_debt.ts | 29 +++++++- proposals/description/repay_fuse_bad_debt.ts | 74 +++++++++++++++++++- 3 files changed, 132 insertions(+), 24 deletions(-) diff --git a/contracts/utils/FuseFixer.sol b/contracts/utils/FuseFixer.sol index cbd3370df..b89c6af89 100644 --- a/contracts/utils/FuseFixer.sol +++ b/contracts/utils/FuseFixer.sol @@ -1,8 +1,8 @@ // SPDX-License-Identifier: GPL-3.0-or-later pragma solidity ^0.8.0; -import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; -import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; +import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol"; +import {SafeERC20} from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; import {PCVDeposit} from "../pcv/PCVDeposit.sol"; import {CTokenFuse, CEtherFuse} from "../external/fuse/CToken.sol"; import {CoreRef} from "../refs/CoreRef.sol"; @@ -11,9 +11,9 @@ import {TribeRoles} from "../core/TribeRoles.sol"; /// @title base class for a Compound PCV Deposit /// @author Fei Protocol contract FuseFixer is PCVDeposit { - address constant DEBTOR = address(0x32075bAd9050d4767018084F0Cb87b3182D36C45); + address public constant DEBTOR = address(0x32075bAd9050d4767018084F0Cb87b3182D36C45); - address[] internal UNDERLYINGS = [ + address[] public UNDERLYINGS = [ address(0x0000000000000000000000000000000000000000), // ETH address(0x956F47F50A910163D8BF957Cf5846D573E7f87CA), // FEI address(0x853d955aCEf822Db058eb8505911ED77F175b99e), // FRAX @@ -26,7 +26,7 @@ contract FuseFixer is PCVDeposit { address(0xdAC17F958D2ee523a2206206994597C13D831ec7) // USDT ]; - address[] internal CTOKENS = [ + address[] public CTOKENS = [ address(0xd8553552f8868C1Ef160eEdf031cF0BCf9686945), // Pool 8: FEI address(0xbB025D470162CC5eA24daF7d4566064EE7f5F111), // Pool 8: ETH address(0x7e9cE3CAa9910cc048590801e64174957Ed41d43), // Pool 8: DAI @@ -64,7 +64,7 @@ contract FuseFixer is PCVDeposit { address(0xe92a3db67e4b6AC86114149F522644b34264f858) // Pool 156: ETH ]; - mapping(address => address[]) internal underlyingsToCTokens; + mapping(address => address[]) public underlyingsToCTokens; constructor(address core) CoreRef(core) { _buildCTokenMapping(); @@ -86,7 +86,7 @@ contract FuseFixer is PCVDeposit { } /// @dev Repay all debt - function repayAll() public onlyTribeRole(TribeRoles.PCV_GUARDIAN_ADMIN) { + function repayAll() public onlyTribeRole(TribeRoles.PCV_SAFE_MOVER_ROLE) { _repayETH(); // we skip index 0 because that's ETH @@ -99,7 +99,7 @@ contract FuseFixer is PCVDeposit { /// @notice reverts if the total bad debt is beyond the provided maximum /// @param underlying the asset to repay in /// @param maximum the maximum amount of underlying asset to repay - function repay(address underlying, uint256 maximum) public onlyTribeRole(TribeRoles.PCV_GUARDIAN_ADMIN) { + function repay(address underlying, uint256 maximum) public onlyTribeRole(TribeRoles.PCV_SAFE_MOVER_ROLE) { require(getTotalDebt(underlying) < maximum, "Total debt is greater than maximum"); if (underlying == address(0)) { @@ -109,6 +109,19 @@ contract FuseFixer is PCVDeposit { } } + /// @dev Gets the total debt for the provided underlying asset + /// @notice This is not a view function! Use .staticcall in ethers to get the return value + /// @param underlying the asset to get the debt for; pass in 0x0 for ETH + /// @return debt the total debt for the asset + function getTotalDebt(address underlying) public returns (uint256 debt) { + for (uint256 i = 0; i < CTOKENS.length; i++) { + CTokenFuse token = CTokenFuse(CTOKENS[i]); + if (token.underlying() == underlying) { + debt += CTokenFuse(CTOKENS[i]).borrowBalanceCurrent(DEBTOR); + } + } + } + /* Helper Functions */ // Creates mappings of underlyings to all applicable ctokens @@ -120,10 +133,14 @@ contract FuseFixer is PCVDeposit { } } + // Approves all underlyings to their respective ctokens function _approveCTokens() internal { - // UNDERLYINGS[0] == ETH, so we skip that one - for (uint256 i = 1; i < UNDERLYINGS.length; i++) { + for (uint256 i = 0; i < UNDERLYINGS.length; i++) { address underlying = UNDERLYINGS[i]; + + // Don't approve to the 0x0 address + if (underlying == address(0)) continue; + address[] memory ctokens = underlyingsToCTokens[underlying]; for (uint256 j = 0; j < ctokens.length; j++) { @@ -133,6 +150,7 @@ contract FuseFixer is PCVDeposit { } } + // Repays ETH to all cether-tokens function _repayETH() internal { address[] memory cEtherTokens = underlyingsToCTokens[address(0)]; @@ -145,6 +163,7 @@ contract FuseFixer is PCVDeposit { } } + // Repays the provided erc20 to the applicable ctokens function _repayERC20(address underlying) internal { address[] memory cERC20Tokens = underlyingsToCTokens[underlying]; @@ -155,23 +174,13 @@ contract FuseFixer is PCVDeposit { } } - // Must be non-view since this updates a state var - function getTotalDebt(address underlying) internal returns (uint256 debt) { - for (uint256 i = 0; i < CTOKENS.length; i++) { - CTokenFuse token = CTokenFuse(CTOKENS[i]); - if (token.underlying() == underlying) { - debt += CTokenFuse(CTOKENS[i]).borrowBalanceCurrent(DEBTOR); - } - } - } - /* Required Functions from PCVDeposit */ function deposit() external override { // no-op } - function withdraw(address to, uint256 amount) external { + function withdraw(address to, uint256 amount) external override { // no-op, use withdrawERC20 or withdrawETH } @@ -183,6 +192,8 @@ contract FuseFixer is PCVDeposit { return address(0); } + /* Make this contract able to receive ETH */ + receive() external payable {} fallback() external payable {} diff --git a/proposals/dao/repay_fuse_bad_debt.ts b/proposals/dao/repay_fuse_bad_debt.ts index 72941af16..9569c4db7 100644 --- a/proposals/dao/repay_fuse_bad_debt.ts +++ b/proposals/dao/repay_fuse_bad_debt.ts @@ -1,4 +1,4 @@ -import { CToken, CTokenFuse, FuseFixer__factory } from '@custom-types/contracts'; +import { CToken, CTokenFuse, FuseFixer__factory, FuseFixer } from '@custom-types/contracts'; import { DeployUpgradeFunc, NamedAddresses, @@ -8,7 +8,7 @@ import { } from '@custom-types/types'; import { getImpersonatedSigner } from '@test/helpers'; import { forceEth, forceEthMultiple, forceSpecificEth } from '@test/integration/setup/utils'; -import { utils } from 'ethers'; +import { BigNumber, utils } from 'ethers'; import hre from 'hardhat'; /* @@ -22,6 +22,7 @@ const fipNumber = 'repay_fuse_bad_debt'; // Change me! const deploy: DeployUpgradeFunc = async (deployAddress: string, addresses: NamedAddresses, logging: boolean) => { const fuseFixerFactory = (await hre.ethers.getContractFactory('FuseFixer')) as FuseFixer__factory; const fuseFixer = await fuseFixerFactory.deploy(addresses.core); + await fuseFixer.deployTransaction.wait(); return { fuseFixer }; }; @@ -159,6 +160,7 @@ const validate: ValidateUpgradeFunc = async (addresses, oldContracts, contracts, '0xe92a3db67e4b6AC86114149F522644b34264f858' // Pool 156: ETH ]; + // Verify that the borrowBalanceCurrent for the debtor is zero for each ctoken for (const ctokenAddress of ctokens) { const ctoken = await hre.ethers.getContractAt('CTokenFuse', ctokenAddress); const debt = await ctoken.callStatic.borrowBalanceCurrent(debtor); @@ -167,6 +169,29 @@ const validate: ValidateUpgradeFunc = async (addresses, oldContracts, contracts, throw new Error(`Debt for ctoken ${ctokenAddress} is greater than 0: ${debt}`); } } + + const fuseFixer = contracts.fuseFixer as FuseFixer; + + // Copied from smart contract + const underlyings = [ + '0x0000000000000000000000000000000000000000', // ETH + '0x956F47F50A910163D8BF957Cf5846D573E7f87CA', // FEI + '0x853d955aCEf822Db058eb8505911ED77F175b99e', // FRAX + '0x03ab458634910AaD20eF5f1C8ee96F1D6ac54919', // RAI + '0x6B175474E89094C44Da98b954EedeAC495271d0F', // DAI + '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48', // USDC + '0x5f98805A4E8be255a32880FDeC7F6728C6568bA0', // LUSD + '0x7f39C581F595B53c5cb19bD0b3f8dA6c935E2Ca0', // wstETH + '0xa693B19d2931d498c5B318dF961919BB4aee87a5', // USTw + '0xdAC17F958D2ee523a2206206994597C13D831ec7' // USDT + ]; + + for (const underlying of underlyings) { + const debt = await fuseFixer.callStatic.getTotalDebt(underlying); + if (!debt.eq(BigNumber.from(0))) { + throw new Error('Debt for ' + underlying + ' is not zero: ' + debt.toString()); + } + } }; export { deploy, setup, teardown, validate }; diff --git a/proposals/description/repay_fuse_bad_debt.ts b/proposals/description/repay_fuse_bad_debt.ts index 7ae3a1b6f..ca9e23d19 100644 --- a/proposals/description/repay_fuse_bad_debt.ts +++ b/proposals/description/repay_fuse_bad_debt.ts @@ -1,6 +1,6 @@ import { ProposalDescription } from '@custom-types/types'; -const fip_x: ProposalDescription = { +/*const fip_x: ProposalDescription = { title: 'Repay Fuse Bad Debt', commands: [ { @@ -14,4 +14,76 @@ const fip_x: ProposalDescription = { description: 'Repay all bad debt in Fuse pools 8, 18, 27, 127, 144, 146, 156' }; +export default fip_x;*/ + +const fip_x: ProposalDescription = { + title: 'Repay Fuse Bad Debt', + commands: [ + { + target: 'fuseFixer', + values: '0', + method: 'repay(address,uint256)', + arguments: ['0x0000000000000000000000000000000000000000', '6500000000000000000000'], + description: 'Repay ETH' + }, + { + target: 'fuseFixer', + values: '0', + method: 'repay(address,uint256)', + arguments: ['0x956F47F50A910163D8BF957Cf5846D573E7f87CA', '21000000000000000000000000'], + description: 'Repay FEI' + }, + { + target: 'fuseFixer', + values: '0', + method: 'repay(address,uint256)', + arguments: ['0x853d955aCEf822Db058eb8505911ED77F175b99e', '14000000000000000000000000'], + description: 'Repay FRAX' + }, + { + target: 'fuseFixer', + values: '0', + method: 'repay(address,uint256)', + arguments: ['0x03ab458634910AaD20eF5f1C8ee96F1D6ac54919', '32000000000000000000000'], + description: 'Repay RAI' + }, + { + target: 'fuseFixer', + values: '0', + method: 'repay(address,uint256)', + arguments: ['0x6B175474E89094C44Da98b954EedeAC495271d0F', '15000000000000000000000000'], + description: 'Repay DAI' + }, + { + target: 'fuseFixer', + values: '0', + method: 'repay(address,uint256)', + arguments: ['0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48', '11000000000000'], + description: 'Repay USDC' + }, + { + target: 'fuseFixer', + values: '0', + method: 'repay(address,uint256)', + arguments: ['0x5f98805A4E8be255a32880FDeC7F6728C6568bA0', '2000000000000000000000000'], + description: 'Repay LUSD' + }, + { + target: 'fuseFixer', + values: '0', + method: 'repay(address,uint256)', + arguments: ['0xa693B19d2931d498c5B318dF961919BB4aee87a5', '3000000000000'], + description: 'Repay USTw' + }, + { + target: 'fuseFixer', + values: '0', + method: 'repay(address,uint256)', + arguments: ['0xdAC17F958D2ee523a2206206994597C13D831ec7', '150000000000'], + description: 'Repay USDT' + } + ], + description: 'Repay all bad debt in Fuse pools 8, 18, 27, 127, 144, 146, 156' +}; + export default fip_x; From b3cffa3684f96ac158cecbd3c7a22f7fb3b31437 Mon Sep 17 00:00:00 2001 From: Caleb Ditchfield Date: Wed, 25 May 2022 14:49:18 -0700 Subject: [PATCH 155/274] setSafeAddress --- proposals/dao/repay_fuse_bad_debt.ts | 10 +++++++++- proposals/description/repay_fuse_bad_debt.ts | 7 +++++++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/proposals/dao/repay_fuse_bad_debt.ts b/proposals/dao/repay_fuse_bad_debt.ts index 9569c4db7..0e09605f6 100644 --- a/proposals/dao/repay_fuse_bad_debt.ts +++ b/proposals/dao/repay_fuse_bad_debt.ts @@ -1,4 +1,4 @@ -import { CToken, CTokenFuse, FuseFixer__factory, FuseFixer } from '@custom-types/contracts'; +import { CToken, CTokenFuse, FuseFixer__factory, FuseFixer, PCVGuardian } from '@custom-types/contracts'; import { DeployUpgradeFunc, NamedAddresses, @@ -192,6 +192,14 @@ const validate: ValidateUpgradeFunc = async (addresses, oldContracts, contracts, throw new Error('Debt for ' + underlying + ' is not zero: ' + debt.toString()); } } + + // Ensure that the fuse fixer is a safe address + const pcvGuardian = contracts.pcvGuardianNew as PCVGuardian; + const isSafeAddress = await pcvGuardian.isSafeAddress(fuseFixer.address); + + if (!isSafeAddress) { + throw new Error(`Fuse fixer (${fuseFixer.address}) is not a safe address`); + } }; export { deploy, setup, teardown, validate }; diff --git a/proposals/description/repay_fuse_bad_debt.ts b/proposals/description/repay_fuse_bad_debt.ts index ca9e23d19..77bf80b2c 100644 --- a/proposals/description/repay_fuse_bad_debt.ts +++ b/proposals/description/repay_fuse_bad_debt.ts @@ -19,6 +19,13 @@ export default fip_x;*/ const fip_x: ProposalDescription = { title: 'Repay Fuse Bad Debt', commands: [ + { + target: 'pcvGuardianNew', + values: '0', + method: 'setSafeAddress(address)', + arguments: ['{fuseFixer}'], + description: 'Set FuseFixer as a safe address' + }, { target: 'fuseFixer', values: '0', From d1f5ba493aea8740ccd863ab187bd212926e29b5 Mon Sep 17 00:00:00 2001 From: Caleb Date: Wed, 25 May 2022 17:18:35 -0700 Subject: [PATCH 156/274] small edits --- contracts/utils/FuseFixer.sol | 9 +++-- proposals/dao/repay_fuse_bad_debt.ts | 8 ++--- proposals/description/repay_fuse_bad_debt.ts | 36 ++++++++++---------- 3 files changed, 28 insertions(+), 25 deletions(-) diff --git a/contracts/utils/FuseFixer.sol b/contracts/utils/FuseFixer.sol index b89c6af89..d46ea64bf 100644 --- a/contracts/utils/FuseFixer.sol +++ b/contracts/utils/FuseFixer.sol @@ -8,7 +8,7 @@ import {CTokenFuse, CEtherFuse} from "../external/fuse/CToken.sol"; import {CoreRef} from "../refs/CoreRef.sol"; import {TribeRoles} from "../core/TribeRoles.sol"; -/// @title base class for a Compound PCV Deposit +/// @title Utility contract for repaying the bad debt in fuse /// @author Fei Protocol contract FuseFixer is PCVDeposit { address public constant DEBTOR = address(0x32075bAd9050d4767018084F0Cb87b3182D36C45); @@ -86,7 +86,7 @@ contract FuseFixer is PCVDeposit { } /// @dev Repay all debt - function repayAll() public onlyTribeRole(TribeRoles.PCV_SAFE_MOVER_ROLE) { + function repayAll() public hasAnyOfTwoRoles(TribeRoles.PCV_SAFE_MOVER_ROLE, TribeRoles.GUARDIAN) { _repayETH(); // we skip index 0 because that's ETH @@ -99,7 +99,10 @@ contract FuseFixer is PCVDeposit { /// @notice reverts if the total bad debt is beyond the provided maximum /// @param underlying the asset to repay in /// @param maximum the maximum amount of underlying asset to repay - function repay(address underlying, uint256 maximum) public onlyTribeRole(TribeRoles.PCV_SAFE_MOVER_ROLE) { + function repay(address underlying, uint256 maximum) + public + hasAnyOfTwoRoles(TribeRoles.PCV_SAFE_MOVER_ROLE, TribeRoles.GUARDIAN) + { require(getTotalDebt(underlying) < maximum, "Total debt is greater than maximum"); if (underlying == address(0)) { diff --git a/proposals/dao/repay_fuse_bad_debt.ts b/proposals/dao/repay_fuse_bad_debt.ts index 0e09605f6..8ed2bfde4 100644 --- a/proposals/dao/repay_fuse_bad_debt.ts +++ b/proposals/dao/repay_fuse_bad_debt.ts @@ -120,7 +120,7 @@ const teardown: TeardownUpgradeFunc = async (addresses, oldContracts, contracts, // Run any validations required on the fip using mocha or console logging // IE check balances, check state of contracts, etc. const validate: ValidateUpgradeFunc = async (addresses, oldContracts, contracts, logging) => { - const debtor = '0x32075bAd9050d4767018084F0Cb87b3182D36C45'; + /*const debtor = '0x32075bAd9050d4767018084F0Cb87b3182D36C45'; const ctokens = [ '0xd8553552f8868C1Ef160eEdf031cF0BCf9686945', // Pool 8: FEI @@ -191,14 +191,14 @@ const validate: ValidateUpgradeFunc = async (addresses, oldContracts, contracts, if (!debt.eq(BigNumber.from(0))) { throw new Error('Debt for ' + underlying + ' is not zero: ' + debt.toString()); } - } + }*/ // Ensure that the fuse fixer is a safe address const pcvGuardian = contracts.pcvGuardianNew as PCVGuardian; - const isSafeAddress = await pcvGuardian.isSafeAddress(fuseFixer.address); + const isSafeAddress = await pcvGuardian.isSafeAddress(contracts.fuseFixer.address); if (!isSafeAddress) { - throw new Error(`Fuse fixer (${fuseFixer.address}) is not a safe address`); + throw new Error(`Fuse fixer (${contracts.fuseFixer.address}) is not a safe address`); } }; diff --git a/proposals/description/repay_fuse_bad_debt.ts b/proposals/description/repay_fuse_bad_debt.ts index 77bf80b2c..4a58741bb 100644 --- a/proposals/description/repay_fuse_bad_debt.ts +++ b/proposals/description/repay_fuse_bad_debt.ts @@ -1,5 +1,21 @@ import { ProposalDescription } from '@custom-types/types'; +const fip_x: ProposalDescription = { + title: 'Repay Fuse Bad Debt', + commands: [ + { + target: 'pcvGuardianNew', + values: '0', + method: 'setSafeAddress(address)', + arguments: ['{fuseFixer}'], + description: 'Set FuseFixer as a safe address' + } + ], + description: 'Set FuseFixer as a safe address' +}; + +export default fip_x; + /*const fip_x: ProposalDescription = { title: 'Repay Fuse Bad Debt', commands: [ @@ -14,18 +30,7 @@ import { ProposalDescription } from '@custom-types/types'; description: 'Repay all bad debt in Fuse pools 8, 18, 27, 127, 144, 146, 156' }; -export default fip_x;*/ - -const fip_x: ProposalDescription = { - title: 'Repay Fuse Bad Debt', - commands: [ - { - target: 'pcvGuardianNew', - values: '0', - method: 'setSafeAddress(address)', - arguments: ['{fuseFixer}'], - description: 'Set FuseFixer as a safe address' - }, + /* { target: 'fuseFixer', values: '0', @@ -88,9 +93,4 @@ const fip_x: ProposalDescription = { method: 'repay(address,uint256)', arguments: ['0xdAC17F958D2ee523a2206206994597C13D831ec7', '150000000000'], description: 'Repay USDT' - } - ], - description: 'Repay all bad debt in Fuse pools 8, 18, 27, 127, 144, 146, 156' -}; - -export default fip_x; + }*/ From 774107e8a1675e447f14d1012aecc88e14264590 Mon Sep 17 00:00:00 2001 From: Caleb Date: Wed, 25 May 2022 18:50:49 -0700 Subject: [PATCH 157/274] deploy --- block.txt | 2 +- protocol-configuration/dependencies.ts | 4 +++ protocol-configuration/mainnetAddresses.ts | 5 +++ scripts/deploy/fuseFixer.ts | 39 ++++++++++++++++++++++ test/integration/proposals_config.ts | 2 +- 5 files changed, 50 insertions(+), 2 deletions(-) create mode 100644 scripts/deploy/fuseFixer.ts diff --git a/block.txt b/block.txt index db05b9212..129d70f2a 100644 --- a/block.txt +++ b/block.txt @@ -1 +1 @@ -14833003 +14845243 \ No newline at end of file diff --git a/protocol-configuration/dependencies.ts b/protocol-configuration/dependencies.ts index 69d380c88..64d6ff7fc 100644 --- a/protocol-configuration/dependencies.ts +++ b/protocol-configuration/dependencies.ts @@ -28,8 +28,12 @@ const dependencies: DependencyMap = { laTribuTribeTimelock: { contractDependencies: ['tribe'] }, + fuseFixer: { + contractDependencies: ['core'] + }, core: { contractDependencies: [ + 'fuseFixer', 'raiPriceBoundPSM', 'raiPCVDripController', 'collateralizationOracleGuardian', diff --git a/protocol-configuration/mainnetAddresses.ts b/protocol-configuration/mainnetAddresses.ts index 17dae8d74..1bf490776 100644 --- a/protocol-configuration/mainnetAddresses.ts +++ b/protocol-configuration/mainnetAddresses.ts @@ -536,6 +536,11 @@ const MainnetAddresses: MainnetAddresses = { address: '0x89DfBC12001b41985eFAbd7dFCae6a77B22E4Ec3', category: AddressCategory.PCV }, + fuseFixer: { + artifactName: 'FuseFixer', + address: '0xFE7547F583aAe1212e72e063Aac25057C06c4797', + category: AddressCategory.PCV + }, feiOATimelockWrapper: { artifactName: 'PCVDepositWrapper', address: '0x7Eb88140af813294aEDce981b6aC08fcd139d408', diff --git a/scripts/deploy/fuseFixer.ts b/scripts/deploy/fuseFixer.ts new file mode 100644 index 000000000..40ca526c4 --- /dev/null +++ b/scripts/deploy/fuseFixer.ts @@ -0,0 +1,39 @@ +import { DeployUpgradeFunc } from '@custom-types/types'; +import { ethers } from 'hardhat'; + +export const deploy: DeployUpgradeFunc = async (deployAddress: string, addresses, logging = false) => { + const core = '0x8d5ED43dCa8C2F7dFB20CF7b53CC7E593635d7b9'; + + if (!core) { + throw new Error('An environment variable contract address is not set'); + } + + const fuseFixerFactory = await ethers.getContractFactory('FuseFixer'); + const fuseFixer = await fuseFixerFactory.deploy(core); + await fuseFixer.deployTransaction.wait(); + + console.log('FuseFixer deployed to: ', fuseFixer.address); + + // Copied from smart contract + const underlyings = [ + '0x0000000000000000000000000000000000000000', // ETH + '0x956F47F50A910163D8BF957Cf5846D573E7f87CA', // FEI + '0x853d955aCEf822Db058eb8505911ED77F175b99e', // FRAX + '0x03ab458634910AaD20eF5f1C8ee96F1D6ac54919', // RAI + '0x6B175474E89094C44Da98b954EedeAC495271d0F', // DAI + '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48', // USDC + '0x5f98805A4E8be255a32880FDeC7F6728C6568bA0', // LUSD + '0x7f39C581F595B53c5cb19bD0b3f8dA6c935E2Ca0', // wstETH + '0xa693B19d2931d498c5B318dF961919BB4aee87a5', // USTw + '0xdAC17F958D2ee523a2206206994597C13D831ec7' // USDT + ]; + + for (const underlying of underlyings) { + const debt = await fuseFixer.callStatic.getTotalDebt(underlying); + console.log(`Total debt for ${underlying} is ${debt.toString()}`); + } + + return { fuseFixer }; +}; + +deploy('', {}, true); diff --git a/test/integration/proposals_config.ts b/test/integration/proposals_config.ts index fd9773c81..4084d2c46 100644 --- a/test/integration/proposals_config.ts +++ b/test/integration/proposals_config.ts @@ -6,7 +6,7 @@ import repay_fuse_bad_debt from '@proposals/description/repay_fuse_bad_debt'; const proposals: ProposalsConfigMap = { repay_fuse_bad_debt: { - deploy: true, // deploy flag for whether to run deploy action during e2e tests or use mainnet state + deploy: false, // deploy flag for whether to run deploy action during e2e tests or use mainnet state totalValue: 0, // amount of ETH to send to DAO execution proposal: repay_fuse_bad_debt, // full proposal file, imported from '@proposals/description/fip_xx.ts' proposalId: '', From acc29db7c31aae1d147eae107cbb9444a371cee1 Mon Sep 17 00:00:00 2001 From: Caleb Date: Wed, 25 May 2022 19:08:48 -0700 Subject: [PATCH 158/274] fix dependency issue --- protocol-configuration/mainnetAddresses.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/protocol-configuration/mainnetAddresses.ts b/protocol-configuration/mainnetAddresses.ts index 1bf490776..1b0a4b064 100644 --- a/protocol-configuration/mainnetAddresses.ts +++ b/protocol-configuration/mainnetAddresses.ts @@ -539,7 +539,7 @@ const MainnetAddresses: MainnetAddresses = { fuseFixer: { artifactName: 'FuseFixer', address: '0xFE7547F583aAe1212e72e063Aac25057C06c4797', - category: AddressCategory.PCV + category: AddressCategory.Governance }, feiOATimelockWrapper: { artifactName: 'PCVDepositWrapper', From 5c4026f489bea5ee4b871f88c64844037e933191 Mon Sep 17 00:00:00 2001 From: Caleb Date: Wed, 25 May 2022 19:12:10 -0700 Subject: [PATCH 159/274] remove extraneous proposals from proposalsconfig --- test/integration/proposals_config.ts | 65 +--------------------------- 1 file changed, 1 insertion(+), 64 deletions(-) diff --git a/test/integration/proposals_config.ts b/test/integration/proposals_config.ts index 4084d2c46..b1bbb96d9 100644 --- a/test/integration/proposals_config.ts +++ b/test/integration/proposals_config.ts @@ -1,7 +1,4 @@ import { ProposalCategory, ProposalsConfigMap } from '@custom-types/types'; - -import fip_104 from '@proposals/description/fip_104'; -import balancer_gauge_fix from '@proposals/description/balancer_gauge_fix'; import repay_fuse_bad_debt from '@proposals/description/repay_fuse_bad_debt'; const proposals: ProposalsConfigMap = { @@ -10,69 +7,9 @@ const proposals: ProposalsConfigMap = { totalValue: 0, // amount of ETH to send to DAO execution proposal: repay_fuse_bad_debt, // full proposal file, imported from '@proposals/description/fip_xx.ts' proposalId: '', - affectedContractSignoff: [''], + affectedContractSignoff: ['core', 'fuseFixer'], deprecatedContractSignoff: [''], category: ProposalCategory.TC - }, - - fip_104: { - deploy: false, // deploy flag for whether to run deploy action during e2e tests or use mainnet state - totalValue: 0, // amount of ETH to send to DAO execution - proposal: fip_104, // full proposal file, imported from '@proposals/description/fip_xx.ts' - proposalId: '31578302030309093637065801555854148925062532860791705694822567566349182964602', - affectedContractSignoff: [ - 'daiFixedPricePSMFeiSkimmer', - 'core', - 'compoundDaiPCVDeposit', - 'dpiToDaiLBPSwapper', - 'dpiToDaiLensDai', - 'dpiToDaiLensDpi', - 'collateralizationOracle', - 'tribalCouncilTimelock', - 'tribalCouncilSafe', - 'nopeDAO', - 'compoundEthPCVDeposit', - 'aaveEthPCVDeposit', - 'pcvGuardianNew', - 'uniswapPCVDeposit' - ], - deprecatedContractSignoff: [ - 'rariPool31FeiPCVDepositWrapper', - 'rariPool25FeiPCVDepositWrapper', - 'rariPool9RaiPCVDepositWrapper', - 'aaveRaiPCVDepositWrapper', - 'rariPool19DpiPCVDepositWrapper', - 'liquityFusePoolLusdPCVDeposit', - 'rariPool72FeiPCVDepositWrapper', - 'raiDepositWrapper', - 'rariPool31FeiPCVDeposit', - 'rariPool25FeiPCVDeposit', - 'rariPool9RaiPCVDeposit', - 'aaveRaiPCVDeposit', - 'rariPool19DpiPCVDeposit', - 'rariPool72FeiPCVDeposit', - 'dpiDepositWrapper' - ], - category: ProposalCategory.DAO - }, - - balancer_gauge_fix: { - deploy: false, // deploy flag for whether to run deploy action during e2e tests or use mainnet state - totalValue: 0, // amount of ETH to send to DAO execution - proposal: balancer_gauge_fix, // full proposal file, imported from '@proposals/description/fip_xx.ts' - proposalId: null, - affectedContractSignoff: [ - 'tribalCouncilTimelock', - 'balancerDepositFeiWeth', - 'balancerLensBpt30Fei70Weth', - 'pcvGuardianNew', - 'core', - 'balancerGaugeStaker', - 'collateralizationOracle', - 'pcvGuardianNew' - ], - deprecatedContractSignoff: ['balancerLensBpt30Fei70WethOld'], - category: ProposalCategory.TC } }; From 313ccca0d421add596c967fa662c31317e1e3c44 Mon Sep 17 00:00:00 2001 From: Caleb Date: Wed, 25 May 2022 19:18:25 -0700 Subject: [PATCH 160/274] remove setup forking test code --- proposals/dao/repay_fuse_bad_debt.ts | 3 ++- protocol-configuration/dependencies.ts | 5 +++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/proposals/dao/repay_fuse_bad_debt.ts b/proposals/dao/repay_fuse_bad_debt.ts index 8ed2bfde4..186367496 100644 --- a/proposals/dao/repay_fuse_bad_debt.ts +++ b/proposals/dao/repay_fuse_bad_debt.ts @@ -44,7 +44,7 @@ const setup: SetupUpgradeFunc = async (addresses, oldContracts, contracts, loggi // 1,955,846 lusd --> 0x5f98805A4E8be255a32880FDeC7F6728C6568bA0 // 0x66017d22b0f8556afdd19fc67041899eb65a21bb (liquidity stability pool) // 2,793,119 ustw --> 0xa47c8bf37f92aBed4A126BDA807A7b7498661acD // 0x2faf487a4414fe77e2327f0bf4ae2a264a776ad2 (ftx exchange) // 133,178 usdt --> 0xdAC17F958D2ee523a2206206994597C13D831ec7 // 0x5754284f345afc66a98fbb0a0afe71e0f007b949 (tether treasury) - + /* // give eth to each of the signers await forceEthMultiple([ '0xbC9C084a12678ef5B516561df902fdc426d95483', @@ -109,6 +109,7 @@ const setup: SetupUpgradeFunc = async (addresses, oldContracts, contracts, loggi await forceSpecificEth(addresses.fuseFixer, utils.parseEther('6500').toString()); // contract should now have enough to repayBorrowBehalf everything + */ }; // Tears down any changes made in setup() that need to be diff --git a/protocol-configuration/dependencies.ts b/protocol-configuration/dependencies.ts index 64d6ff7fc..2543725c5 100644 --- a/protocol-configuration/dependencies.ts +++ b/protocol-configuration/dependencies.ts @@ -29,7 +29,7 @@ const dependencies: DependencyMap = { contractDependencies: ['tribe'] }, fuseFixer: { - contractDependencies: ['core'] + contractDependencies: ['core', 'pcvGuardianNew'] }, core: { contractDependencies: [ @@ -199,7 +199,8 @@ const dependencies: DependencyMap = { 'daiFixedPricePSM', 'compoundEthPCVDeposit', 'aaveEthPCVDeposit', - 'raiPriceBoundPSM' + 'raiPriceBoundPSM', + 'fuseFixer' ] }, raiPriceBoundPSM: { From 173b4cee55b15da51486285291addf8108046172 Mon Sep 17 00:00:00 2001 From: Caleb Date: Wed, 25 May 2022 19:24:26 -0700 Subject: [PATCH 161/274] e2e test fix --- test/integration/proposals_config.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/integration/proposals_config.ts b/test/integration/proposals_config.ts index b1bbb96d9..11b5d90a9 100644 --- a/test/integration/proposals_config.ts +++ b/test/integration/proposals_config.ts @@ -7,7 +7,7 @@ const proposals: ProposalsConfigMap = { totalValue: 0, // amount of ETH to send to DAO execution proposal: repay_fuse_bad_debt, // full proposal file, imported from '@proposals/description/fip_xx.ts' proposalId: '', - affectedContractSignoff: ['core', 'fuseFixer'], + affectedContractSignoff: ['core', 'fuseFixer', 'pcvGuardianNew'], deprecatedContractSignoff: [''], category: ProposalCategory.TC } From 60642961fc65784122f080526bb12efdd3ebf646 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 30 May 2022 07:33:26 +0000 Subject: [PATCH 162/274] build(deps-dev): bump @types/node from 17.0.35 to 17.0.36 Bumps [@types/node](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/node) from 17.0.35 to 17.0.36. - [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases) - [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/node) --- updated-dependencies: - dependency-name: "@types/node" dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- package-lock.json | 14 +++++++------- package.json | 2 +- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/package-lock.json b/package-lock.json index dcced7054..1b95cb228 100644 --- a/package-lock.json +++ b/package-lock.json @@ -39,7 +39,7 @@ "@typechain/hardhat": "^2.3.0", "@types/chai": "^4.3.1", "@types/mocha": "^9.1.1", - "@types/node": "^17.0.35", + "@types/node": "^17.0.36", "@typescript-eslint/eslint-plugin": "^4.31.2", "@typescript-eslint/parser": "^4.31.2", "chai-bn": "^0.3.1", @@ -4478,9 +4478,9 @@ "dev": true }, "node_modules/@types/node": { - "version": "17.0.35", - "resolved": "https://registry.npmjs.org/@types/node/-/node-17.0.35.tgz", - "integrity": "sha512-vu1SrqBjbbZ3J6vwY17jBs8Sr/BKA+/a/WtjRG+whKg1iuLFOosq872EXS0eXWILdO36DHQQeku/ZcL6hz2fpg==" + "version": "17.0.36", + "resolved": "https://registry.npmjs.org/@types/node/-/node-17.0.36.tgz", + "integrity": "sha512-V3orv+ggDsWVHP99K3JlwtH20R7J4IhI1Kksgc+64q5VxgfRkQG8Ws3MFm/FZOKDYGy9feGFlZ70/HpCNe9QaA==" }, "node_modules/@types/node-fetch": { "version": "2.6.1", @@ -32403,9 +32403,9 @@ "dev": true }, "@types/node": { - "version": "17.0.35", - "resolved": "https://registry.npmjs.org/@types/node/-/node-17.0.35.tgz", - "integrity": "sha512-vu1SrqBjbbZ3J6vwY17jBs8Sr/BKA+/a/WtjRG+whKg1iuLFOosq872EXS0eXWILdO36DHQQeku/ZcL6hz2fpg==" + "version": "17.0.36", + "resolved": "https://registry.npmjs.org/@types/node/-/node-17.0.36.tgz", + "integrity": "sha512-V3orv+ggDsWVHP99K3JlwtH20R7J4IhI1Kksgc+64q5VxgfRkQG8Ws3MFm/FZOKDYGy9feGFlZ70/HpCNe9QaA==" }, "@types/node-fetch": { "version": "2.6.1", diff --git a/package.json b/package.json index 8e515bc44..b140e643b 100644 --- a/package.json +++ b/package.json @@ -79,7 +79,7 @@ "@typechain/hardhat": "^2.3.0", "@types/chai": "^4.3.1", "@types/mocha": "^9.1.1", - "@types/node": "^17.0.35", + "@types/node": "^17.0.36", "@typescript-eslint/eslint-plugin": "^4.31.2", "@typescript-eslint/parser": "^4.31.2", "chai-bn": "^0.3.1", From afc2c127c07ea21bc053179004db12d999ce070b Mon Sep 17 00:00:00 2001 From: thomas-waite Date: Mon, 30 May 2022 23:08:04 +0100 Subject: [PATCH 163/274] style: rename addresses --- proposals/description/register_proposal.ts | 10 +++++----- protocol-configuration/mainnetAddresses.ts | 8 ++++---- protocol-configuration/permissions.ts | 8 ++++---- 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/proposals/description/register_proposal.ts b/proposals/description/register_proposal.ts index 54330b01e..3dc36672d 100644 --- a/proposals/description/register_proposal.ts +++ b/proposals/description/register_proposal.ts @@ -11,7 +11,7 @@ const register_proposal: ProposalDescription = { '0xf62a46a499242191aaab61084d4912c2c0a8c48e3d70edfb5a9be2bc9e92622f', // POD_METADATA_REGISTER_ROLE '0x64c4Bffb220818F0f2ee6DAe7A2F17D92b359c5d' ], - description: 'Grant Fei dev, Tom, POD_METADATA_REGISTER_ROLE to register proposal metadata' + description: 'Grant Tribe dev, Tom, POD_METADATA_REGISTER_ROLE to register proposal metadata' }, { target: 'core', @@ -21,7 +21,7 @@ const register_proposal: ProposalDescription = { '0xf62a46a499242191aaab61084d4912c2c0a8c48e3d70edfb5a9be2bc9e92622f', // POD_METADATA_REGISTER_ROLE '0x5346b4ff3e924508d33d93f352d11e392a7a9d3b' ], - description: 'Grant Fei dev, Caleb, POD_METADATA_REGISTER_ROLE to register proposal metadata' + description: 'Grant Tribe dev, Caleb, POD_METADATA_REGISTER_ROLE to register proposal metadata' }, { target: 'core', @@ -31,7 +31,7 @@ const register_proposal: ProposalDescription = { '0xf62a46a499242191aaab61084d4912c2c0a8c48e3d70edfb5a9be2bc9e92622f', // POD_METADATA_REGISTER_ROLE '0xcE96fE7Eb7186E9F894DE7703B4DF8ea60E2dD77' ], - description: 'Grant Fei dev, Erwan, POD_METADATA_REGISTER_ROLE to register proposal metadata' + description: 'Grant Tribe dev, Erwan, POD_METADATA_REGISTER_ROLE to register proposal metadata' }, { target: 'core', @@ -41,11 +41,11 @@ const register_proposal: ProposalDescription = { '0xf62a46a499242191aaab61084d4912c2c0a8c48e3d70edfb5a9be2bc9e92622f', // POD_METADATA_REGISTER_ROLE '0xE2388f22cf5e328C197D6530663809cc0408a510' ], - description: 'Grant Fei dev, Joey, POD_METADATA_REGISTER_ROLE to register proposal metadata' + description: 'Grant Tribe dev, Joey, POD_METADATA_REGISTER_ROLE to register proposal metadata' } ], description: ` - Grant Fei engineers the POD_METADATA_REGISTER_ROLE so they are able to register pod proposal metadata + Grant Tribe engineers the POD_METADATA_REGISTER_ROLE so they are able to register pod proposal metadata ` }; diff --git a/protocol-configuration/mainnetAddresses.ts b/protocol-configuration/mainnetAddresses.ts index 32a6621be..f23a36c43 100644 --- a/protocol-configuration/mainnetAddresses.ts +++ b/protocol-configuration/mainnetAddresses.ts @@ -2116,22 +2116,22 @@ const MainnetAddresses: MainnetAddresses = { address: '0x8096314D9014EbB69Fc777ED3791DDE6FFbaFAed', category: AddressCategory.Governance }, - feiDev1Deployer: { + tribeDev1Deployer: { artifactName: 'unknown', address: '0x64c4Bffb220818F0f2ee6DAe7A2F17D92b359c5d', category: AddressCategory.External }, - feiDev2Deployer: { + tribeDev2Deployer: { artifactName: 'unknown', address: '0xcE96fE7Eb7186E9F894DE7703B4DF8ea60E2dD77', category: AddressCategory.External }, - feiDev3Deployer: { + tribeDev3Deployer: { artifactName: 'unknown', address: '0xE2388f22cf5e328C197D6530663809cc0408a510', category: AddressCategory.External }, - feiDev4Deployer: { + tribeDev4Deployer: { artifactName: 'unknown', address: '0x5346b4ff3e924508d33d93f352d11e392a7a9d3b', category: AddressCategory.External diff --git a/protocol-configuration/permissions.ts b/protocol-configuration/permissions.ts index 85fa94c7a..153f2f9d6 100644 --- a/protocol-configuration/permissions.ts +++ b/protocol-configuration/permissions.ts @@ -47,10 +47,10 @@ export const permissions = { ROLE_ADMIN: ['feiDAOTimelock', 'tribalCouncilTimelock'], POD_METADATA_REGISTER_ROLE: [ 'tribalCouncilSafe', - 'feiDev1Deployer', - 'feiDev2Deployer', - 'feiDev3Deployer', - 'feiDev4Deployer' + 'tribeDev1Deployer', + 'tribeDev2Deployer', + 'tribeDev3Deployer', + 'tribeDev4Deployer' ], FEI_MINT_ADMIN: ['feiDAOTimelock', 'tribalCouncilTimelock'], POD_VETO_ADMIN: ['nopeDAO'], From 5d0fd2280a81e3dbb76da3a87f46027d5a176cd2 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 31 May 2022 07:22:11 +0000 Subject: [PATCH 164/274] build(deps-dev): bump @nomiclabs/hardhat-etherscan from 3.0.3 to 3.0.4 Bumps [@nomiclabs/hardhat-etherscan](https://github.com/nomiclabs/hardhat) from 3.0.3 to 3.0.4. - [Release notes](https://github.com/nomiclabs/hardhat/releases) - [Commits](https://github.com/nomiclabs/hardhat/compare/@nomiclabs/hardhat-etherscan@3.0.3...@nomiclabs/hardhat-etherscan@3.0.4) --- updated-dependencies: - dependency-name: "@nomiclabs/hardhat-etherscan" dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- package-lock.json | 14 +++++++------- package.json | 2 +- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/package-lock.json b/package-lock.json index dcced7054..c5e13c6f2 100644 --- a/package-lock.json +++ b/package-lock.json @@ -34,7 +34,7 @@ "devDependencies": { "@idle-finance/hardhat-proposals-plugin": "^0.2.3", "@nomiclabs/hardhat-ethers": "^2.0.6", - "@nomiclabs/hardhat-etherscan": "^3.0.3", + "@nomiclabs/hardhat-etherscan": "^3.0.4", "@typechain/ethers-v5": "^7.1.2", "@typechain/hardhat": "^2.3.0", "@types/chai": "^4.3.1", @@ -1952,9 +1952,9 @@ } }, "node_modules/@nomiclabs/hardhat-etherscan": { - "version": "3.0.3", - "resolved": "https://registry.npmjs.org/@nomiclabs/hardhat-etherscan/-/hardhat-etherscan-3.0.3.tgz", - "integrity": "sha512-OfNtUKc/ZwzivmZnnpwWREfaYncXteKHskn3yDnz+fPBZ6wfM4GR+d5RwjREzYFWE+o5iR9ruXhWw/8fejWM9g==", + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/@nomiclabs/hardhat-etherscan/-/hardhat-etherscan-3.0.4.tgz", + "integrity": "sha512-AZPlnyCYp3YObmhtsFo6RWgY/81fQKRF5h42iV22H4jz9MwP+SWeoB99YVPLnxId2fmAYu3VgCNeE9QpApv06g==", "dev": true, "dependencies": { "@ethersproject/abi": "^5.1.2", @@ -30158,9 +30158,9 @@ "requires": {} }, "@nomiclabs/hardhat-etherscan": { - "version": "3.0.3", - "resolved": "https://registry.npmjs.org/@nomiclabs/hardhat-etherscan/-/hardhat-etherscan-3.0.3.tgz", - "integrity": "sha512-OfNtUKc/ZwzivmZnnpwWREfaYncXteKHskn3yDnz+fPBZ6wfM4GR+d5RwjREzYFWE+o5iR9ruXhWw/8fejWM9g==", + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/@nomiclabs/hardhat-etherscan/-/hardhat-etherscan-3.0.4.tgz", + "integrity": "sha512-AZPlnyCYp3YObmhtsFo6RWgY/81fQKRF5h42iV22H4jz9MwP+SWeoB99YVPLnxId2fmAYu3VgCNeE9QpApv06g==", "dev": true, "requires": { "@ethersproject/abi": "^5.1.2", diff --git a/package.json b/package.json index 8e515bc44..a4e811de5 100644 --- a/package.json +++ b/package.json @@ -74,7 +74,7 @@ "devDependencies": { "@idle-finance/hardhat-proposals-plugin": "^0.2.3", "@nomiclabs/hardhat-ethers": "^2.0.6", - "@nomiclabs/hardhat-etherscan": "^3.0.3", + "@nomiclabs/hardhat-etherscan": "^3.0.4", "@typechain/ethers-v5": "^7.1.2", "@typechain/hardhat": "^2.3.0", "@types/chai": "^4.3.1", From 2c6f524cee466e6ae2e715423b460e871da56537 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 31 May 2022 07:23:08 +0000 Subject: [PATCH 165/274] build(deps): bump hardhat from 2.9.6 to 2.9.7 Bumps [hardhat](https://github.com/nomiclabs/hardhat) from 2.9.6 to 2.9.7. - [Release notes](https://github.com/nomiclabs/hardhat/releases) - [Commits](https://github.com/nomiclabs/hardhat/compare/hardhat@2.9.6...hardhat@2.9.7) --- updated-dependencies: - dependency-name: hardhat dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- package-lock.json | 14 +++++++------- package.json | 2 +- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/package-lock.json b/package-lock.json index dcced7054..9dcc5f79a 100644 --- a/package-lock.json +++ b/package-lock.json @@ -25,7 +25,7 @@ "@uniswap/v2-periphery": "^1.1.0-beta.0", "chai": "^4.3.6", "dotenv": "^16.0.1", - "hardhat": "^2.9.6", + "hardhat": "^2.9.7", "hardhat-contract-sizer": "^2.5.1", "hardhat-gas-reporter": "^1.0.8", "merkletreejs": "^0.2.31", @@ -18403,9 +18403,9 @@ } }, "node_modules/hardhat": { - "version": "2.9.6", - "resolved": "https://registry.npmjs.org/hardhat/-/hardhat-2.9.6.tgz", - "integrity": "sha512-Vnm1iDfhbavNjvLxArt47rt6G3vPIV4Q/+pNgFkh6sfQH8JVf8px5VxiEs5cj4rPxmU+DXGKoalY+pK8fAL4oA==", + "version": "2.9.7", + "resolved": "https://registry.npmjs.org/hardhat/-/hardhat-2.9.7.tgz", + "integrity": "sha512-PVSgTlM4Mtc4HNEoISpcM6rRNAK3ngqhxUaTmSw9eCtuVmtxTK86Tqnuq4zNPmlrtcuReXry9k3LGEnk2gJgbA==", "dependencies": { "@ethereumjs/block": "^3.6.2", "@ethereumjs/blockchain": "^5.5.2", @@ -43031,9 +43031,9 @@ } }, "hardhat": { - "version": "2.9.6", - "resolved": "https://registry.npmjs.org/hardhat/-/hardhat-2.9.6.tgz", - "integrity": "sha512-Vnm1iDfhbavNjvLxArt47rt6G3vPIV4Q/+pNgFkh6sfQH8JVf8px5VxiEs5cj4rPxmU+DXGKoalY+pK8fAL4oA==", + "version": "2.9.7", + "resolved": "https://registry.npmjs.org/hardhat/-/hardhat-2.9.7.tgz", + "integrity": "sha512-PVSgTlM4Mtc4HNEoISpcM6rRNAK3ngqhxUaTmSw9eCtuVmtxTK86Tqnuq4zNPmlrtcuReXry9k3LGEnk2gJgbA==", "requires": { "@ethereumjs/block": "^3.6.2", "@ethereumjs/blockchain": "^5.5.2", diff --git a/package.json b/package.json index 8e515bc44..8708713f4 100644 --- a/package.json +++ b/package.json @@ -65,7 +65,7 @@ "@uniswap/v2-periphery": "^1.1.0-beta.0", "chai": "^4.3.6", "dotenv": "^16.0.1", - "hardhat": "^2.9.6", + "hardhat": "^2.9.7", "hardhat-contract-sizer": "^2.5.1", "hardhat-gas-reporter": "^1.0.8", "merkletreejs": "^0.2.31", From 8d26054222ff441d6ce2d529b32314ede08e1acd Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 31 May 2022 07:24:17 +0000 Subject: [PATCH 166/274] build(deps-dev): bump lint-staged from 12.4.2 to 12.4.3 Bumps [lint-staged](https://github.com/okonet/lint-staged) from 12.4.2 to 12.4.3. - [Release notes](https://github.com/okonet/lint-staged/releases) - [Commits](https://github.com/okonet/lint-staged/compare/v12.4.2...v12.4.3) --- updated-dependencies: - dependency-name: lint-staged dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- package-lock.json | 80 +++++++++++++++++++++++------------------------ package.json | 2 +- 2 files changed, 41 insertions(+), 41 deletions(-) diff --git a/package-lock.json b/package-lock.json index dcced7054..87c0b33f6 100644 --- a/package-lock.json +++ b/package-lock.json @@ -51,7 +51,7 @@ "ethereum-waffle": "^3.4.4", "ethers": "^5.6.8", "husky": "^8.0.1", - "lint-staged": "^12.4.2", + "lint-staged": "^12.4.3", "mocha": "^10.0.0", "mocha-junit-reporter": "^2.0.2", "mocha-multi-reporters": "^1.5.1", @@ -20578,33 +20578,33 @@ } }, "node_modules/lilconfig": { - "version": "2.0.4", - "resolved": "https://registry.npmjs.org/lilconfig/-/lilconfig-2.0.4.tgz", - "integrity": "sha512-bfTIN7lEsiooCocSISTWXkiWJkRqtL9wYtYy+8EK3Y41qh3mpwPU0ycTOgjdY9ErwXCc8QyrQp82bdL0Xkm9yA==", + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/lilconfig/-/lilconfig-2.0.5.tgz", + "integrity": "sha512-xaYmXZtTHPAw5m+xLN8ab9C+3a8YmV3asNSPOATITbtwrfbwaLJj8h66H1WMIpALCkqsIzK3h7oQ+PdX+LQ9Eg==", "dev": true, "engines": { "node": ">=10" } }, "node_modules/lint-staged": { - "version": "12.4.2", - "resolved": "https://registry.npmjs.org/lint-staged/-/lint-staged-12.4.2.tgz", - "integrity": "sha512-JAJGIzY/OioIUtrRePr8go6qUxij//mL+RGGoFKU3VWQRtIHgWoHizSqH0QVn2OwrbXS9Q6CICQjfj+E5qvrXg==", + "version": "12.4.3", + "resolved": "https://registry.npmjs.org/lint-staged/-/lint-staged-12.4.3.tgz", + "integrity": "sha512-eH6SKOmdm/ZwCRMTZAmM3q3dPkpq6vco/BfrOw8iGun4Xs/thYegPD/MLIwKO+iPkzibkLJuQcRhRLXKvaKreg==", "dev": true, "dependencies": { "cli-truncate": "^3.1.0", "colorette": "^2.0.16", - "commander": "^8.3.0", - "debug": "^4.3.3", + "commander": "^9.3.0", + "debug": "^4.3.4", "execa": "^5.1.1", - "lilconfig": "2.0.4", - "listr2": "^4.0.1", - "micromatch": "^4.0.4", + "lilconfig": "2.0.5", + "listr2": "^4.0.5", + "micromatch": "^4.0.5", "normalize-path": "^3.0.0", - "object-inspect": "^1.12.0", + "object-inspect": "^1.12.2", "pidtree": "^0.5.0", "string-argv": "^0.3.1", - "supports-color": "^9.2.1", + "supports-color": "^9.2.2", "yaml": "^1.10.2" }, "bin": { @@ -20618,12 +20618,12 @@ } }, "node_modules/lint-staged/node_modules/commander": { - "version": "8.3.0", - "resolved": "https://registry.npmjs.org/commander/-/commander-8.3.0.tgz", - "integrity": "sha512-OkTL9umf+He2DZkUq8f8J9of7yL6RJKI24dVITBmNfZBmri9zYZQrKkuXiKhyfPSu8tUhnVBB1iKXevvnlR4Ww==", + "version": "9.3.0", + "resolved": "https://registry.npmjs.org/commander/-/commander-9.3.0.tgz", + "integrity": "sha512-hv95iU5uXPbK83mjrJKuZyFM/LBAoCV/XhVGkS5Je6tl7sxr6A0ITMw5WoRV46/UaJ46Nllm3Xt7IaJhXTIkzw==", "dev": true, "engines": { - "node": ">= 12" + "node": "^12.20.0 || >=14" } }, "node_modules/lint-staged/node_modules/supports-color": { @@ -22345,9 +22345,9 @@ } }, "node_modules/object-inspect": { - "version": "1.12.0", - "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.12.0.tgz", - "integrity": "sha512-Ho2z80bVIvJloH+YzRmpZVQe87+qASmBUKZDWgx9cu+KDrX2ZDH/3tMy+gXbZETVGs2M8YdxObOh7XAtim9Y0g==", + "version": "1.12.2", + "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.12.2.tgz", + "integrity": "sha512-z+cPxW0QGUp0mcqcsgQyLVRDoXFQbXOwBaqyF7VIgI4TWNQsDHrBpUQslRmIfAoYWdYzs6UlKJtB2XJpTaNSpQ==", "funding": { "url": "https://github.com/sponsors/ljharb" } @@ -44629,37 +44629,37 @@ } }, "lilconfig": { - "version": "2.0.4", - "resolved": "https://registry.npmjs.org/lilconfig/-/lilconfig-2.0.4.tgz", - "integrity": "sha512-bfTIN7lEsiooCocSISTWXkiWJkRqtL9wYtYy+8EK3Y41qh3mpwPU0ycTOgjdY9ErwXCc8QyrQp82bdL0Xkm9yA==", + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/lilconfig/-/lilconfig-2.0.5.tgz", + "integrity": "sha512-xaYmXZtTHPAw5m+xLN8ab9C+3a8YmV3asNSPOATITbtwrfbwaLJj8h66H1WMIpALCkqsIzK3h7oQ+PdX+LQ9Eg==", "dev": true }, "lint-staged": { - "version": "12.4.2", - "resolved": "https://registry.npmjs.org/lint-staged/-/lint-staged-12.4.2.tgz", - "integrity": "sha512-JAJGIzY/OioIUtrRePr8go6qUxij//mL+RGGoFKU3VWQRtIHgWoHizSqH0QVn2OwrbXS9Q6CICQjfj+E5qvrXg==", + "version": "12.4.3", + "resolved": "https://registry.npmjs.org/lint-staged/-/lint-staged-12.4.3.tgz", + "integrity": "sha512-eH6SKOmdm/ZwCRMTZAmM3q3dPkpq6vco/BfrOw8iGun4Xs/thYegPD/MLIwKO+iPkzibkLJuQcRhRLXKvaKreg==", "dev": true, "requires": { "cli-truncate": "^3.1.0", "colorette": "^2.0.16", - "commander": "^8.3.0", - "debug": "^4.3.3", + "commander": "^9.3.0", + "debug": "^4.3.4", "execa": "^5.1.1", - "lilconfig": "2.0.4", - "listr2": "^4.0.1", - "micromatch": "^4.0.4", + "lilconfig": "2.0.5", + "listr2": "^4.0.5", + "micromatch": "^4.0.5", "normalize-path": "^3.0.0", - "object-inspect": "^1.12.0", + "object-inspect": "^1.12.2", "pidtree": "^0.5.0", "string-argv": "^0.3.1", - "supports-color": "^9.2.1", + "supports-color": "^9.2.2", "yaml": "^1.10.2" }, "dependencies": { "commander": { - "version": "8.3.0", - "resolved": "https://registry.npmjs.org/commander/-/commander-8.3.0.tgz", - "integrity": "sha512-OkTL9umf+He2DZkUq8f8J9of7yL6RJKI24dVITBmNfZBmri9zYZQrKkuXiKhyfPSu8tUhnVBB1iKXevvnlR4Ww==", + "version": "9.3.0", + "resolved": "https://registry.npmjs.org/commander/-/commander-9.3.0.tgz", + "integrity": "sha512-hv95iU5uXPbK83mjrJKuZyFM/LBAoCV/XhVGkS5Je6tl7sxr6A0ITMw5WoRV46/UaJ46Nllm3Xt7IaJhXTIkzw==", "dev": true }, "supports-color": { @@ -46020,9 +46020,9 @@ } }, "object-inspect": { - "version": "1.12.0", - "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.12.0.tgz", - "integrity": "sha512-Ho2z80bVIvJloH+YzRmpZVQe87+qASmBUKZDWgx9cu+KDrX2ZDH/3tMy+gXbZETVGs2M8YdxObOh7XAtim9Y0g==" + "version": "1.12.2", + "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.12.2.tgz", + "integrity": "sha512-z+cPxW0QGUp0mcqcsgQyLVRDoXFQbXOwBaqyF7VIgI4TWNQsDHrBpUQslRmIfAoYWdYzs6UlKJtB2XJpTaNSpQ==" }, "object-keys": { "version": "1.1.1", diff --git a/package.json b/package.json index 8e515bc44..42ba620d7 100644 --- a/package.json +++ b/package.json @@ -91,7 +91,7 @@ "ethereum-waffle": "^3.4.4", "ethers": "^5.6.8", "husky": "^8.0.1", - "lint-staged": "^12.4.2", + "lint-staged": "^12.4.3", "mocha": "^10.0.0", "mocha-junit-reporter": "^2.0.2", "mocha-multi-reporters": "^1.5.1", From f45d62a15b010314555f3545de87fae373f4c166 Mon Sep 17 00:00:00 2001 From: thomas-waite Date: Tue, 31 May 2022 22:53:00 +0100 Subject: [PATCH 167/274] refactor: re-add new roles --- test/integration/proposals_config.ts | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/test/integration/proposals_config.ts b/test/integration/proposals_config.ts index 11b5d90a9..f2f310836 100644 --- a/test/integration/proposals_config.ts +++ b/test/integration/proposals_config.ts @@ -1,7 +1,17 @@ import { ProposalCategory, ProposalsConfigMap } from '@custom-types/types'; import repay_fuse_bad_debt from '@proposals/description/repay_fuse_bad_debt'; +import register_proposal from '@proposals/description/register_proposal'; const proposals: ProposalsConfigMap = { + register_proposal: { + deploy: false, // deploy flag for whether to run deploy action during e2e tests or use mainnet state + totalValue: 0, // amount of ETH to send to DAO execution + proposal: register_proposal, // full proposal file, imported from '@proposals/description/fip_xx.ts' + proposalId: '', + affectedContractSignoff: [], + deprecatedContractSignoff: [''], + category: ProposalCategory.TC + }, repay_fuse_bad_debt: { deploy: false, // deploy flag for whether to run deploy action during e2e tests or use mainnet state totalValue: 0, // amount of ETH to send to DAO execution From 4cffe26835bb3e9b0e6ee1b8cd1de1a330ab3d59 Mon Sep 17 00:00:00 2001 From: thomas-waite Date: Tue, 31 May 2022 23:21:00 +0100 Subject: [PATCH 168/274] test: lower floor of rai for psm tests --- test/integration/tests/psm.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/test/integration/tests/psm.ts b/test/integration/tests/psm.ts index dc64d9c96..e1c313218 100644 --- a/test/integration/tests/psm.ts +++ b/test/integration/tests/psm.ts @@ -407,6 +407,9 @@ describe('e2e-peg-stability-module', function () { await forceEth(raiWhale); const raiWhaleSigner = await getImpersonatedSigner(raiWhale); await rai.connect(raiWhaleSigner).transfer(raiPriceBoundPSM.address, redeemAmount); + + // Set floor to something sufficiently low for tests to pass - RAI price on-chain fluctuates + await raiPriceBoundPSM.connect(impersonatedSigners[governorAddress]).setOracleFloorBasisPoints(25000); }); it('exchanges 1000 FEI for rai', async () => { @@ -458,6 +461,9 @@ describe('e2e-peg-stability-module', function () { await forceEth(raiAccount); await rai.connect(raiSigner).transfer(userAddress, mintAmount); await rai.connect(impersonatedSigners[userAddress]).approve(raiPriceBoundPSM.address, mintAmount * 2); + + // Set floor to something sufficiently low for tests to pass - RAI price on-chain fluctuates + await raiPriceBoundPSM.connect(impersonatedSigners[governorAddress]).setOracleFloorBasisPoints(2500); }); it('cannot mint because the rai psm is paused', async () => { From 533291ed39664607286763671435ec8efce44aeb Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 1 Jun 2022 09:39:30 +0000 Subject: [PATCH 169/274] build(deps-dev): bump lint-staged from 12.4.3 to 13.0.0 Bumps [lint-staged](https://github.com/okonet/lint-staged) from 12.4.3 to 13.0.0. - [Release notes](https://github.com/okonet/lint-staged/releases) - [Commits](https://github.com/okonet/lint-staged/compare/v12.4.3...v13.0.0) --- updated-dependencies: - dependency-name: lint-staged dependency-type: direct:development update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] --- package-lock.json | 230 ++++++++++++++++++++++++++++------------------ package.json | 2 +- 2 files changed, 141 insertions(+), 91 deletions(-) diff --git a/package-lock.json b/package-lock.json index d5685461d..e190ff283 100644 --- a/package-lock.json +++ b/package-lock.json @@ -51,7 +51,7 @@ "ethereum-waffle": "^3.4.4", "ethers": "^5.6.8", "husky": "^8.0.1", - "lint-staged": "^12.4.3", + "lint-staged": "^13.0.0", "mocha": "^10.0.0", "mocha-junit-reporter": "^2.0.2", "mocha-multi-reporters": "^1.5.1", @@ -9063,28 +9063,55 @@ } }, "node_modules/execa": { - "version": "5.1.1", - "resolved": "https://registry.npmjs.org/execa/-/execa-5.1.1.tgz", - "integrity": "sha512-8uSpZZocAZRBAPIEINJj3Lo9HyGitllczc27Eh5YYojjMFMn8yHMDMaUHE2Jqfq05D/wucwI4JGURyXt1vchyg==", + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/execa/-/execa-6.1.0.tgz", + "integrity": "sha512-QVWlX2e50heYJcCPG0iWtf8r0xjEYfz/OYLGDYH+IyjWezzPNxz63qNFOu0l4YftGWuizFVZHHs8PrLU5p2IDA==", "dev": true, "dependencies": { "cross-spawn": "^7.0.3", - "get-stream": "^6.0.0", - "human-signals": "^2.1.0", - "is-stream": "^2.0.0", + "get-stream": "^6.0.1", + "human-signals": "^3.0.1", + "is-stream": "^3.0.0", "merge-stream": "^2.0.0", - "npm-run-path": "^4.0.1", - "onetime": "^5.1.2", - "signal-exit": "^3.0.3", - "strip-final-newline": "^2.0.0" + "npm-run-path": "^5.1.0", + "onetime": "^6.0.0", + "signal-exit": "^3.0.7", + "strip-final-newline": "^3.0.0" }, "engines": { - "node": ">=10" + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" }, "funding": { "url": "https://github.com/sindresorhus/execa?sponsor=1" } }, + "node_modules/execa/node_modules/mimic-fn": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-4.0.0.tgz", + "integrity": "sha512-vqiC06CuhBTUdZH+RYl8sFrL096vA45Ok5ISO6sE/Mr1jRbGH4Csnhi8f3wKVl7x8mO4Au7Ir9D3Oyv1VYMFJw==", + "dev": true, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/execa/node_modules/onetime": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/onetime/-/onetime-6.0.0.tgz", + "integrity": "sha512-1FlR+gjXK7X+AsAHso35MnyN5KqGwJRi/31ft6x0M194ht7S+rWAvd7PHss9xSKMzE0asv1pyIHaJYq+BbacAQ==", + "dev": true, + "dependencies": { + "mimic-fn": "^4.0.0" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/exit-hook": { "version": "2.2.1", "resolved": "https://registry.npmjs.org/exit-hook/-/exit-hook-2.2.1.tgz", @@ -19399,12 +19426,12 @@ } }, "node_modules/human-signals": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/human-signals/-/human-signals-2.1.0.tgz", - "integrity": "sha512-B4FFZ6q/T2jhhksgkbEW3HBvWIfDW85snkQgawt07S7J5QXTk6BkNV+0yAeZrM5QpMAdYlocGoljn0sJ/WQkFw==", + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/human-signals/-/human-signals-3.0.1.tgz", + "integrity": "sha512-rQLskxnM/5OCldHo+wNXbpVgDn5A17CUoKX+7Sokwaknlq7CdSnphy0W39GU8dw59XiCXmFXDg4fRuckQRKewQ==", "dev": true, "engines": { - "node": ">=10.17.0" + "node": ">=12.20.0" } }, "node_modules/husky": { @@ -20112,12 +20139,12 @@ } }, "node_modules/is-stream": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-2.0.1.tgz", - "integrity": "sha512-hFoiJiTl63nn+kstHGBtewWSKnQLpyb155KHheA1l39uvtO9nWIop1p3udqPcUd/xbF1VLMO4n7OI6p7RbngDg==", + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-3.0.0.tgz", + "integrity": "sha512-LnQR4bZ9IADDRSkvpqMGvt/tEJWclzklNgSw48V5EAaAeDd6qGvN8ei6k5p0tvxSR171VmGyHuTiAOfxAbr8kA==", "dev": true, "engines": { - "node": ">=8" + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" }, "funding": { "url": "https://github.com/sponsors/sindresorhus" @@ -20587,16 +20614,16 @@ } }, "node_modules/lint-staged": { - "version": "12.4.3", - "resolved": "https://registry.npmjs.org/lint-staged/-/lint-staged-12.4.3.tgz", - "integrity": "sha512-eH6SKOmdm/ZwCRMTZAmM3q3dPkpq6vco/BfrOw8iGun4Xs/thYegPD/MLIwKO+iPkzibkLJuQcRhRLXKvaKreg==", + "version": "13.0.0", + "resolved": "https://registry.npmjs.org/lint-staged/-/lint-staged-13.0.0.tgz", + "integrity": "sha512-vWban5utFt78VZohbosUxNIa46KKJ+KOQTDWTQ8oSl1DLEEVl9zhUtaQbiiydAmx+h2wKJK2d0+iMaRmknuWRQ==", "dev": true, "dependencies": { "cli-truncate": "^3.1.0", "colorette": "^2.0.16", "commander": "^9.3.0", "debug": "^4.3.4", - "execa": "^5.1.1", + "execa": "^6.1.0", "lilconfig": "2.0.5", "listr2": "^4.0.5", "micromatch": "^4.0.5", @@ -20604,14 +20631,13 @@ "object-inspect": "^1.12.2", "pidtree": "^0.5.0", "string-argv": "^0.3.1", - "supports-color": "^9.2.2", - "yaml": "^1.10.2" + "yaml": "^2.1.1" }, "bin": { "lint-staged": "bin/lint-staged.js" }, "engines": { - "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + "node": "^14.13.1 || >=16.0.0" }, "funding": { "url": "https://opencollective.com/lint-staged" @@ -20626,18 +20652,6 @@ "node": "^12.20.0 || >=14" } }, - "node_modules/lint-staged/node_modules/supports-color": { - "version": "9.2.2", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-9.2.2.tgz", - "integrity": "sha512-XC6g/Kgux+rJXmwokjm9ECpD6k/smUoS5LKlUCcsYr4IY3rW0XyAympon2RmxGrlnZURMpg5T18gWDP9CsHXFA==", - "dev": true, - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/chalk/supports-color?sponsor=1" - } - }, "node_modules/listr2": { "version": "4.0.5", "resolved": "https://registry.npmjs.org/listr2/-/listr2-4.0.5.tgz", @@ -22189,15 +22203,30 @@ } }, "node_modules/npm-run-path": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-4.0.1.tgz", - "integrity": "sha512-S48WzZW777zhNIrn7gxOlISNAqi9ZC/uQFnRdbeIHhZhCA6UqpkOT8T1G7BvfdgP4Er8gF4sUbaS0i7QvIfCWw==", + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-5.1.0.tgz", + "integrity": "sha512-sJOdmRGrY2sjNTRMbSvluQqg+8X7ZK61yvzBEIDhz4f8z1TZFYABsqjjCBd/0PUNE9M6QDgHJXQkGUEm7Q+l9Q==", "dev": true, "dependencies": { - "path-key": "^3.0.0" + "path-key": "^4.0.0" }, "engines": { - "node": ">=8" + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/npm-run-path/node_modules/path-key": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/path-key/-/path-key-4.0.0.tgz", + "integrity": "sha512-haREypq7xkM7ErfgIyA0z+Bj4AGKlMSdlQE2jvJo6huWD1EdkKYV+G/T4nq0YEF2vgTT8kqMFKo1uHn950r4SQ==", + "dev": true, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" } }, "node_modules/npmlog": { @@ -26597,12 +26626,15 @@ } }, "node_modules/strip-final-newline": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/strip-final-newline/-/strip-final-newline-2.0.0.tgz", - "integrity": "sha512-BrpvfNAE3dcvq7ll3xVumzjKjZQ5tI1sEUIKr3Uoks0XUl45St3FlatVqef9prk4jRDzhW6WZg+3bk93y6pLjA==", + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/strip-final-newline/-/strip-final-newline-3.0.0.tgz", + "integrity": "sha512-dOESqjYr96iWYylGObzd39EuNTa5VJxyvVAEm5Jnh7KGo75V43Hk1odPQkNDyXNmUR6k+gEiDVXnjB8HJ3crXw==", "dev": true, "engines": { - "node": ">=6" + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" } }, "node_modules/strip-hex-prefix": { @@ -28638,12 +28670,12 @@ "integrity": "sha512-a4UGQaWPH59mOXUYnAG2ewncQS4i4F43Tv3JoAM+s2VDAmS9NsK8GpDMLrCHPksFT7h3K6TOoUNn2pb7RoXx4g==" }, "node_modules/yaml": { - "version": "1.10.2", - "resolved": "https://registry.npmjs.org/yaml/-/yaml-1.10.2.tgz", - "integrity": "sha512-r3vXyErRCYJ7wg28yvBY5VSoAF8ZvlcW9/BwUzEtUsjvX/DKs24dIkuwjtuprwJJHsbyUbLApepYTR1BN4uHrg==", + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/yaml/-/yaml-2.1.1.tgz", + "integrity": "sha512-o96x3OPo8GjWeSLF+wOAbrPfhFOGY0W00GNaxCDv+9hkcDJEnev1yh8S7pgHF0ik6zc8sQLuL8hjHjJULZp8bw==", "dev": true, "engines": { - "node": ">= 6" + "node": ">= 14" } }, "node_modules/yargs": { @@ -36047,20 +36079,37 @@ } }, "execa": { - "version": "5.1.1", - "resolved": "https://registry.npmjs.org/execa/-/execa-5.1.1.tgz", - "integrity": "sha512-8uSpZZocAZRBAPIEINJj3Lo9HyGitllczc27Eh5YYojjMFMn8yHMDMaUHE2Jqfq05D/wucwI4JGURyXt1vchyg==", + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/execa/-/execa-6.1.0.tgz", + "integrity": "sha512-QVWlX2e50heYJcCPG0iWtf8r0xjEYfz/OYLGDYH+IyjWezzPNxz63qNFOu0l4YftGWuizFVZHHs8PrLU5p2IDA==", "dev": true, "requires": { "cross-spawn": "^7.0.3", - "get-stream": "^6.0.0", - "human-signals": "^2.1.0", - "is-stream": "^2.0.0", + "get-stream": "^6.0.1", + "human-signals": "^3.0.1", + "is-stream": "^3.0.0", "merge-stream": "^2.0.0", - "npm-run-path": "^4.0.1", - "onetime": "^5.1.2", - "signal-exit": "^3.0.3", - "strip-final-newline": "^2.0.0" + "npm-run-path": "^5.1.0", + "onetime": "^6.0.0", + "signal-exit": "^3.0.7", + "strip-final-newline": "^3.0.0" + }, + "dependencies": { + "mimic-fn": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-4.0.0.tgz", + "integrity": "sha512-vqiC06CuhBTUdZH+RYl8sFrL096vA45Ok5ISO6sE/Mr1jRbGH4Csnhi8f3wKVl7x8mO4Au7Ir9D3Oyv1VYMFJw==", + "dev": true + }, + "onetime": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/onetime/-/onetime-6.0.0.tgz", + "integrity": "sha512-1FlR+gjXK7X+AsAHso35MnyN5KqGwJRi/31ft6x0M194ht7S+rWAvd7PHss9xSKMzE0asv1pyIHaJYq+BbacAQ==", + "dev": true, + "requires": { + "mimic-fn": "^4.0.0" + } + } } }, "exit-hook": { @@ -43778,9 +43827,9 @@ } }, "human-signals": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/human-signals/-/human-signals-2.1.0.tgz", - "integrity": "sha512-B4FFZ6q/T2jhhksgkbEW3HBvWIfDW85snkQgawt07S7J5QXTk6BkNV+0yAeZrM5QpMAdYlocGoljn0sJ/WQkFw==", + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/human-signals/-/human-signals-3.0.1.tgz", + "integrity": "sha512-rQLskxnM/5OCldHo+wNXbpVgDn5A17CUoKX+7Sokwaknlq7CdSnphy0W39GU8dw59XiCXmFXDg4fRuckQRKewQ==", "dev": true }, "husky": { @@ -44271,9 +44320,9 @@ } }, "is-stream": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-2.0.1.tgz", - "integrity": "sha512-hFoiJiTl63nn+kstHGBtewWSKnQLpyb155KHheA1l39uvtO9nWIop1p3udqPcUd/xbF1VLMO4n7OI6p7RbngDg==", + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-3.0.0.tgz", + "integrity": "sha512-LnQR4bZ9IADDRSkvpqMGvt/tEJWclzklNgSw48V5EAaAeDd6qGvN8ei6k5p0tvxSR171VmGyHuTiAOfxAbr8kA==", "dev": true }, "is-string": { @@ -44635,16 +44684,16 @@ "dev": true }, "lint-staged": { - "version": "12.4.3", - "resolved": "https://registry.npmjs.org/lint-staged/-/lint-staged-12.4.3.tgz", - "integrity": "sha512-eH6SKOmdm/ZwCRMTZAmM3q3dPkpq6vco/BfrOw8iGun4Xs/thYegPD/MLIwKO+iPkzibkLJuQcRhRLXKvaKreg==", + "version": "13.0.0", + "resolved": "https://registry.npmjs.org/lint-staged/-/lint-staged-13.0.0.tgz", + "integrity": "sha512-vWban5utFt78VZohbosUxNIa46KKJ+KOQTDWTQ8oSl1DLEEVl9zhUtaQbiiydAmx+h2wKJK2d0+iMaRmknuWRQ==", "dev": true, "requires": { "cli-truncate": "^3.1.0", "colorette": "^2.0.16", "commander": "^9.3.0", "debug": "^4.3.4", - "execa": "^5.1.1", + "execa": "^6.1.0", "lilconfig": "2.0.5", "listr2": "^4.0.5", "micromatch": "^4.0.5", @@ -44652,8 +44701,7 @@ "object-inspect": "^1.12.2", "pidtree": "^0.5.0", "string-argv": "^0.3.1", - "supports-color": "^9.2.2", - "yaml": "^1.10.2" + "yaml": "^2.1.1" }, "dependencies": { "commander": { @@ -44661,12 +44709,6 @@ "resolved": "https://registry.npmjs.org/commander/-/commander-9.3.0.tgz", "integrity": "sha512-hv95iU5uXPbK83mjrJKuZyFM/LBAoCV/XhVGkS5Je6tl7sxr6A0ITMw5WoRV46/UaJ46Nllm3Xt7IaJhXTIkzw==", "dev": true - }, - "supports-color": { - "version": "9.2.2", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-9.2.2.tgz", - "integrity": "sha512-XC6g/Kgux+rJXmwokjm9ECpD6k/smUoS5LKlUCcsYr4IY3rW0XyAympon2RmxGrlnZURMpg5T18gWDP9CsHXFA==", - "dev": true } } }, @@ -45898,12 +45940,20 @@ "integrity": "sha512-9UZCFRHQdNrfTpGg8+1INIg93B6zE0aXMVFkw1WFwvO4SlZywU6aLg5Of0Ap/PgcbSw4LNxvMWXMeugwMCX0AA==" }, "npm-run-path": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-4.0.1.tgz", - "integrity": "sha512-S48WzZW777zhNIrn7gxOlISNAqi9ZC/uQFnRdbeIHhZhCA6UqpkOT8T1G7BvfdgP4Er8gF4sUbaS0i7QvIfCWw==", + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-5.1.0.tgz", + "integrity": "sha512-sJOdmRGrY2sjNTRMbSvluQqg+8X7ZK61yvzBEIDhz4f8z1TZFYABsqjjCBd/0PUNE9M6QDgHJXQkGUEm7Q+l9Q==", "dev": true, "requires": { - "path-key": "^3.0.0" + "path-key": "^4.0.0" + }, + "dependencies": { + "path-key": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/path-key/-/path-key-4.0.0.tgz", + "integrity": "sha512-haREypq7xkM7ErfgIyA0z+Bj4AGKlMSdlQE2jvJo6huWD1EdkKYV+G/T4nq0YEF2vgTT8kqMFKo1uHn950r4SQ==", + "dev": true + } } }, "npmlog": { @@ -49302,9 +49352,9 @@ "integrity": "sha1-u0P/VZim6wXYm1n80SnJgzE2Br8=" }, "strip-final-newline": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/strip-final-newline/-/strip-final-newline-2.0.0.tgz", - "integrity": "sha512-BrpvfNAE3dcvq7ll3xVumzjKjZQ5tI1sEUIKr3Uoks0XUl45St3FlatVqef9prk4jRDzhW6WZg+3bk93y6pLjA==", + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/strip-final-newline/-/strip-final-newline-3.0.0.tgz", + "integrity": "sha512-dOESqjYr96iWYylGObzd39EuNTa5VJxyvVAEm5Jnh7KGo75V43Hk1odPQkNDyXNmUR6k+gEiDVXnjB8HJ3crXw==", "dev": true }, "strip-hex-prefix": { @@ -50944,9 +50994,9 @@ "integrity": "sha512-a4UGQaWPH59mOXUYnAG2ewncQS4i4F43Tv3JoAM+s2VDAmS9NsK8GpDMLrCHPksFT7h3K6TOoUNn2pb7RoXx4g==" }, "yaml": { - "version": "1.10.2", - "resolved": "https://registry.npmjs.org/yaml/-/yaml-1.10.2.tgz", - "integrity": "sha512-r3vXyErRCYJ7wg28yvBY5VSoAF8ZvlcW9/BwUzEtUsjvX/DKs24dIkuwjtuprwJJHsbyUbLApepYTR1BN4uHrg==", + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/yaml/-/yaml-2.1.1.tgz", + "integrity": "sha512-o96x3OPo8GjWeSLF+wOAbrPfhFOGY0W00GNaxCDv+9hkcDJEnev1yh8S7pgHF0ik6zc8sQLuL8hjHjJULZp8bw==", "dev": true }, "yargs": { diff --git a/package.json b/package.json index 7967b8e1b..1cb7764ee 100644 --- a/package.json +++ b/package.json @@ -91,7 +91,7 @@ "ethereum-waffle": "^3.4.4", "ethers": "^5.6.8", "husky": "^8.0.1", - "lint-staged": "^12.4.3", + "lint-staged": "^13.0.0", "mocha": "^10.0.0", "mocha-junit-reporter": "^2.0.2", "mocha-multi-reporters": "^1.5.1", From 9ae175ac6f39567beff3dde25d554806473b53d4 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 1 Jun 2022 09:40:37 +0000 Subject: [PATCH 170/274] build(deps-dev): bump @types/node from 17.0.36 to 17.0.38 Bumps [@types/node](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/node) from 17.0.36 to 17.0.38. - [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases) - [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/node) --- updated-dependencies: - dependency-name: "@types/node" dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- package-lock.json | 14 +++++++------- package.json | 2 +- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/package-lock.json b/package-lock.json index d5685461d..0c7c9c94b 100644 --- a/package-lock.json +++ b/package-lock.json @@ -39,7 +39,7 @@ "@typechain/hardhat": "^2.3.0", "@types/chai": "^4.3.1", "@types/mocha": "^9.1.1", - "@types/node": "^17.0.36", + "@types/node": "^17.0.38", "@typescript-eslint/eslint-plugin": "^4.31.2", "@typescript-eslint/parser": "^4.31.2", "chai-bn": "^0.3.1", @@ -4478,9 +4478,9 @@ "dev": true }, "node_modules/@types/node": { - "version": "17.0.36", - "resolved": "https://registry.npmjs.org/@types/node/-/node-17.0.36.tgz", - "integrity": "sha512-V3orv+ggDsWVHP99K3JlwtH20R7J4IhI1Kksgc+64q5VxgfRkQG8Ws3MFm/FZOKDYGy9feGFlZ70/HpCNe9QaA==" + "version": "17.0.38", + "resolved": "https://registry.npmjs.org/@types/node/-/node-17.0.38.tgz", + "integrity": "sha512-5jY9RhV7c0Z4Jy09G+NIDTsCZ5G0L5n+Z+p+Y7t5VJHM30bgwzSjVtlcBxqAj+6L/swIlvtOSzr8rBk/aNyV2g==" }, "node_modules/@types/node-fetch": { "version": "2.6.1", @@ -32403,9 +32403,9 @@ "dev": true }, "@types/node": { - "version": "17.0.36", - "resolved": "https://registry.npmjs.org/@types/node/-/node-17.0.36.tgz", - "integrity": "sha512-V3orv+ggDsWVHP99K3JlwtH20R7J4IhI1Kksgc+64q5VxgfRkQG8Ws3MFm/FZOKDYGy9feGFlZ70/HpCNe9QaA==" + "version": "17.0.38", + "resolved": "https://registry.npmjs.org/@types/node/-/node-17.0.38.tgz", + "integrity": "sha512-5jY9RhV7c0Z4Jy09G+NIDTsCZ5G0L5n+Z+p+Y7t5VJHM30bgwzSjVtlcBxqAj+6L/swIlvtOSzr8rBk/aNyV2g==" }, "@types/node-fetch": { "version": "2.6.1", diff --git a/package.json b/package.json index 7967b8e1b..b047bcace 100644 --- a/package.json +++ b/package.json @@ -79,7 +79,7 @@ "@typechain/hardhat": "^2.3.0", "@types/chai": "^4.3.1", "@types/mocha": "^9.1.1", - "@types/node": "^17.0.36", + "@types/node": "^17.0.38", "@typescript-eslint/eslint-plugin": "^4.31.2", "@typescript-eslint/parser": "^4.31.2", "chai-bn": "^0.3.1", From 5059f950e2ae26bc1ae5a30b9f3dd633739c54db Mon Sep 17 00:00:00 2001 From: thomas-waite Date: Wed, 1 Jun 2022 14:09:00 +0100 Subject: [PATCH 171/274] test: get tests passing --- test/integration/tests/psm.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/integration/tests/psm.ts b/test/integration/tests/psm.ts index e1c313218..dcd06e3fc 100644 --- a/test/integration/tests/psm.ts +++ b/test/integration/tests/psm.ts @@ -409,7 +409,7 @@ describe('e2e-peg-stability-module', function () { await rai.connect(raiWhaleSigner).transfer(raiPriceBoundPSM.address, redeemAmount); // Set floor to something sufficiently low for tests to pass - RAI price on-chain fluctuates - await raiPriceBoundPSM.connect(impersonatedSigners[governorAddress]).setOracleFloorBasisPoints(25000); + await raiPriceBoundPSM.connect(impersonatedSigners[userAddress]).setOracleFloorBasisPoints(25000); }); it('exchanges 1000 FEI for rai', async () => { @@ -463,7 +463,7 @@ describe('e2e-peg-stability-module', function () { await rai.connect(impersonatedSigners[userAddress]).approve(raiPriceBoundPSM.address, mintAmount * 2); // Set floor to something sufficiently low for tests to pass - RAI price on-chain fluctuates - await raiPriceBoundPSM.connect(impersonatedSigners[governorAddress]).setOracleFloorBasisPoints(2500); + await raiPriceBoundPSM.connect(impersonatedSigners[userAddress]).setOracleFloorBasisPoints(2500); }); it('cannot mint because the rai psm is paused', async () => { From 7f13e222a0eeece1b4f267f83fc9930885e81b13 Mon Sep 17 00:00:00 2001 From: thomas-waite Date: Wed, 1 Jun 2022 15:07:28 +0100 Subject: [PATCH 172/274] docs: add detailed explanation for oracle price --- test/unit/refs/OracleRef.test.ts | 25 ++++++++++++++++++------- 1 file changed, 18 insertions(+), 7 deletions(-) diff --git a/test/unit/refs/OracleRef.test.ts b/test/unit/refs/OracleRef.test.ts index 6377fa0d1..96a5bcab6 100644 --- a/test/unit/refs/OracleRef.test.ts +++ b/test/unit/refs/OracleRef.test.ts @@ -167,17 +167,28 @@ describe('OracleRef', () => { ); }); - it('positive decimal normalizer scales down', async function () { - await this.oracleRef.connect(impersonatedSigners[governorAddress]).setDecimalsNormalizer(4), - expect((await this.oracleRef.connect(impersonatedSigners[userAddress]).readOracle())[0]).to.be.equal( - '200000000000' - ); + it('positive decimal normalizer scales up', async function () { + // Raw peg price: 500000000000000000000, 500e18 + // Inversion is set to True by default in ReserveStabilizer + // Price after inversion = (1e18 * 1e18) / 500e18 = 0.2e16 = 2e15 + // Scaling factor is set to 1e4. After applying scaling factor + // 2e15 * 1e4 = 2e19 = 20000000000000000000 + await this.oracleRef.connect(impersonatedSigners[governorAddress]).setDecimalsNormalizer(4); + + expect((await this.oracleRef.connect(impersonatedSigners[userAddress]).readOracle())[0]).to.be.equal( + '20000000000000000000' + ); }); - it('negative decimal normalizer scales up', async function () { + it('negative decimal normalizer scales down', async function () { + // Raw peg price: 500000000000000000000, 500e18 + // Inversion is set to True by default in ReserveStabilizer + // Price after inversion = (1e18 * 1e18) / 500e18 = 0.2e16 = 2e15 + // Scaling factor is set to -1e4. After applying scaling factor + // 2e15 / 1e4 = 2e11 = 200000000000 await this.oracleRef.connect(impersonatedSigners[governorAddress]).setDecimalsNormalizer(-4), expect((await this.oracleRef.connect(impersonatedSigners[userAddress]).readOracle())[0]).to.be.equal( - '20000000000000000000' + '200000000000' ); }); }); From d1bff39e5f0f50678faaccf30d293da835f2fd13 Mon Sep 17 00:00:00 2001 From: thomas-waite Date: Wed, 1 Jun 2022 17:22:37 +0100 Subject: [PATCH 173/274] feat: initial proposal setup --- proposals/dao/end-tribe-incentives.ts | 58 +++++++++++++++++++ proposals/description/end-tribe-incentives.ts | 32 ++++++++++ 2 files changed, 90 insertions(+) create mode 100644 proposals/dao/end-tribe-incentives.ts create mode 100644 proposals/description/end-tribe-incentives.ts diff --git a/proposals/dao/end-tribe-incentives.ts b/proposals/dao/end-tribe-incentives.ts new file mode 100644 index 000000000..c6a3c68d3 --- /dev/null +++ b/proposals/dao/end-tribe-incentives.ts @@ -0,0 +1,58 @@ +import hre, { ethers, artifacts } from 'hardhat'; +import { expect } from 'chai'; +import { + DeployUpgradeFunc, + NamedAddresses, + SetupUpgradeFunc, + TeardownUpgradeFunc, + ValidateUpgradeFunc +} from '@custom-types/types'; + +/* + +TIP-109: Discontinue Tribe Incentives + +Ends all Tribe Incentives being distributed + +Steps: +1. Mass update all pools registered for Tribe rewards, so they have all rewards they are entitled to so far +2. Set TribalChief block reward to zero, to stop distributing new rewards +3. Calculate how much TRIBE the reward receivers have accrued, x +4. Withdraw balance(TribalChief) - x amount of Tribe from the TribalChief contract +5. Stop displaying Tribe rewards on the UIs: + - + + +*/ + +const fipNumber = 'TIP-109: Discontinue Tribe Incentives'; + +// Do any deployments +// This should exclusively include new contract deployments +const deploy: DeployUpgradeFunc = async (deployAddress: string, addresses: NamedAddresses, logging: boolean) => { + console.log(`No deploy actions for fip${fipNumber}`); + return { + // put returned contract objects here + }; +}; + +// Do any setup necessary for running the test. +// This could include setting up Hardhat to impersonate accounts, +// ensuring contracts have a specific state, etc. +const setup: SetupUpgradeFunc = async (addresses, oldContracts, contracts, logging) => { + console.log(`No actions to complete in setup for fip${fipNumber}`); +}; + +// Tears down any changes made in setup() that need to be +// cleaned up before doing any validation checks. +const teardown: TeardownUpgradeFunc = async (addresses, oldContracts, contracts, logging) => { + console.log(`No actions to complete in teardown for fip${fipNumber}`); +}; + +// Run any validations required on the fip using mocha or console logging +// IE check balances, check state of contracts, etc. +const validate: ValidateUpgradeFunc = async (addresses, oldContracts, contracts, logging) => { + console.log(`No actions to complete in validate for fip${fipNumber}`); +}; + +export { deploy, setup, teardown, validate }; diff --git a/proposals/description/end-tribe-incentives.ts b/proposals/description/end-tribe-incentives.ts new file mode 100644 index 000000000..7cd7f5e66 --- /dev/null +++ b/proposals/description/end-tribe-incentives.ts @@ -0,0 +1,32 @@ +import { ProposalDescription } from '@custom-types/types'; + +const end_tribe_incentives: ProposalDescription = { + // Pool ID is where the pool is in the array + title: 'TIP-109: Discontinue Tribe Incentives', + commands: [ + { + target: 'tribalChief', + values: '0', + method: 'massUpdatePools(uint256[])', + arguments: [['0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11', '12', '13', '14', '15', '16', '17']], + description: 'Update reward variables on all pools registered for Tribe rewards' + }, + { + target: 'tribalChief', + values: '0', + method: 'updateBlockReward(uint256)', + arguments: ['0'], + description: 'Set Tribal Chief block reward to 0' + } + // TODO: Harvest deposits + // TODO: Sync up deposits + ], + description: ` + TIP-109: Discontinue Tribe Incentives + + This proposal will disable all Tribe incentives. It updates the reward variables of incentivised pools and then + sets the amount of Tribe issued per block by the Tribal Chief to 0. + ` +}; + +export default end_tribe_incentives; From 240c75b416bba9c85a5efa09e8b003f6e437fa36 Mon Sep 17 00:00:00 2001 From: thomas-waite Date: Wed, 1 Jun 2022 17:56:24 +0100 Subject: [PATCH 174/274] style: cleanup --- proposals/dao/end-tribe-incentives.ts | 13 ++++++------- proposals/description/end-tribe-incentives.ts | 2 -- 2 files changed, 6 insertions(+), 9 deletions(-) diff --git a/proposals/dao/end-tribe-incentives.ts b/proposals/dao/end-tribe-incentives.ts index c6a3c68d3..410627e32 100644 --- a/proposals/dao/end-tribe-incentives.ts +++ b/proposals/dao/end-tribe-incentives.ts @@ -17,12 +17,6 @@ Ends all Tribe Incentives being distributed Steps: 1. Mass update all pools registered for Tribe rewards, so they have all rewards they are entitled to so far 2. Set TribalChief block reward to zero, to stop distributing new rewards -3. Calculate how much TRIBE the reward receivers have accrued, x -4. Withdraw balance(TribalChief) - x amount of Tribe from the TribalChief contract -5. Stop displaying Tribe rewards on the UIs: - - - - */ const fipNumber = 'TIP-109: Discontinue Tribe Incentives'; @@ -52,7 +46,12 @@ const teardown: TeardownUpgradeFunc = async (addresses, oldContracts, contracts, // Run any validations required on the fip using mocha or console logging // IE check balances, check state of contracts, etc. const validate: ValidateUpgradeFunc = async (addresses, oldContracts, contracts, logging) => { - console.log(`No actions to complete in validate for fip${fipNumber}`); + const tribalChief = contracts.tribalChief; + + // 1. Verify TribalChief block rewards are 0 + expect(await tribalChief.tribePerBlock()).to.equal(0); + + // 2. Validate reward arithmetic is functional }; export { deploy, setup, teardown, validate }; diff --git a/proposals/description/end-tribe-incentives.ts b/proposals/description/end-tribe-incentives.ts index 7cd7f5e66..1209a6f96 100644 --- a/proposals/description/end-tribe-incentives.ts +++ b/proposals/description/end-tribe-incentives.ts @@ -18,8 +18,6 @@ const end_tribe_incentives: ProposalDescription = { arguments: ['0'], description: 'Set Tribal Chief block reward to 0' } - // TODO: Harvest deposits - // TODO: Sync up deposits ], description: ` TIP-109: Discontinue Tribe Incentives From 913b87bbdbb3b66169fad4bfcc66395f33145d0f Mon Sep 17 00:00:00 2001 From: Caleb Date: Wed, 1 Jun 2022 12:29:46 -0700 Subject: [PATCH 175/274] update block --- block.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/block.txt b/block.txt index 129d70f2a..9b1e67051 100644 --- a/block.txt +++ b/block.txt @@ -1 +1 @@ -14845243 \ No newline at end of file +14886595 \ No newline at end of file From f87b9fe60a6d760fe5b22614f4311f847f1a7d30 Mon Sep 17 00:00:00 2001 From: Caleb Date: Wed, 1 Jun 2022 12:33:09 -0700 Subject: [PATCH 176/274] block too current --- block.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/block.txt b/block.txt index 9b1e67051..5e665baa4 100644 --- a/block.txt +++ b/block.txt @@ -1 +1 @@ -14886595 \ No newline at end of file +14886500 \ No newline at end of file From 3636a628e65ed2d56da663164acabe238f156c59 Mon Sep 17 00:00:00 2001 From: Caleb Date: Wed, 1 Jun 2022 12:39:21 -0700 Subject: [PATCH 177/274] remove from deprecated contract signoff --- test/integration/proposals_config.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/integration/proposals_config.ts b/test/integration/proposals_config.ts index 11b5d90a9..89f01130a 100644 --- a/test/integration/proposals_config.ts +++ b/test/integration/proposals_config.ts @@ -8,7 +8,7 @@ const proposals: ProposalsConfigMap = { proposal: repay_fuse_bad_debt, // full proposal file, imported from '@proposals/description/fip_xx.ts' proposalId: '', affectedContractSignoff: ['core', 'fuseFixer', 'pcvGuardianNew'], - deprecatedContractSignoff: [''], + deprecatedContractSignoff: [], category: ProposalCategory.TC } }; From 228e0d983b59c517c31e154d049549057a51b908 Mon Sep 17 00:00:00 2001 From: Caleb Date: Wed, 1 Jun 2022 12:46:41 -0700 Subject: [PATCH 178/274] update block --- block.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/block.txt b/block.txt index 5e665baa4..98722397b 100644 --- a/block.txt +++ b/block.txt @@ -1 +1 @@ -14886500 \ No newline at end of file +14885000 \ No newline at end of file From 29196f0b83c8a72113e4e728a06dda8930ac306f Mon Sep 17 00:00:00 2001 From: thomas-waite Date: Wed, 1 Jun 2022 21:41:17 +0100 Subject: [PATCH 179/274] deps: include core as a dep --- test/integration/proposals_config.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/integration/proposals_config.ts b/test/integration/proposals_config.ts index dd620f9ce..b4a969e96 100644 --- a/test/integration/proposals_config.ts +++ b/test/integration/proposals_config.ts @@ -8,7 +8,7 @@ const proposals: ProposalsConfigMap = { totalValue: 0, // amount of ETH to send to DAO execution proposal: register_proposal, // full proposal file, imported from '@proposals/description/fip_xx.ts' proposalId: '', - affectedContractSignoff: [], + affectedContractSignoff: ['core'], deprecatedContractSignoff: [], category: ProposalCategory.TC }, From 438ae81b03c07b29764fa297aeba9da7d22548ed Mon Sep 17 00:00:00 2001 From: thomas-waite Date: Wed, 1 Jun 2022 22:26:51 +0100 Subject: [PATCH 180/274] test: add harvest integration test --- proposals/dao/end-tribe-incentives.ts | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/proposals/dao/end-tribe-incentives.ts b/proposals/dao/end-tribe-incentives.ts index 410627e32..cc9c17aea 100644 --- a/proposals/dao/end-tribe-incentives.ts +++ b/proposals/dao/end-tribe-incentives.ts @@ -7,6 +7,7 @@ import { TeardownUpgradeFunc, ValidateUpgradeFunc } from '@custom-types/types'; +import { getImpersonatedSigner } from '@test/helpers'; /* @@ -46,12 +47,25 @@ const teardown: TeardownUpgradeFunc = async (addresses, oldContracts, contracts, // Run any validations required on the fip using mocha or console logging // IE check balances, check state of contracts, etc. const validate: ValidateUpgradeFunc = async (addresses, oldContracts, contracts, logging) => { + const tribe = contracts.tribe; const tribalChief = contracts.tribalChief; // 1. Verify TribalChief block rewards are 0 expect(await tribalChief.tribePerBlock()).to.equal(0); - // 2. Validate reward arithmetic is functional + // 2. Validate that can harvest Tribe rewards + const receiver = '0xbEA4B2357e8ec53AF60BbcA4bc570332a7C7E232'; + const initialBalance = await tribe.balanceOf(receiver); + + const poolId = 0; // UniswapV2 Fei-Tribe LP pool + + const stakerInFeiTribe = '0x7d809969f6a04777f0a87ff94b57e56078e5fe0f'; + const stakerInFeiTribeSigner = await getImpersonatedSigner(stakerInFeiTribe); + + await tribalChief.connect(stakerInFeiTribeSigner).harvest(poolId, receiver); + const finalBalance = await tribe.balanceOf(receiver); + + expect(finalBalance.sub(initialBalance)).to.be.bignumber.at.least(0); }; export { deploy, setup, teardown, validate }; From 6a772f9e40fb362e9158e140f09398cfc55379d0 Mon Sep 17 00:00:00 2001 From: Erwan Beauvois Date: Tue, 31 May 2022 17:52:43 +0200 Subject: [PATCH 181/274] remove duplicates in mainnetAddresses --- proposals/dao/balancer_gauge_fix.ts | 4 +- proposals/dao/oa_cr_fix.ts | 4 +- protocol-configuration/dependencies.ts | 25 +++--- protocol-configuration/mainnetAddresses.ts | 90 ++----------------- protocol-configuration/permissions.ts | 2 +- protocol-configuration/tribalchief.ts | 2 +- scripts/deploy/old/optimisticTimelock.ts | 6 +- .../tests/balancer-weightedpool.ts | 20 ++--- test/integration/tests/dao.ts | 16 ++-- test/integration/tests/dependencies.ts | 19 ++++ test/integration/tests/ethPSM.ts | 6 +- test/integration/tests/lusdPSM.ts | 2 +- .../tests/old/migrateProxies/index.ts | 14 +-- test/integration/tests/podOperation.ts | 4 +- test/integration/tests/staking.ts | 4 +- types/types.ts | 17 ++-- 16 files changed, 84 insertions(+), 151 deletions(-) diff --git a/proposals/dao/balancer_gauge_fix.ts b/proposals/dao/balancer_gauge_fix.ts index ae012bf59..78a381fc4 100644 --- a/proposals/dao/balancer_gauge_fix.ts +++ b/proposals/dao/balancer_gauge_fix.ts @@ -58,7 +58,7 @@ const deploy: DeployUpgradeFunc = async (deployAddress: string, addresses: Named const balancerPool2LensFactory = await ethers.getContractFactory('BalancerPool2Lens'); const balancerLensBpt30Fei70Weth = await balancerPool2LensFactory.deploy( gaugeLensBpt30Fei70WethGauge.address, // address _depositAddress - addresses.wethERC20, // address _token + addresses.weth, // address _token '0x90291319f1d4ea3ad4db0dd8fe9e12baf749e845', // IWeightedPool _pool addresses.chainlinkEthUsdOracleWrapper, // IOracle _reportedOracle addresses.oneConstantOracle, // IOracle _otherOracle @@ -112,7 +112,7 @@ const validate: ValidateUpgradeFunc = async (addresses, oldContracts, contracts, // check rewards can be claimed await time.increase('86400'); const balBalanceBefore = await contracts.bal.balanceOf(addresses.balancerGaugeStaker); - await contracts.balancerGaugeStaker.mintGaugeRewards(addresses.balancerFeiWethPool); + await contracts.balancerGaugeStaker.mintGaugeRewards(addresses.bpt30Fei70Weth); const balBalanceAfter = await contracts.bal.balanceOf(addresses.balancerGaugeStaker); expect(balBalanceAfter.sub(balBalanceBefore)).to.be.at.least(`1${e18}`); diff --git a/proposals/dao/oa_cr_fix.ts b/proposals/dao/oa_cr_fix.ts index f86f04563..d9a966e47 100644 --- a/proposals/dao/oa_cr_fix.ts +++ b/proposals/dao/oa_cr_fix.ts @@ -20,8 +20,8 @@ const deploy: DeployUpgradeFunc = async (deployAddress: string, addresses: Named const balancerPool2LensFactory = await ethers.getContractFactory('BalancerPool2Lens'); const balancerLensBpt30Fei70Weth = await balancerPool2LensFactory.deploy( addresses.gaugeLensBpt30Fei70WethGauge, // address _depositAddress - addresses.wethERC20, // address _token - addresses.balancerFeiWethPool, // IWeightedPool _pool + addresses.weth, // address _token + addresses.bpt30Fei70Weth, // IWeightedPool _pool addresses.chainlinkEthUsdOracleWrapper, // IOracle _reportedOracle addresses.oneConstantOracle, // IOracle _otherOracle false, // bool _feiIsReportedIn diff --git a/protocol-configuration/dependencies.ts b/protocol-configuration/dependencies.ts index 2543725c5..23a87b28c 100644 --- a/protocol-configuration/dependencies.ts +++ b/protocol-configuration/dependencies.ts @@ -71,13 +71,12 @@ const dependencies: DependencyMap = { 'ethLidoPCVDeposit', 'ethTokemakPCVDeposit', 'feiLusdLBPSwapper', - 'indexCoopFusePoolDpiPCVDeposit', - 'indexCoopFusePoolFeiPCVDeposit', + 'rariPool19DpiPCVDeposit', + 'rariPool19FeiPCVDeposit', 'indexDelegator', - 'poolPartyFeiPCVDeposit', + 'rariPool18Fei', 'rariTimelock', 'rariPool18FeiPCVDeposit', - 'rariPool19FeiPCVDeposit', 'rariPool22FeiPCVDeposit', 'rariPool24FeiPCVDeposit', 'rariPool26FeiPCVDeposit', @@ -90,7 +89,7 @@ const dependencies: DependencyMap = { 'rariPool8FeiPCVDeposit', 'rariPool91FeiPCVDeposit', 'rariPool9FeiPCVDeposit', - 'reflexerStableAssetFusePoolRaiPCVDeposit', + 'rariPool9RaiPCVDeposit', 'tokeTokemakPCVDeposit', 'uniswapPCVDeposit', 'collateralizationOracle', @@ -151,10 +150,9 @@ const dependencies: DependencyMap = { 'lusdPSMFeiSkimmer', 'aaveFeiPCVDeposit', 'agEurAngleUniswapPCVDeposit', - 'indexCoopFusePoolFeiPCVDeposit', - 'poolPartyFeiPCVDeposit', - 'rariPool18FeiPCVDeposit', 'rariPool19FeiPCVDeposit', + 'rariPool18Fei', + 'rariPool18FeiPCVDeposit', 'rariPool22FeiPCVDeposit', 'rariPool24FeiPCVDeposit', 'rariPool26FeiPCVDeposit', @@ -379,16 +377,16 @@ const dependencies: DependencyMap = { feiLusdLBPSwapper: { contractDependencies: ['core', 'chainlinkLUSDOracleWrapper'] }, - indexCoopFusePoolDpiPCVDeposit: { + rariPool19DpiPCVDeposit: { contractDependencies: ['core'] }, - indexCoopFusePoolFeiPCVDeposit: { + rariPool19FeiPCVDeposit: { contractDependencies: ['core', 'fei'] }, indexDelegator: { contractDependencies: ['core'] }, - poolPartyFeiPCVDeposit: { + rariPool18Fei: { contractDependencies: ['core', 'fei'] }, rariPool146Comptroller: { @@ -403,9 +401,6 @@ const dependencies: DependencyMap = { rariPool18FeiPCVDeposit: { contractDependencies: ['core', 'fei'] }, - rariPool19FeiPCVDeposit: { - contractDependencies: ['core', 'fei'] - }, rariPool22FeiPCVDeposit: { contractDependencies: ['core', 'fei', 'rariPool22FeiPCVDepositWrapper'] }, @@ -442,7 +437,7 @@ const dependencies: DependencyMap = { rariPool9FeiPCVDeposit: { contractDependencies: ['core', 'fei'] }, - reflexerStableAssetFusePoolRaiPCVDeposit: { + rariPool9RaiPCVDeposit: { contractDependencies: ['core'] }, tokeTokemakPCVDeposit: { diff --git a/protocol-configuration/mainnetAddresses.ts b/protocol-configuration/mainnetAddresses.ts index e7301939b..cff380d1b 100644 --- a/protocol-configuration/mainnetAddresses.ts +++ b/protocol-configuration/mainnetAddresses.ts @@ -2,7 +2,7 @@ import { MainnetAddresses, AddressCategory } from '../types/types'; // imported const MainnetAddresses: MainnetAddresses = { core: { - artifactName: AddressCategory.Core, + artifactName: 'Core', address: '0x8d5ED43dCa8C2F7dFB20CF7b53CC7E593635d7b9', category: AddressCategory.Core }, @@ -81,7 +81,7 @@ const MainnetAddresses: MainnetAddresses = { address: '0xd51dbA7a94e1adEa403553A8235C302cEbF41a3c', category: AddressCategory.Governance }, - guardian: { + guardianMultisig: { artifactName: 'unknown', address: '0xB8f482539F2d3Ae2C9ea6076894df36D1f632775', category: AddressCategory.Governance @@ -226,16 +226,6 @@ const MainnetAddresses: MainnetAddresses = { address: '0xac38ee05c0204a1e119c625d0a560d6731478880', category: AddressCategory.PCV_V1 }, - indexCoopFusePoolDpiPCVDeposit: { - artifactName: 'ERC20CompoundPCVDeposit', - address: '0x3dD3d945C4253bAc5B4Cc326a001B7d3f9C4DD66', - category: AddressCategory.PCV_V1 - }, - indexCoopFusePoolFeiPCVDeposit: { - artifactName: 'ERC20CompoundPCVDeposit', - address: '0xD6960adba53212bBE96E54a7AFeDA2066437D000', - category: AddressCategory.PCV_V1 - }, indexDelegator: { artifactName: 'SnapshotDelegatorPCVDeposit', address: '0x0ee81df08B20e4f9E0F534e50da437D24491c4ee', @@ -356,11 +346,6 @@ const MainnetAddresses: MainnetAddresses = { address: '0x374628EBE7Ef6AcA0574e750B618097531A26Ff8', category: AddressCategory.PCV }, - balancerFeiWethPool: { - artifactName: 'IWeightedPool', - address: '0x90291319F1D4eA3ad4dB0Dd8fe9E12BAF749E845', - category: AddressCategory.External - }, delayedPCVMoverWethUniToBal: { artifactName: 'DelayedPCVMover', address: '0x52B1D5BE5005002afD76193ADd3a827c18e2db99', @@ -1341,11 +1326,6 @@ const MainnetAddresses: MainnetAddresses = { address: '0x6c3F90f043a72FA612cbac8115EE7e52BDe6E490', category: AddressCategory.External }, - curve3Metapool: { - artifactName: 'IERC20', - address: '0x06cb22615BA53E60D67Bf6C341a0fD5E718E1655', - category: AddressCategory.External - }, curve3pool: { artifactName: 'unknown', address: '0xbebc44782c7db0a1a60cb6fe97d0b483032ff1c7', @@ -1356,9 +1336,9 @@ const MainnetAddresses: MainnetAddresses = { address: '0xBaaa1F5DbA42C3389bDbc2c9D2dE134F5cD0Dc89', category: AddressCategory.External }, - curveMetapool: { - artifactName: 'unknown', - address: '0x06cb22615ba53e60d67bf6c341a0fd5e718e1655', + curveFei3crvMetapool: { + artifactName: 'IERC20', + address: '0x06cb22615BA53E60D67Bf6C341a0fD5E718E1655', category: AddressCategory.External }, cvx: { @@ -1376,11 +1356,6 @@ const MainnetAddresses: MainnetAddresses = { address: '0x1494CA1F11D487c2bBe4543E90080AeBa4BA3C2b', category: AddressCategory.External }, - fAAVE: { - artifactName: 'IERC20', - address: '0x4da27a545c0c5b758a6ba100e3a049001de870f5', - category: AddressCategory.External - }, feiEthPair: { artifactName: 'IUniswapV2Pair', address: '0x94B0A3d511b6EcDb17eBF877278Ab030acb0A878', @@ -1456,16 +1431,6 @@ const MainnetAddresses: MainnetAddresses = { address: '0x0954906da0Bf32d5479e25f46056d22f08464cab', category: AddressCategory.External }, - indexCoopFusePoolDpi: { - artifactName: 'CErc20Delegator', - address: '0xf06f65a6b7d2c401fcb8b3273d036d21fe2a5963', - category: AddressCategory.External - }, - indexCoopFusePoolFei: { - artifactName: 'CErc20Delegator', - address: '0x04281F6715Dea6A8EbBCE143D86ea506FF326531', - category: AddressCategory.External - }, kashiFeiDPI: { artifactName: 'IKashiPair', address: '0xf352773f1d4d69deb4de8d0578e43b993ee76e5d', @@ -1511,11 +1476,6 @@ const MainnetAddresses: MainnetAddresses = { address: '0x0B36b0F351ea8383506F596743a2DA7DCa204cc3', category: AddressCategory.External }, - poolPartyFei: { - artifactName: 'CErc20Delegator', - address: '0x17b1A2E012cC4C31f83B90FF11d3942857664efc', - category: AddressCategory.External - }, rai: { artifactName: 'IERC20', address: '0x03ab458634910AaD20eF5f1C8ee96F1D6ac54919', @@ -1586,11 +1546,6 @@ const MainnetAddresses: MainnetAddresses = { address: '0x6c806eDDAd78A5505Fce27B18C6f859fc9739BEc', category: AddressCategory.External }, - reflexerStableAssetFusePoolRai: { - artifactName: 'CErc20Delegator', - address: '0x752F119bD4Ee2342CE35E2351648d21962c7CAfE', - category: AddressCategory.External - }, rgt: { artifactName: 'ERC20VotesComp', address: '0xD291E7a03283640FDc51b121aC401383A46cC623', @@ -1661,21 +1616,11 @@ const MainnetAddresses: MainnetAddresses = { address: '0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2', category: AddressCategory.External }, - wethERC20: { - artifactName: 'IERC20', - address: '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2', - category: AddressCategory.External - }, aavePassthroughETH: { artifactName: 'unknown', // AavePassthroughETH address: '0x126AD2B5341A30D8115C443B3158E7661e4faD26', category: AddressCategory.Deprecated }, - aaveTribeIncentivesControllerProxy: { - artifactName: 'TransparentUpgradeableProxy', - address: '0xDee5c1662bBfF8f80f7c572D8091BF251b3B0dAB', - category: AddressCategory.Deprecated - }, balDepositWrapper: { artifactName: 'ERC20PCVDepositWrapper', address: '0x7E28BA7a2D52Af88242E588d868E927119BA45dB', @@ -1686,11 +1631,6 @@ const MainnetAddresses: MainnetAddresses = { address: '0xF56B0B80ea6E986364c50177d396b988C3e41094', category: AddressCategory.Deprecated }, - coreV1: { - artifactName: 'ICoreV1', - address: '0x8d5ED43dCa8C2F7dFB20CF7b53CC7E593635d7b9', - category: AddressCategory.Deprecated - }, daiBondingCurve: { artifactName: 'unknown', // BondingCurve address: '0xC0afe0E649e32528666F993ce63822c3840e941a', @@ -1806,11 +1746,6 @@ const MainnetAddresses: MainnetAddresses = { address: '0x4C895973334Af8E06fd6dA4f723Ac24A5f259e6B', category: AddressCategory.Deprecated }, - multisig: { - artifactName: 'unknown', - address: '0xB8f482539F2d3Ae2C9ea6076894df36D1f632775', - category: AddressCategory.Deprecated - }, oldEthBondingCurve: { artifactName: 'unknown', // EthBondingCurve address: '0xe1578B4a32Eaefcd563a9E6d0dc02a4213f673B7', @@ -1821,11 +1756,6 @@ const MainnetAddresses: MainnetAddresses = { address: '0xa08A721dFB595753FFf335636674D76C455B275C', category: AddressCategory.Deprecated }, - poolPartyFeiPCVDeposit: { - artifactName: 'ERC20CompoundPCVDeposit', - address: '0x5A8CB4556e5D5935Af06beab8292905f48131479', - category: AddressCategory.Deprecated - }, ratioPCVController: { artifactName: 'unknown', // RatioPCVController address: '0xB1410aeCe2c65fE9e107c58b5aa32e91B18f0BC7', @@ -1846,11 +1776,6 @@ const MainnetAddresses: MainnetAddresses = { address: '0xc42e155788f9f599Fd437C7455F63810A395a81f', category: AddressCategory.Deprecated }, - reflexerStableAssetFusePoolRaiPCVDeposit: { - artifactName: 'ERC20CompoundPCVDeposit', - address: '0x9aAdFfe00eAe6d8e59bB4F7787C6b99388A6960D', - category: AddressCategory.Deprecated - }, staticPcvDepositWrapper: { artifactName: 'unknown', // StaticPCVDepositWrapper address: '0x8B41DcEfAe6064E6bc2A9B3ae20141d23EFD6cbd', @@ -1866,11 +1791,6 @@ const MainnetAddresses: MainnetAddresses = { address: '0x639572471f2f318464dc01066a56867130e45E25', category: AddressCategory.TBD }, - tribalChiefOptimisticMultisig: { - artifactName: 'unknown', - address: '0x35ED000468f397AA943009bD60cc6d2d9a7d32fF', - category: AddressCategory.Deprecated - }, tribalChiefOptimisticTimelock: { artifactName: 'Timelock', address: '0x27Fae9E49AD955A24bB578B66Cdc962b5029fbA9', diff --git a/protocol-configuration/permissions.ts b/protocol-configuration/permissions.ts index 153f2f9d6..33048e2cd 100644 --- a/protocol-configuration/permissions.ts +++ b/protocol-configuration/permissions.ts @@ -24,7 +24,7 @@ export const permissions = { 'lusdPSMFeiSkimmer', 'raiPCVDripController' ], - GUARDIAN_ROLE: ['multisig', 'pcvGuardianNew', 'pcvSentinel'], + GUARDIAN_ROLE: ['guardianMultisig', 'pcvGuardianNew', 'pcvSentinel'], ORACLE_ADMIN_ROLE: [ 'collateralizationOracleGuardian', 'optimisticTimelock', diff --git a/protocol-configuration/tribalchief.ts b/protocol-configuration/tribalchief.ts index 64dbc7278..9cf03708d 100644 --- a/protocol-configuration/tribalchief.ts +++ b/protocol-configuration/tribalchief.ts @@ -2,7 +2,7 @@ import { TribalChiefConfig } from '../types/types'; const config: TribalChiefConfig = { feiTribePair: { allocPoint: 0, unlocked: false }, // Uniswap-v2 FEI/TRIBE LP - curve3Metapool: { allocPoint: 0, unlocked: false }, // Curve 3crv-FEI metapool LP + curveFei3crvMetapool: { allocPoint: 0, unlocked: false }, // Curve 3crv-FEI metapool LP gUniFeiDaiLP: { allocPoint: 0, unlocked: true }, // G-UNI DAI/FEI 0.05% fee tier stakingTokenWrapperRari: { allocPoint: 1000, unlocked: false }, // FeiRari: TRIBE stakingTokenWrapperGROLaaS: { allocPoint: 0, unlocked: false }, // LaaS: GRO diff --git a/scripts/deploy/old/optimisticTimelock.ts b/scripts/deploy/old/optimisticTimelock.ts index e693d0437..7d6300f26 100644 --- a/scripts/deploy/old/optimisticTimelock.ts +++ b/scripts/deploy/old/optimisticTimelock.ts @@ -4,15 +4,15 @@ import { ethers } from 'hardhat'; const fourDays = 4 * 24 * 60 * 60; const deploy: DeployUpgradeFunc = async (deployAddress, addresses, logging = false) => { - const { tribalChiefOptimisticMultisig, core } = addresses; + const { optimisticMultisig, core } = addresses; - if (!tribalChiefOptimisticMultisig || !core) { + if (!optimisticMultisig || !core) { throw new Error('An environment variable contract address is not set'); } const optimisticTimelock = await ( await ethers.getContractFactory('OptimisticTimelock') - ).deploy(core, fourDays, [tribalChiefOptimisticMultisig], [tribalChiefOptimisticMultisig]); + ).deploy(core, fourDays, [optimisticMultisig], [optimisticMultisig]); logging && console.log('Optimistic Timelock deployed to: ', optimisticTimelock.address); return { diff --git a/test/integration/tests/balancer-weightedpool.ts b/test/integration/tests/balancer-weightedpool.ts index 8c10e6fd7..adc7deb63 100644 --- a/test/integration/tests/balancer-weightedpool.ts +++ b/test/integration/tests/balancer-weightedpool.ts @@ -137,7 +137,7 @@ describe('balancer-weightedpool', function () { expect(await balancerDepositTribeWeth.balance()).to.be.equal('0'); expect((await balancerDepositTribeWeth.resistantBalanceAndFei())[0]).to.be.equal('0'); expect((await balancerDepositTribeWeth.resistantBalanceAndFei())[1]).to.be.equal('0'); - expect(await contracts.wethERC20.balanceOf(balancerDepositTribeWeth.address)).to.be.equal('0'); + expect(await contracts.weth.balanceOf(balancerDepositTribeWeth.address)).to.be.equal('0'); expect(await contracts.tribe.balanceOf(balancerDepositTribeWeth.address)).to.be.equal('0'); }); @@ -149,12 +149,12 @@ describe('balancer-weightedpool', function () { const tribeToAllocate = BNe18(Math.round(4 * tribePerEth * 10000)).div(10000); // rounding error < slippage tolerance await contracts.aaveEthPCVDeposit.connect(daoSigner).withdraw(balancerDepositTribeWeth.address, BNe18('1')); await contracts.core.connect(daoSigner).allocateTribe(balancerDepositTribeWeth.address, tribeToAllocate); - expect(await contracts.wethERC20.balanceOf(balancerDepositTribeWeth.address)).to.be.equal(BNe18('1')); + expect(await contracts.weth.balanceOf(balancerDepositTribeWeth.address)).to.be.equal(BNe18('1')); expect(await contracts.tribe.balanceOf(balancerDepositTribeWeth.address)).to.be.equal(tribeToAllocate); // deposit funds in the pool await balancerDepositTribeWeth.deposit(); - expect(await contracts.wethERC20.balanceOf(balancerDepositTribeWeth.address)).to.be.equal('0'); + expect(await contracts.weth.balanceOf(balancerDepositTribeWeth.address)).to.be.equal('0'); expect(await contracts.tribe.balanceOf(balancerDepositTribeWeth.address)).to.be.equal('0'); const poolTokens = await contracts.balancerVault.getPoolTokens(await balancerDepositTribeWeth.poolId()); @@ -226,7 +226,7 @@ describe('balancer-weightedpool', function () { // check the amount of tokens out after exitPool const tribeBalanceAfterExit = (await contracts.tribe.balanceOf(balancerDepositTribeWeth.address)) / 1e18; - const wethBalanceAfterExit = (await contracts.wethERC20.balanceOf(balancerDepositTribeWeth.address)) / 1e18; + const wethBalanceAfterExit = (await contracts.weth.balanceOf(balancerDepositTribeWeth.address)) / 1e18; expect(tribeBalanceAfterExit).to.be.at.least(4 * tribePerEth * 0.99); expect(wethBalanceAfterExit).to.be.at.least(0.99); }); @@ -358,24 +358,24 @@ describe('balancer-weightedpool', function () { }); it('should be able to wrap and unwrap ETH', async function () { - expect(await contracts.wethERC20.balanceOf(balancerDepositFeiWeth.address)).to.be.equal('0'); + expect(await contracts.weth.balanceOf(balancerDepositFeiWeth.address)).to.be.equal('0'); expect((await balance.current(balancerDepositFeiWeth.address)).toString()).to.be.equal('0'); await ( await ethers.getSigner(deployAddress) ).sendTransaction({ to: balancerDepositFeiWeth.address, value: toBN('1000') }); - expect(await contracts.wethERC20.balanceOf(balancerDepositFeiWeth.address)).to.be.equal('0'); + expect(await contracts.weth.balanceOf(balancerDepositFeiWeth.address)).to.be.equal('0'); expect((await balance.current(balancerDepositFeiWeth.address)).toString()).to.be.equal(toBN('1000')); await balancerDepositFeiWeth.wrapETH(); - expect(await contracts.wethERC20.balanceOf(balancerDepositFeiWeth.address)).to.be.equal(toBN('1000')); + expect(await contracts.weth.balanceOf(balancerDepositFeiWeth.address)).to.be.equal(toBN('1000')); expect((await balance.current(balancerDepositFeiWeth.address)).toString()).to.be.equal('0'); await balancerDepositFeiWeth.connect(daoSigner).unwrapETH(); - expect(await contracts.wethERC20.balanceOf(balancerDepositFeiWeth.address)).to.be.equal('0'); + expect(await contracts.weth.balanceOf(balancerDepositFeiWeth.address)).to.be.equal('0'); expect((await balance.current(balancerDepositFeiWeth.address)).toString()).to.be.equal(toBN('1000')); }); @@ -385,10 +385,10 @@ describe('balancer-weightedpool', function () { const signer = await getImpersonatedSigner(WETH_HOLDER); await forceEth(WETH_HOLDER); const amount = '10000000000000000000000'; // 10k WETH (18 decimals) - await contracts.wethERC20.connect(signer).transfer(balancerDepositFeiWeth.address, amount); + await contracts.weth.connect(signer).transfer(balancerDepositFeiWeth.address, amount); // check initial amounts and deposit - expect(await contracts.wethERC20.balanceOf(balancerDepositFeiWeth.address)).to.be.equal(amount); + expect(await contracts.weth.balanceOf(balancerDepositFeiWeth.address)).to.be.equal(amount); expect(await contracts.fei.balanceOf(balancerDepositFeiWeth.address)).to.be.equal('0'); await balancerDepositFeiWeth.deposit(); diff --git a/test/integration/tests/dao.ts b/test/integration/tests/dao.ts index 2257af38f..f5e1591af 100644 --- a/test/integration/tests/dao.ts +++ b/test/integration/tests/dao.ts @@ -75,10 +75,10 @@ describe('e2e-dao', function () { await hre.network.provider.request({ method: 'hardhat_impersonateAccount', - params: [contractAddresses.multisig] + params: [contractAddresses.guardianMultisig] }); - const signer = await ethers.getSigner(contractAddresses.multisig); + const signer = await ethers.getSigner(contractAddresses.guardianMultisig); // Propose // note ethers.js requires using this notation when two overloaded methods exist) @@ -122,11 +122,11 @@ describe('e2e-dao', function () { describe('Optimistic Approval', async () => { beforeEach(async function () { - const { tribalChiefOptimisticMultisig, timelock } = contractAddresses; + const { optimisticMultisig, timelock } = contractAddresses; await hre.network.provider.request({ method: 'hardhat_impersonateAccount', - params: [tribalChiefOptimisticMultisig] + params: [optimisticMultisig] }); await hre.network.provider.request({ @@ -142,7 +142,7 @@ describe('e2e-dao', function () { await ( await ethers.getSigner(timelock) - ).sendTransaction({ to: tribalChiefOptimisticMultisig, value: toBN('40000000000000000') }); + ).sendTransaction({ to: optimisticMultisig, value: toBN('40000000000000000') }); }); it('governor can assume timelock admin', async () => { @@ -158,12 +158,12 @@ describe('e2e-dao', function () { }); it('proposal can execute on tribalChief', async () => { - const { tribalChiefOptimisticMultisig } = contractAddresses; + const { optimisticMultisig } = contractAddresses; const { optimisticTimelock, tribalChief } = contracts; const oldBlockReward = await tribalChief.tribePerBlock(); await optimisticTimelock - .connect(await ethers.getSigner(tribalChiefOptimisticMultisig)) + .connect(await ethers.getSigner(optimisticMultisig)) .schedule( tribalChief.address, 0, @@ -184,7 +184,7 @@ describe('e2e-dao', function () { await increaseTime(500000); await optimisticTimelock - .connect(await ethers.getSigner(tribalChiefOptimisticMultisig)) + .connect(await ethers.getSigner(optimisticMultisig)) .execute( tribalChief.address, 0, diff --git a/test/integration/tests/dependencies.ts b/test/integration/tests/dependencies.ts index ce25a9cd3..0d215592d 100644 --- a/test/integration/tests/dependencies.ts +++ b/test/integration/tests/dependencies.ts @@ -14,6 +14,25 @@ describe('e2e-dependencies', function () { proposalNames = Object.keys(proposals); }); + it('no duplicates in mainnetAddresses.ts', async function () { + const addressToLabel = {}; + for (const key in addresses) { + const mapKey = addresses[key].address.toLowerCase(); + addressToLabel[mapKey] = addressToLabel[mapKey] || []; + addressToLabel[mapKey].push(key); + } + for (const address in addressToLabel) { + const msg = + 'Address ' + + address + + ' has ' + + addressToLabel[address].length + + ' labels: ' + + addressToLabel[address].join(', '); + expect(addressToLabel[address].length).to.be.equal(1, msg); + } + }); + describe('Check Dependencies', function () { it('are all signed off', async function () { for (let i = 0; i < proposalNames.length; i++) { diff --git a/test/integration/tests/ethPSM.ts b/test/integration/tests/ethPSM.ts index a2713519f..347f784ec 100644 --- a/test/integration/tests/ethPSM.ts +++ b/test/integration/tests/ethPSM.ts @@ -70,7 +70,7 @@ describe('eth PSM', function () { fei = await ethers.getContractAt('Fei', contractAddresses.fei); dripper = contracts.aaveEthPCVDripController as PCVDripController; await hre.network.provider.send('hardhat_setBalance', [deployAddress.address, '0x21E19E0C9BAB2400000']); - guardian = await getImpersonatedSigner(contractAddresses.guardian); + guardian = await getImpersonatedSigner(contractAddresses.guardianMultisig); await forceEth(guardian.address); }); @@ -194,9 +194,9 @@ describe('eth PSM', function () { // empty drip target to make sure it is empty await forceEth(ethPSM.address); const signer = await getImpersonatedSigner(ethPSM.address); - await contracts.wethERC20 + await contracts.weth .connect(signer) - .transfer(await dripper.source(), await contracts.wethERC20.balanceOf(ethPSM.address)); + .transfer(await dripper.source(), await contracts.weth.balanceOf(ethPSM.address)); }); it('sets ethpsm reserve threshold to 5250 eth', async () => { diff --git a/test/integration/tests/lusdPSM.ts b/test/integration/tests/lusdPSM.ts index bf7ed53ba..dde2c8856 100644 --- a/test/integration/tests/lusdPSM.ts +++ b/test/integration/tests/lusdPSM.ts @@ -68,7 +68,7 @@ describe('lusd PSM', function () { dripper = contracts.lusdPCVDripController as PCVDripController; await hre.network.provider.send('hardhat_setBalance', [deployAddress.address, '0x21E19E0C9BAB2400000']); await fei.mint(deployAddress.address, amount); - guardian = await getImpersonatedSigner(contractAddresses.guardian); + guardian = await getImpersonatedSigner(contractAddresses.guardianMultisig); await hre.network.provider.send('hardhat_setBalance', [guardian.address, '0x21E19E0C9BAB2400000']); await overwriteChainlinkAggregator(contractAddresses.chainlinkEthUsdOracle, '400000000000', '8'); }); diff --git a/test/integration/tests/old/migrateProxies/index.ts b/test/integration/tests/old/migrateProxies/index.ts index 70d6cf2d3..ed505e65e 100644 --- a/test/integration/tests/old/migrateProxies/index.ts +++ b/test/integration/tests/old/migrateProxies/index.ts @@ -58,7 +58,7 @@ describe.skip('e2e-migrate-proxies', function () { feiDAO = contracts.feiDAO; await forceEth(feiDAO.address); - await reduceDAOVotingPeriod(feiDAO, contractAddresses.multisig); + await reduceDAOVotingPeriod(feiDAO, contractAddresses.guardianMultisig); }); it('should give Rari timelock governor and point FEI DAO timelock to oldTimelock (fip_84a)', async () => { @@ -78,7 +78,7 @@ describe.skip('e2e-migrate-proxies', function () { // Multisig address has sufficient TRIBE to pass quorum const targets = [contractAddresses.core, contractAddresses.core, feiDAO.address]; const values = [0, 0, 0]; - await performDAOAction(feiDAO, contractAddresses.multisig, fip_84aCalldata, targets, values); + await performDAOAction(feiDAO, contractAddresses.guardianMultisig, fip_84aCalldata, targets, values); // 1. Rari timelock granted GOVERN_ROLE role const rariTimelockHasRole = await contracts.core.hasRole(GOVERN_ROLE, contractAddresses.rariTimelock); @@ -108,7 +108,7 @@ describe.skip('e2e-migrate-proxies', function () { contractAddresses.timelock, contractAddresses.feiDAO ]; - await performDAOAction(feiDAO, contractAddresses.multisig, fip_84bCalldata, targets, values); + await performDAOAction(feiDAO, contractAddresses.guardianMultisig, fip_84bCalldata, targets, values); // 1. Check ProxyAdmin owner changed to newTimelock const newTimelockAddress = contractAddresses.feiDAOTimelock; @@ -136,7 +136,7 @@ describe.skip('e2e-migrate-proxies', function () { const values = [0]; const targets = [contractAddresses.timelock]; - await performDAOAction(feiDAO, contractAddresses.multisig, fip_84cCalldata, targets, values); + await performDAOAction(feiDAO, contractAddresses.guardianMultisig, fip_84cCalldata, targets, values); const oldTimelockAdmin = await oldTimelock.admin(); expect(oldTimelockAdmin).to.equal(contractAddresses.feiDAOTimelock); @@ -149,7 +149,7 @@ describe.skip('e2e-migrate-proxies', function () { const oldIncentivesBehaviour = await proxyAdmin .connect(newTimelockSigner) - .getProxyImplementation(contractAddresses.aaveTribeIncentivesControllerProxy); + .getProxyImplementation(contractAddresses.aaveTribeIncentivesController); expect(oldIncentivesBehaviour).to.equal(contractAddresses.aaveTribeIncentivesControllerImpl); console.log({ oldIncentivesBehaviour }); @@ -160,11 +160,11 @@ describe.skip('e2e-migrate-proxies', function () { const upgradeIncentivesCalldata = [ '0x99a88ec4000000000000000000000000dee5c1662bbff8f80f7c572d8091bf251b3b0dab000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2' ]; - await performDAOAction(feiDAO, contractAddresses.multisig, upgradeIncentivesCalldata, targets, values); + await performDAOAction(feiDAO, contractAddresses.guardianMultisig, upgradeIncentivesCalldata, targets, values); const newIncentivesBehaviour = await proxyAdmin .connect(newTimelockSigner) - .getProxyImplementation(contractAddresses.aaveTribeIncentivesControllerProxy); + .getProxyImplementation(contractAddresses.aaveTribeIncentivesController); expect(newIncentivesBehaviour).to.equal(dummyUpgradeAddress); }); diff --git a/test/integration/tests/podOperation.ts b/test/integration/tests/podOperation.ts index 3afc3862e..1c24cee08 100644 --- a/test/integration/tests/podOperation.ts +++ b/test/integration/tests/podOperation.ts @@ -196,7 +196,7 @@ describe('Pod operation and veto', function () { // call the podAdminGateway.veto() method with the proposalId that is in the timelock // 2. Have a member with >quorum TRIBE vote for proposal // 3. Validate that proposal is executed - const userWithTribe = await getImpersonatedSigner(contractAddresses.multisig); + const userWithTribe = await getImpersonatedSigner(contractAddresses.guardianMultisig); const timelockProposalId = await podTimelock.hashOperation( contractAddresses.governanceMetadataRegistry, 0, @@ -298,7 +298,7 @@ describe('Pod operation and veto', function () { ); // 3. Create NopeDAO proposal to veto the timelocked transaction - const userWithTribe = await getImpersonatedSigner(contractAddresses.multisig); + const userWithTribe = await getImpersonatedSigner(contractAddresses.guardianMultisig); const timelockProposalId = await tribalCouncilTimelock.hashOperation( contractAddresses.roleBastion, 0, diff --git a/test/integration/tests/staking.ts b/test/integration/tests/staking.ts index 72d9caa4f..0e225fb0c 100644 --- a/test/integration/tests/staking.ts +++ b/test/integration/tests/staking.ts @@ -307,8 +307,8 @@ describe('e2e-staking', function () { describe('Guardian Disables Supply Rewards', async () => { it('does not receive reward when supply incentives are moved to zero', async () => { - const { erc20Dripper, multisig, rariRewardsDistributorDelegator } = contractAddresses; - const signer = await getImpersonatedSigner(multisig); + const { erc20Dripper, guardianMultisig, rariRewardsDistributorDelegator } = contractAddresses; + const signer = await getImpersonatedSigner(guardianMultisig); const { rariPool8Tribe } = contracts; const rewardsDistributorDelegator = await ethers.getContractAt( 'IRewardsAdmin', diff --git a/types/types.ts b/types/types.ts index 6d4b9d002..17f7ecab7 100644 --- a/types/types.ts +++ b/types/types.ts @@ -198,7 +198,6 @@ export interface MainnetContracts { compoundEthPCVDeposit: EthCompoundPCVDeposit; compoundDaiPCVDeposit: ERC20CompoundPCVDeposit; curveMetapoolDeposit: ethers.Contract; - curveMetapool: ethers.Contract; curve3pool: ethers.Contract; curve3crv: ethers.Contract; aaveEthPCVDeposit: AavePCVDeposit; @@ -208,11 +207,11 @@ export interface MainnetContracts { dai: IERC20; chainlinkDpiUsdOracleWrapper: ChainlinkOracleWrapper; dpiUniswapPCVDeposit: UniswapPCVDeposit; - indexCoopFusePoolDpiPCVDeposit: ERC20CompoundPCVDeposit; + rariPool19DpiPCVDeposit: ERC20CompoundPCVDeposit; rai: IERC20; chainlinkRaiEthOracleWrapper: ChainlinkOracleWrapper; chainlinkRaiUsdCompositeOracle: CompositeOracle; - reflexerStableAssetFusePoolRaiPCVDeposit: ERC20CompoundPCVDeposit; + rariPool9RaiPCVDeposit: ERC20CompoundPCVDeposit; kashiFeiTribe: IKashiPair; bentoBox: IMasterContractManager; aaveEthPCVDripController: PCVDripController; @@ -221,7 +220,7 @@ export interface MainnetContracts { stakingTokenWrapper: StakingTokenWrapper; feiTribePair: IUniswapV2Pair; rariPool8Tribe: CErc20Delegator; - curve3Metapool: IERC20; + curveFei3crvMetapool: IERC20; erc20Dripper: ERC20Dripper; tribalChiefOptimisticTimelock: OptimisticTimelock; collateralizationOracle: CollateralizationOracle; @@ -260,16 +259,16 @@ export interface MainnetContractAddresses { feiRewardsDistributor: string; tribeReserveStabilizer: string; timelock: string; - multisig: string; + guardianMultisig: string; governorAlpha: string; - indexCoopFusePoolDpi: string; - reflexerStableAssetFusePoolRai: string; + rariPool19Dpi: string; + rariPool9Rai: string; bentoBox: string; masterKashi: string; feiTribePair: string; rariPool8Tribe: string; - curve3Metapool: string; - tribalChiefOptimisticMultisig: string; + curveFei3crvMetapool: string; + optimisticMultisig: string; stakingTokenWrapperRari: string; rariRewardsDistributorDelegator: string; restrictedPermissions: string; From 2345fb5c2d86a374e700d6ec9a0c61aa0cb5b087 Mon Sep 17 00:00:00 2001 From: Joey Santoro Date: Wed, 1 Jun 2022 16:23:32 -0700 Subject: [PATCH 182/274] proposal calldata --- scripts/utils/constructProposalCalldata.ts | 58 +++++++++++++++++++--- 1 file changed, 52 insertions(+), 6 deletions(-) diff --git a/scripts/utils/constructProposalCalldata.ts b/scripts/utils/constructProposalCalldata.ts index 79c6bf9fd..b60a26263 100644 --- a/scripts/utils/constructProposalCalldata.ts +++ b/scripts/utils/constructProposalCalldata.ts @@ -1,8 +1,11 @@ import constructProposal from './constructProposal'; import { BigNumber } from 'ethers'; +import { ethers } from 'hardhat'; import { Interface } from '@ethersproject/abi'; import { utils } from 'ethers'; import { getAllContractAddresses, getAllContracts } from '@test/integration/setup/loadContracts'; +import { ProposalCategory, ProposalDescription } from '@custom-types/types'; +import proposals from '@test/integration/proposals_config'; type ExtendedAlphaProposal = { targets: string[]; @@ -17,17 +20,25 @@ type ExtendedAlphaProposal = { * See `proposals/utils/getProposalCalldata.js` on how to construct the proposal calldata */ export async function constructProposalCalldata(proposalName: string): Promise { - const proposalInfo = await import(`@proposals/description/${proposalName}`); + const proposalInfo = (await import(`@proposals/description/${proposalName}`)).default as ProposalDescription; const contracts = await getAllContracts(); const contractAddresses = await getAllContractAddresses(); - const proposal = (await constructProposal( - proposalInfo.default, - contracts, - contractAddresses - )) as ExtendedAlphaProposal; + const proposal = (await constructProposal(proposalInfo, contracts, contractAddresses)) as ExtendedAlphaProposal; + console.log(proposals[proposalName].category); + if ( + proposals[proposalName].category === ProposalCategory.OA || + proposals[proposalName].category === ProposalCategory.TC + ) { + return getTimelockCalldata(proposal, proposalInfo); + } + + return getDAOCalldata(proposal); +} + +function getDAOCalldata(proposal: ExtendedAlphaProposal): string { const proposeFuncFrag = new Interface([ 'function propose(address[] memory targets,uint256[] memory values,bytes[] memory calldatas,string memory description) public returns (uint256)' ]); @@ -47,3 +58,38 @@ export async function constructProposalCalldata(proposalName: string): Promise Date: Thu, 2 Jun 2022 13:43:08 +0100 Subject: [PATCH 183/274] feat: unlock pools, set AP points to 0 --- proposals/description/end-tribe-incentives.ts | 137 ++++++++++++++++++ protocol-configuration/tribalchief.ts | 14 +- 2 files changed, 144 insertions(+), 7 deletions(-) diff --git a/proposals/description/end-tribe-incentives.ts b/proposals/description/end-tribe-incentives.ts index 1209a6f96..2d42eb963 100644 --- a/proposals/description/end-tribe-incentives.ts +++ b/proposals/description/end-tribe-incentives.ts @@ -4,6 +4,7 @@ const end_tribe_incentives: ProposalDescription = { // Pool ID is where the pool is in the array title: 'TIP-109: Discontinue Tribe Incentives', commands: [ + ///// Update reward variables of all pools { target: 'tribalChief', values: '0', @@ -11,6 +12,142 @@ const end_tribe_incentives: ProposalDescription = { arguments: [['0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11', '12', '13', '14', '15', '16', '17']], description: 'Update reward variables on all pools registered for Tribe rewards' }, + + //// Set Pool allocation points to 0 and unlock + { + target: 'tribalChief', + values: '0', + method: 'resetRewards(uint256)', + arguments: ['0'], + description: 'Set Pool 0 rewards to 0 and unlock the pool, to allow principle withdrawal' + }, + { + target: 'tribalChief', + values: '0', + method: 'resetRewards(uint256)', + arguments: ['1'], + description: 'Set Pool 1 rewards to 0 and unlock the pool, to allow principle withdrawal' + }, + { + target: 'tribalChief', + values: '0', + method: 'resetRewards(uint256)', + arguments: ['2'], + description: 'Set Pool 2 rewards to 0 and unlock the pool, to allow principle withdrawal' + }, + { + target: 'tribalChief', + values: '0', + method: 'resetRewards(uint256)', + arguments: ['3'], + description: 'Set Pool 3 rewards to 0 and unlock the pool, to allow principle withdrawal' + }, + { + target: 'tribalChief', + values: '0', + method: 'resetRewards(uint256)', + arguments: ['4'], + description: 'Set Pool 4 rewards to 0 and unlock the pool, to allow principle withdrawal' + }, + { + target: 'tribalChief', + values: '0', + method: 'resetRewards(uint256)', + arguments: ['5'], + description: 'Set Pool 5 rewards to 0 and unlock the pool, to allow principle withdrawal' + }, + { + target: 'tribalChief', + values: '0', + method: 'resetRewards(uint256)', + arguments: ['6'], + description: 'Set Pool 6 rewards to 0 and unlock the pool, to allow principle withdrawal' + }, + { + target: 'tribalChief', + values: '0', + method: 'resetRewards(uint256)', + arguments: ['7'], + description: 'Set Pool 7 rewards to 0 and unlock the pool, to allow principle withdrawal' + }, + { + target: 'tribalChief', + values: '0', + method: 'resetRewards(uint256)', + arguments: ['8'], + description: 'Set Pool 8 rewards to 0 and unlock the pool, to allow principle withdrawal' + }, + { + target: 'tribalChief', + values: '0', + method: 'resetRewards(uint256)', + arguments: ['9'], + description: 'Set Pool 9 rewards to 0 and unlock the pool, to allow principle withdrawal' + }, + { + target: 'tribalChief', + values: '0', + method: 'resetRewards(uint256)', + arguments: ['10'], + description: 'Set Pool 10 rewards to 0 and unlock the pool, to allow principle withdrawal' + }, + { + target: 'tribalChief', + values: '0', + method: 'resetRewards(uint256)', + arguments: ['11'], + description: 'Set Pool 11 rewards to 0 and unlock the pool, to allow principle withdrawal' + }, + { + target: 'tribalChief', + values: '0', + method: 'resetRewards(uint256)', + arguments: ['12'], + description: 'Set Pool 12 rewards to 0 and unlock the pool, to allow principle withdrawal' + }, + { + target: 'tribalChief', + values: '0', + method: 'resetRewards(uint256)', + arguments: ['13'], + description: 'Set Pool 13 rewards to 0 and unlock the pool, to allow principle withdrawal' + }, + { + target: 'tribalChief', + values: '0', + method: 'resetRewards(uint256)', + arguments: ['14'], + description: 'Set Pool 14 rewards to 0 and unlock the pool, to allow principle withdrawal' + }, + { + target: 'tribalChief', + values: '0', + method: 'resetRewards(uint256)', + arguments: ['15'], + description: 'Set Pool 15 rewards to 0 and unlock the pool, to allow principle withdrawal' + }, + { + target: 'tribalChief', + values: '0', + method: 'resetRewards(uint256)', + arguments: ['16'], + description: 'Set Pool 16 rewards to 0 and unlock the pool, to allow principle withdrawal' + }, + { + target: 'tribalChief', + values: '0', + method: 'resetRewards(uint256)', + arguments: ['17'], + description: 'Set Pool 17 rewards to 0 and unlock the pool, to allow principle withdrawal' + }, + { + target: 'tribalChief', + values: '0', + method: 'resetRewards(uint256)', + arguments: ['18'], + description: 'Set Pool 18 rewards to 0 and unlock the pool, to allow principle withdrawal' + }, + { target: 'tribalChief', values: '0', diff --git a/protocol-configuration/tribalchief.ts b/protocol-configuration/tribalchief.ts index 64dbc7278..7e583de6d 100644 --- a/protocol-configuration/tribalchief.ts +++ b/protocol-configuration/tribalchief.ts @@ -4,7 +4,7 @@ const config: TribalChiefConfig = { feiTribePair: { allocPoint: 0, unlocked: false }, // Uniswap-v2 FEI/TRIBE LP curve3Metapool: { allocPoint: 0, unlocked: false }, // Curve 3crv-FEI metapool LP gUniFeiDaiLP: { allocPoint: 0, unlocked: true }, // G-UNI DAI/FEI 0.05% fee tier - stakingTokenWrapperRari: { allocPoint: 1000, unlocked: false }, // FeiRari: TRIBE + stakingTokenWrapperRari: { allocPoint: 1, unlocked: false }, // FeiRari: TRIBE stakingTokenWrapperGROLaaS: { allocPoint: 0, unlocked: false }, // LaaS: GRO stakingTokenWrapperFOXLaaS: { allocPoint: 0, unlocked: false }, // LaaS: FOX stakingTokenWrapperUMALaaS: { allocPoint: 0, unlocked: false }, // LaaS: UMA @@ -13,12 +13,12 @@ const config: TribalChiefConfig = { stakingTokenWrapperKYLINLaaS: { allocPoint: 0, unlocked: false }, // LaaS: KYLIN stakingTokenWrapperMStableLaaS: { allocPoint: 0, unlocked: false }, // LaaS: MStable stakingTokenWrapperPoolTogetherLaaS: { allocPoint: 0, unlocked: false }, // LaaS: PoolTogether - stakingTokenWrapperBribeD3pool: { allocPoint: 250, unlocked: false }, // Votium bribes: d3pool - d3StakingTokenWrapper: { allocPoint: 250, unlocked: false }, // FeiRari: d3pool LP - fei3CrvStakingtokenWrapper: { allocPoint: 1000, unlocked: false }, // FeiRari: 3crv-FEI metapool LP - feiDaiStakingTokenWrapper: { allocPoint: 100, unlocked: false }, // FeiRari: G-UNI DAI/FEI 0.05% fee tier - feiUsdcStakingTokenWrapper: { allocPoint: 500, unlocked: false }, // FeiRari: G-UNI USDC/FEI 0.01% fee tier - stakingTokenWrapperBribe3Crvpool: { allocPoint: 250, unlocked: false } // Votium bribes: 3crv-FEI metapool + stakingTokenWrapperBribeD3pool: { allocPoint: 0, unlocked: false }, // Votium bribes: d3pool + d3StakingTokenWrapper: { allocPoint: 0, unlocked: false }, // FeiRari: d3pool LP + fei3CrvStakingtokenWrapper: { allocPoint: 0, unlocked: false }, // FeiRari: 3crv-FEI metapool LP + feiDaiStakingTokenWrapper: { allocPoint: 0, unlocked: false }, // FeiRari: G-UNI DAI/FEI 0.05% fee tier + feiUsdcStakingTokenWrapper: { allocPoint: 0, unlocked: false }, // FeiRari: G-UNI USDC/FEI 0.01% fee tier + stakingTokenWrapperBribe3Crvpool: { allocPoint: 0, unlocked: false } // Votium bribes: 3crv-FEI metapool }; export default config; From d0ad6139c4cd1078a8ba81f51ebd69c15e561039 Mon Sep 17 00:00:00 2001 From: thomas-waite Date: Thu, 2 Jun 2022 13:45:05 +0100 Subject: [PATCH 184/274] feat: remove CREAM from CR --- proposals/description/end-tribe-incentives.ts | 21 +++++++++++++++---- protocol-configuration/mainnetAddresses.ts | 2 +- 2 files changed, 18 insertions(+), 5 deletions(-) diff --git a/proposals/description/end-tribe-incentives.ts b/proposals/description/end-tribe-incentives.ts index 2d42eb963..4267056f0 100644 --- a/proposals/description/end-tribe-incentives.ts +++ b/proposals/description/end-tribe-incentives.ts @@ -152,15 +152,28 @@ const end_tribe_incentives: ProposalDescription = { target: 'tribalChief', values: '0', method: 'updateBlockReward(uint256)', - arguments: ['0'], - description: 'Set Tribal Chief block reward to 0' + arguments: ['100000'], + description: 'Set Tribal Chief block reward effectively to zero. Setting to 100000' + }, + + ////// Remove CREAM from CR + { + target: 'collateralizationOracle', + values: '0', + method: 'removeDeposit(address)', + arguments: ['{creamDepositWrapper}'], + description: 'Remove empty CREAM deposit from the CR oracle' } ], description: ` TIP-109: Discontinue Tribe Incentives - This proposal will disable all Tribe incentives. It updates the reward variables of incentivised pools and then - sets the amount of Tribe issued per block by the Tribal Chief to 0. + This proposal will disable all Tribe incentives. Specifically it: + - Sets the allocation points of all pools effectively to 0 + - Updates the reward variables of incentivised pools + - Sets the amount of Tribe issued per block by the Tribal Chief to effectively zero + + It also removes CREAM from the Collaterisation Oracle ` }; diff --git a/protocol-configuration/mainnetAddresses.ts b/protocol-configuration/mainnetAddresses.ts index e7301939b..51ef7ba1b 100644 --- a/protocol-configuration/mainnetAddresses.ts +++ b/protocol-configuration/mainnetAddresses.ts @@ -519,7 +519,7 @@ const MainnetAddresses: MainnetAddresses = { creamDepositWrapper: { artifactName: 'ERC20PCVDepositWrapper', address: '0x3a1838Ac9EcA864054bebB82C32455Dd7d7Fc89c', - category: AddressCategory.PCV + category: AddressCategory.Deprecated }, ethLidoPCVDepositWrapper: { artifactName: 'PCVDepositWrapper', From 6fe182b0bdd16f6946261b60995f195213407d16 Mon Sep 17 00:00:00 2001 From: thomas-waite Date: Thu, 2 Jun 2022 14:32:14 +0100 Subject: [PATCH 185/274] feat: add TC DEBUG mode --- scripts/utils/simulateDEBUGProposal.ts | 48 ++++++++++++++++++++++++++ test/integration/proposals_config.ts | 11 ++++++ test/integration/setup/index.ts | 35 +++++++------------ types/types.ts | 1 + 4 files changed, 72 insertions(+), 23 deletions(-) create mode 100644 scripts/utils/simulateDEBUGProposal.ts diff --git a/scripts/utils/simulateDEBUGProposal.ts b/scripts/utils/simulateDEBUGProposal.ts new file mode 100644 index 000000000..a926ae17c --- /dev/null +++ b/scripts/utils/simulateDEBUGProposal.ts @@ -0,0 +1,48 @@ +import { MainnetContracts, NamedAddresses, ProposalConfig } from '@custom-types/types'; +import { Contract, Signer } from 'ethers'; +import format from 'string-template'; + +export async function simulateDEBUGProposal( + signer: Signer, + contractAddresses: NamedAddresses, + contracts: MainnetContracts, + config: ProposalConfig +) { + let totalGasUsed = 0; + for (let i = 0; i < config.proposal.commands.length; i++) { + const cmd = config.proposal.commands[i]; + // build tx & print details + console.log(' Step' + (config.proposal.commands.length >= 10 && i < 10 ? ' ' : ''), i, ':', cmd.description); + const to = contractAddresses[cmd.target] || cmd.target; + const value = cmd.values; + const args = replaceArgs(cmd.arguments, contractAddresses); + const ethersContract: Contract = contracts[cmd.target] as Contract; + const calldata = ethersContract.interface.encodeFunctionData(cmd.method, args); + console.log(' Target:', cmd.target, '[' + to + ']'); + console.log(' Method:', cmd.method, '- Calling...'); + + // send tx + const tx = await signer.sendTransaction({ data: calldata, to, value: Number(value) }); + const d = await tx.wait(); + console.log(' Done. Used ' + d.cumulativeGasUsed.toString() + ' gas.'); + totalGasUsed += Number(d.cumulativeGasUsed.toString()); + } + console.log(' Done. Used', totalGasUsed, 'gas in total.'); +} + +// Recursively interpolate strings in the argument array +export function replaceArgs(args: any[], contractNames: NamedAddresses): any[] { + const result = []; + for (let i = 0; i < args.length; i++) { + const element = args[i]; + if (typeof element === typeof '') { + const formatted = format(element, contractNames); + result.push(formatted); + } else if (typeof element === typeof []) { + result.push(replaceArgs(element, contractNames)); + } else { + result.push(element); + } + } + return result; +} diff --git a/test/integration/proposals_config.ts b/test/integration/proposals_config.ts index b4a969e96..11394a1a2 100644 --- a/test/integration/proposals_config.ts +++ b/test/integration/proposals_config.ts @@ -1,6 +1,8 @@ import { ProposalCategory, ProposalsConfigMap } from '@custom-types/types'; + import repay_fuse_bad_debt from '@proposals/description/repay_fuse_bad_debt'; import register_proposal from '@proposals/description/register_proposal'; +import end_tribe_incentives from '@proposals/description/end_tribe_incentives'; const proposals: ProposalsConfigMap = { register_proposal: { @@ -20,6 +22,15 @@ const proposals: ProposalsConfigMap = { affectedContractSignoff: ['core', 'fuseFixer', 'pcvGuardianNew'], deprecatedContractSignoff: [], category: ProposalCategory.TC + }, + end_tribe_incentives: { + deploy: false, // deploy flag for whether to run deploy action during e2e tests or use mainnet state + totalValue: 0, // amount of ETH to send to DAO execution + proposal: end_tribe_incentives, // full proposal file, imported from '@proposals/description/fip_xx.ts' + proposalId: '', + affectedContractSignoff: ['tribalChief', 'creamDepositWrapper'], + deprecatedContractSignoff: [], + category: ProposalCategory.DEBUG_TC } }; diff --git a/test/integration/setup/index.ts b/test/integration/setup/index.ts index d8f4217ab..3a7db2158 100644 --- a/test/integration/setup/index.ts +++ b/test/integration/setup/index.ts @@ -1,5 +1,3 @@ -import { ethers } from 'hardhat'; -import { Contract } from '@ethersproject/contracts'; import { permissions } from '@protocol/permissions'; import { getAllContractAddresses, getAllContracts } from './loadContracts'; import { @@ -24,7 +22,7 @@ import '@nomiclabs/hardhat-ethers'; import { resetFork } from '@test/helpers'; import { simulateOAProposal } from '@scripts/utils/simulateTimelockProposal'; import { simulateTCProposal } from '@scripts/utils/simulateTimelockProposal'; -import { replaceArgs } from '@scripts/utils/simulateTimelockProposal'; +import { simulateDEBUGProposal } from '@scripts/utils/simulateDEBUGProposal'; import { forceEth } from '@test/integration/setup/utils'; import { getImpersonatedSigner } from '@test/helpers'; @@ -189,26 +187,17 @@ export class TestEndtoEndCoordinator implements TestCoordinator { const signer = await getImpersonatedSigner(contracts.feiDAOTimelock.address); await forceEth(contracts.feiDAOTimelock.address); - let totalGasUsed = 0; - for (let i = 0; i < config.proposal.commands.length; i++) { - const cmd = config.proposal.commands[i]; - // build tx & print details - console.log(' Step' + (config.proposal.commands.length >= 10 && i < 10 ? ' ' : ''), i, ':', cmd.description); - const to = contractAddresses[cmd.target] || cmd.target; - const value = cmd.values; - const args = replaceArgs(cmd.arguments, contractAddresses); - const ethersContract: Contract = contracts[cmd.target] as Contract; - const calldata = ethersContract.interface.encodeFunctionData(cmd.method, args); - console.log(' Target:', cmd.target, '[' + to + ']'); - console.log(' Method:', cmd.method, '- Calling...'); - - // send tx - const tx = await signer.sendTransaction({ data: calldata, to, value: Number(value) }); - const d = await tx.wait(); - console.log(' Done. Used ' + d.cumulativeGasUsed.toString() + ' gas.'); - totalGasUsed += Number(d.cumulativeGasUsed.toString()); - } - console.log(' Done. Used', totalGasUsed, 'gas in total.'); + await simulateDEBUGProposal(signer, contractAddresses, contracts as unknown as MainnetContracts, config); + } + + if (config.category === ProposalCategory.DEBUG_TC) { + console.log('Simulating TC proposal in DEBUG mode (step by step)...'); + console.log(' Title: ', config.proposal.title); + + const signer = await getImpersonatedSigner(contracts.tribalCouncilTimelock.address); + await forceEth(contracts.tribalCouncilTimelock.address); + + await simulateDEBUGProposal(signer, contractAddresses, contracts as unknown as MainnetContracts, config); } // teardown the DAO proposal diff --git a/types/types.ts b/types/types.ts index 6d4b9d002..18fb658c4 100644 --- a/types/types.ts +++ b/types/types.ts @@ -66,6 +66,7 @@ export enum ProposalCategory { DEBUG, OA, TC, // Tribal Council + DEBUG_TC, None } From 0998ad5d3ea0b8c8b42eb7ad1bb1c4bea32bd335 Mon Sep 17 00:00:00 2001 From: thomas-waite Date: Thu, 2 Jun 2022 14:33:19 +0100 Subject: [PATCH 186/274] refactor: make use of admin set method --- ...-incentives.ts => end_tribe_incentives.ts} | 23 ++++++++-- ...-incentives.ts => end_tribe_incentives.ts} | 45 ++++++++++--------- 2 files changed, 44 insertions(+), 24 deletions(-) rename proposals/dao/{end-tribe-incentives.ts => end_tribe_incentives.ts} (77%) rename proposals/description/{end-tribe-incentives.ts => end_tribe_incentives.ts} (79%) diff --git a/proposals/dao/end-tribe-incentives.ts b/proposals/dao/end_tribe_incentives.ts similarity index 77% rename from proposals/dao/end-tribe-incentives.ts rename to proposals/dao/end_tribe_incentives.ts index cc9c17aea..e4438399a 100644 --- a/proposals/dao/end-tribe-incentives.ts +++ b/proposals/dao/end_tribe_incentives.ts @@ -58,14 +58,31 @@ const validate: ValidateUpgradeFunc = async (addresses, oldContracts, contracts, const initialBalance = await tribe.balanceOf(receiver); const poolId = 0; // UniswapV2 Fei-Tribe LP pool - const stakerInFeiTribe = '0x7d809969f6a04777f0a87ff94b57e56078e5fe0f'; const stakerInFeiTribeSigner = await getImpersonatedSigner(stakerInFeiTribe); await tribalChief.connect(stakerInFeiTribeSigner).harvest(poolId, receiver); const finalBalance = await tribe.balanceOf(receiver); - - expect(finalBalance.sub(initialBalance)).to.be.bignumber.at.least(0); + const harvestedTribe = finalBalance.sub(initialBalance); + console.log('Harvested tribe: ', harvestedTribe.toString()); + expect(harvestedTribe).to.be.bignumber.at.least(0); + + // 3. Validate that all pools are unlocked and that AP points are set to zero, apart from Fei-Rari + const poolIds = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17]; + + const feiRariPoolId = '3'; + for (const pid in poolIds) { + const poolInfo = await tribalChief.poolInfo[pid]; + console.log({ poolInfo }); + + expect(poolInfo.unlocked).to.equal(true); + + if (pid == feiRariPoolId) { + expect(poolInfo.allocPoint).to.be.bignumber.equal(1); + } else { + expect(poolInfo.allocPoint).to.be.bignumber.equal(0); + } + } }; export { deploy, setup, teardown, validate }; diff --git a/proposals/description/end-tribe-incentives.ts b/proposals/description/end_tribe_incentives.ts similarity index 79% rename from proposals/description/end-tribe-incentives.ts rename to proposals/description/end_tribe_incentives.ts index 4267056f0..3a4f73642 100644 --- a/proposals/description/end-tribe-incentives.ts +++ b/proposals/description/end_tribe_incentives.ts @@ -17,137 +17,140 @@ const end_tribe_incentives: ProposalDescription = { { target: 'tribalChief', values: '0', - method: 'resetRewards(uint256)', + method: 'set(uint256,uint120,address,bool)', arguments: ['0'], description: 'Set Pool 0 rewards to 0 and unlock the pool, to allow principle withdrawal' }, { target: 'tribalChief', values: '0', - method: 'resetRewards(uint256)', + method: 'set(uint256,uint120,address,bool)', arguments: ['1'], description: 'Set Pool 1 rewards to 0 and unlock the pool, to allow principle withdrawal' }, { target: 'tribalChief', values: '0', - method: 'resetRewards(uint256)', + method: 'set(uint256,uint120,address,bool)', arguments: ['2'], description: 'Set Pool 2 rewards to 0 and unlock the pool, to allow principle withdrawal' }, { target: 'tribalChief', values: '0', - method: 'resetRewards(uint256)', + method: 'set(uint256,uint120,address,bool)', arguments: ['3'], description: 'Set Pool 3 rewards to 0 and unlock the pool, to allow principle withdrawal' }, { target: 'tribalChief', values: '0', - method: 'resetRewards(uint256)', + method: 'set(uint256,uint120,address,bool)', arguments: ['4'], description: 'Set Pool 4 rewards to 0 and unlock the pool, to allow principle withdrawal' }, { target: 'tribalChief', values: '0', - method: 'resetRewards(uint256)', + method: 'set(uint256,uint120,address,bool)', arguments: ['5'], description: 'Set Pool 5 rewards to 0 and unlock the pool, to allow principle withdrawal' }, { target: 'tribalChief', values: '0', - method: 'resetRewards(uint256)', + method: 'set(uint256,uint120,address,bool)', arguments: ['6'], description: 'Set Pool 6 rewards to 0 and unlock the pool, to allow principle withdrawal' }, { target: 'tribalChief', values: '0', - method: 'resetRewards(uint256)', + method: 'set(uint256,uint120,address,bool)', arguments: ['7'], description: 'Set Pool 7 rewards to 0 and unlock the pool, to allow principle withdrawal' }, { target: 'tribalChief', values: '0', - method: 'resetRewards(uint256)', + method: 'set(uint256,uint120,address,bool)', arguments: ['8'], description: 'Set Pool 8 rewards to 0 and unlock the pool, to allow principle withdrawal' }, { target: 'tribalChief', values: '0', - method: 'resetRewards(uint256)', + method: 'set(uint256,uint120,address,bool)', arguments: ['9'], description: 'Set Pool 9 rewards to 0 and unlock the pool, to allow principle withdrawal' }, { target: 'tribalChief', values: '0', - method: 'resetRewards(uint256)', + method: 'set(uint256,uint120,address,bool)', arguments: ['10'], description: 'Set Pool 10 rewards to 0 and unlock the pool, to allow principle withdrawal' }, { target: 'tribalChief', values: '0', - method: 'resetRewards(uint256)', + method: 'set(uint256,uint120,address,bool)', arguments: ['11'], description: 'Set Pool 11 rewards to 0 and unlock the pool, to allow principle withdrawal' }, { target: 'tribalChief', values: '0', - method: 'resetRewards(uint256)', + method: 'set(uint256,uint120,address,bool)', arguments: ['12'], description: 'Set Pool 12 rewards to 0 and unlock the pool, to allow principle withdrawal' }, { target: 'tribalChief', values: '0', - method: 'resetRewards(uint256)', + method: 'set(uint256,uint120,address,bool)', arguments: ['13'], description: 'Set Pool 13 rewards to 0 and unlock the pool, to allow principle withdrawal' }, { target: 'tribalChief', values: '0', - method: 'resetRewards(uint256)', + method: 'set(uint256,uint120,address,bool)', arguments: ['14'], description: 'Set Pool 14 rewards to 0 and unlock the pool, to allow principle withdrawal' }, { target: 'tribalChief', values: '0', - method: 'resetRewards(uint256)', + method: 'set(uint256,uint120,address,bool)', arguments: ['15'], description: 'Set Pool 15 rewards to 0 and unlock the pool, to allow principle withdrawal' }, { target: 'tribalChief', values: '0', - method: 'resetRewards(uint256)', + method: 'set(uint256,uint120,address,bool)', arguments: ['16'], description: 'Set Pool 16 rewards to 0 and unlock the pool, to allow principle withdrawal' }, { target: 'tribalChief', values: '0', - method: 'resetRewards(uint256)', + method: 'set(uint256,uint120,address,bool)', arguments: ['17'], description: 'Set Pool 17 rewards to 0 and unlock the pool, to allow principle withdrawal' }, + + //// Leave one pool with a non-zero AP allocation, but effectively zero { target: 'tribalChief', values: '0', - method: 'resetRewards(uint256)', - arguments: ['18'], - description: 'Set Pool 18 rewards to 0 and unlock the pool, to allow principle withdrawal' + method: 'set(uint256,uint120,address,bool)', + arguments: ['3', '1', '0x0000000000000000000000000000000000000000', false], + description: 'Set Fei Rari pool AP points to 1. Do not set the rewarder, overwrite is false' }, + //// Set block rewards to effectively 0 { target: 'tribalChief', values: '0', From 702b6309d296d0080b1b6c64a1b8a99b2c86a7db Mon Sep 17 00:00:00 2001 From: thomas-waite Date: Thu, 2 Jun 2022 14:48:25 +0100 Subject: [PATCH 187/274] feat: unlock all pools and verify --- proposals/dao/end_tribe_incentives.ts | 43 ++-- proposals/description/end_tribe_incentives.ts | 202 ++++++++++++++---- 2 files changed, 188 insertions(+), 57 deletions(-) diff --git a/proposals/dao/end_tribe_incentives.ts b/proposals/dao/end_tribe_incentives.ts index e4438399a..5e3e5b7ec 100644 --- a/proposals/dao/end_tribe_incentives.ts +++ b/proposals/dao/end_tribe_incentives.ts @@ -53,29 +53,20 @@ const validate: ValidateUpgradeFunc = async (addresses, oldContracts, contracts, // 1. Verify TribalChief block rewards are 0 expect(await tribalChief.tribePerBlock()).to.equal(0); - // 2. Validate that can harvest Tribe rewards - const receiver = '0xbEA4B2357e8ec53AF60BbcA4bc570332a7C7E232'; - const initialBalance = await tribe.balanceOf(receiver); - - const poolId = 0; // UniswapV2 Fei-Tribe LP pool - const stakerInFeiTribe = '0x7d809969f6a04777f0a87ff94b57e56078e5fe0f'; - const stakerInFeiTribeSigner = await getImpersonatedSigner(stakerInFeiTribe); - - await tribalChief.connect(stakerInFeiTribeSigner).harvest(poolId, receiver); - const finalBalance = await tribe.balanceOf(receiver); - const harvestedTribe = finalBalance.sub(initialBalance); - console.log('Harvested tribe: ', harvestedTribe.toString()); - expect(harvestedTribe).to.be.bignumber.at.least(0); - - // 3. Validate that all pools are unlocked and that AP points are set to zero, apart from Fei-Rari + // 2. Validate number of pools is as expected const poolIds = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17]; + const numPools = await tribalChief.numPools(); + expect(numPools).to.equal(poolIds.length); + // 3. Validate that all pools are unlocked, rewarders are set to 0 and AP points are set to zero, apart from Fei-Rari const feiRariPoolId = '3'; for (const pid in poolIds) { - const poolInfo = await tribalChief.poolInfo[pid]; + const poolInfo = await tribalChief.poolInfo(pid); + const rewarder = await tribalChief.rewarders(pid); console.log({ poolInfo }); expect(poolInfo.unlocked).to.equal(true); + expect(rewarder).to.equal(ethers.constants.AddressZero); if (pid == feiRariPoolId) { expect(poolInfo.allocPoint).to.be.bignumber.equal(1); @@ -83,6 +74,26 @@ const validate: ValidateUpgradeFunc = async (addresses, oldContracts, contracts, expect(poolInfo.allocPoint).to.be.bignumber.equal(0); } } + + // 4. Verify total AP points is 1 + expect(await tribalChief.totalAllocPoint()).to.be.bignumber.equal(1); + + // 5. Validate that can harvest Tribe rewards + const receiver = '0xbEA4B2357e8ec53AF60BbcA4bc570332a7C7E232'; + const initialBalance = await tribe.balanceOf(receiver); + + const poolId = 0; // UniswapV2 Fei-Tribe LP pool + const stakerInFeiTribe = '0x7d809969f6a04777f0a87ff94b57e56078e5fe0f'; + const stakerInFeiTribeSigner = await getImpersonatedSigner(stakerInFeiTribe); + + await tribalChief.connect(stakerInFeiTribeSigner).harvest(poolId, receiver); + const finalBalance = await tribe.balanceOf(receiver); + const harvestedTribe = finalBalance.sub(initialBalance); + console.log('Harvested tribe: ', harvestedTribe.toString()); + expect(harvestedTribe).to.be.bignumber.at.least(0); + + // 6. Validate can withdraw principle from staked pool + // TODO }; export { deploy, setup, teardown, validate }; diff --git a/proposals/description/end_tribe_incentives.ts b/proposals/description/end_tribe_incentives.ts index 3a4f73642..00ec7f494 100644 --- a/proposals/description/end_tribe_incentives.ts +++ b/proposals/description/end_tribe_incentives.ts @@ -12,142 +12,261 @@ const end_tribe_incentives: ProposalDescription = { arguments: [['0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11', '12', '13', '14', '15', '16', '17']], description: 'Update reward variables on all pools registered for Tribe rewards' }, - - //// Set Pool allocation points to 0 and unlock + ///////////// Replicate onlyGovernor behaviour or resetRewards() + //// Unlock pools all pools to allow principle withdrawal { target: 'tribalChief', values: '0', - method: 'set(uint256,uint120,address,bool)', + method: 'unlockPool(uint256)', arguments: ['0'], - description: 'Set Pool 0 rewards to 0 and unlock the pool, to allow principle withdrawal' + description: 'Unlock pool 0' }, { target: 'tribalChief', values: '0', - method: 'set(uint256,uint120,address,bool)', + method: 'unlockPool(uint256)', arguments: ['1'], - description: 'Set Pool 1 rewards to 0 and unlock the pool, to allow principle withdrawal' + description: 'Unlock pool 1' }, { target: 'tribalChief', values: '0', - method: 'set(uint256,uint120,address,bool)', + method: 'unlockPool(uint256)', arguments: ['2'], - description: 'Set Pool 2 rewards to 0 and unlock the pool, to allow principle withdrawal' + description: 'Unlock pool 2' }, { target: 'tribalChief', values: '0', - method: 'set(uint256,uint120,address,bool)', + method: 'unlockPool(uint256)', arguments: ['3'], - description: 'Set Pool 3 rewards to 0 and unlock the pool, to allow principle withdrawal' + description: 'Unlock pool 3' }, { target: 'tribalChief', values: '0', - method: 'set(uint256,uint120,address,bool)', + method: 'unlockPool(uint256)', arguments: ['4'], - description: 'Set Pool 4 rewards to 0 and unlock the pool, to allow principle withdrawal' + description: 'Unlock pool 4' }, { target: 'tribalChief', values: '0', - method: 'set(uint256,uint120,address,bool)', + method: 'unlockPool(uint256)', arguments: ['5'], - description: 'Set Pool 5 rewards to 0 and unlock the pool, to allow principle withdrawal' + description: 'Unlock pool 5' }, { target: 'tribalChief', values: '0', - method: 'set(uint256,uint120,address,bool)', + method: 'unlockPool(uint256)', arguments: ['6'], - description: 'Set Pool 6 rewards to 0 and unlock the pool, to allow principle withdrawal' + description: 'Unlock pool 6' }, { target: 'tribalChief', values: '0', - method: 'set(uint256,uint120,address,bool)', + method: 'unlockPool(uint256)', arguments: ['7'], - description: 'Set Pool 7 rewards to 0 and unlock the pool, to allow principle withdrawal' + description: 'Unlock pool 7' }, { target: 'tribalChief', values: '0', - method: 'set(uint256,uint120,address,bool)', + method: 'unlockPool(uint256)', arguments: ['8'], - description: 'Set Pool 8 rewards to 0 and unlock the pool, to allow principle withdrawal' + description: 'Unlock pool 8' }, { target: 'tribalChief', values: '0', - method: 'set(uint256,uint120,address,bool)', + method: 'unlockPool(uint256)', arguments: ['9'], - description: 'Set Pool 9 rewards to 0 and unlock the pool, to allow principle withdrawal' + description: 'Unlock pool 9' }, { target: 'tribalChief', values: '0', - method: 'set(uint256,uint120,address,bool)', + method: 'unlockPool(uint256)', arguments: ['10'], - description: 'Set Pool 10 rewards to 0 and unlock the pool, to allow principle withdrawal' + description: 'Unlock pool 10' }, { target: 'tribalChief', values: '0', - method: 'set(uint256,uint120,address,bool)', + method: 'unlockPool(uint256)', arguments: ['11'], - description: 'Set Pool 11 rewards to 0 and unlock the pool, to allow principle withdrawal' + description: 'Unlock pool 11' }, { target: 'tribalChief', values: '0', - method: 'set(uint256,uint120,address,bool)', + method: 'unlockPool(uint256)', arguments: ['12'], - description: 'Set Pool 12 rewards to 0 and unlock the pool, to allow principle withdrawal' + description: 'Unlock pool 12' }, { target: 'tribalChief', values: '0', - method: 'set(uint256,uint120,address,bool)', + method: 'unlockPool(uint256)', arguments: ['13'], - description: 'Set Pool 13 rewards to 0 and unlock the pool, to allow principle withdrawal' + description: 'Unlock pool 13' }, { target: 'tribalChief', values: '0', - method: 'set(uint256,uint120,address,bool)', + method: 'unlockPool(uint256)', arguments: ['14'], - description: 'Set Pool 14 rewards to 0 and unlock the pool, to allow principle withdrawal' + description: 'Unlock pool 14' }, { target: 'tribalChief', values: '0', - method: 'set(uint256,uint120,address,bool)', + method: 'unlockPool(uint256)', arguments: ['15'], - description: 'Set Pool 15 rewards to 0 and unlock the pool, to allow principle withdrawal' + description: 'Unlock pool 15' }, { target: 'tribalChief', values: '0', - method: 'set(uint256,uint120,address,bool)', + method: 'unlockPool(uint256)', arguments: ['16'], - description: 'Set Pool 16 rewards to 0 and unlock the pool, to allow principle withdrawal' + description: 'Unlock pool 16' }, { target: 'tribalChief', values: '0', - method: 'set(uint256,uint120,address,bool)', + method: 'unlockPool(uint256)', arguments: ['17'], - description: 'Set Pool 17 rewards to 0 and unlock the pool, to allow principle withdrawal' + description: 'Unlock pool 17' }, - //// Leave one pool with a non-zero AP allocation, but effectively zero + //////// Set Pool allocation points to 0 and set Rewarder address to 0x0 + { + target: 'tribalChief', + values: '0', + method: 'set(uint256,uint120,address,bool)', + arguments: ['0', '0', '0x0000000000000000000000000000000000000000', true], + description: 'Set Pool 0 rewards to 0 to allow principle withdrawal and set rewarder to 0x0' + }, + { + target: 'tribalChief', + values: '0', + method: 'set(uint256,uint120,address,bool)', + arguments: ['1', '0', '0x0000000000000000000000000000000000000000', true], + description: 'Set Pool 1 rewards to 0 to allow principle withdrawal and set rewarder to 0x0' + }, + { + target: 'tribalChief', + values: '0', + method: 'set(uint256,uint120,address,bool)', + arguments: ['2', '0', '0x0000000000000000000000000000000000000000', true], + description: 'Set Pool 2 rewards to 0 to allow principle withdrawal and set rewarder to 0x0' + }, + { + target: 'tribalChief', + values: '0', + method: 'set(uint256,uint120,address,bool)', + arguments: ['3', '1', '0x0000000000000000000000000000000000000000', true], + description: 'Set Pool 3 rewards to 1 to allow principle withdrawal and set rewarder to 0x0' + }, + { + target: 'tribalChief', + values: '0', + method: 'set(uint256,uint120,address,bool)', + arguments: ['4', '0', '0x0000000000000000000000000000000000000000', true], + description: 'Set Pool 4 rewards to 0 to allow principle withdrawal and set rewarder to 0x0' + }, + { + target: 'tribalChief', + values: '0', + method: 'set(uint256,uint120,address,bool)', + arguments: ['5', '0', '0x0000000000000000000000000000000000000000', true], + description: 'Set Pool 5 rewards to 0 to allow principle withdrawal and set rewarder to 0x0' + }, + { + target: 'tribalChief', + values: '0', + method: 'set(uint256,uint120,address,bool)', + arguments: ['6', '0', '0x0000000000000000000000000000000000000000', true], + description: 'Set Pool 6 rewards to 0 to allow principle withdrawal and set rewarder to 0x0' + }, + { + target: 'tribalChief', + values: '0', + method: 'set(uint256,uint120,address,bool)', + arguments: ['7', '0', '0x0000000000000000000000000000000000000000', true], + description: 'Set Pool 7 rewards to 0 to allow principle withdrawal and set rewarder to 0x0' + }, + { + target: 'tribalChief', + values: '0', + method: 'set(uint256,uint120,address,bool)', + arguments: ['8', '0', '0x0000000000000000000000000000000000000000', true], + description: 'Set Pool 8 rewards to 0 to allow principle withdrawal and set rewarder to 0x0' + }, + { + target: 'tribalChief', + values: '0', + method: 'set(uint256,uint120,address,bool)', + arguments: ['9', '0', '0x0000000000000000000000000000000000000000', true], + description: 'Set Pool 9 rewards to 0 to allow principle withdrawal and set rewarder to 0x0' + }, + { + target: 'tribalChief', + values: '0', + method: 'set(uint256,uint120,address,bool)', + arguments: ['10', '0', '0x0000000000000000000000000000000000000000', true], + description: 'Set Pool 10 rewards to 0 to allow principle withdrawal and set rewarder to 0x0' + }, + { + target: 'tribalChief', + values: '0', + method: 'set(uint256,uint120,address,bool)', + arguments: ['11', '0', '0x0000000000000000000000000000000000000000', true], + description: 'Set Pool 11 rewards to 0 to allow principle withdrawal and set rewarder to 0x0' + }, + { + target: 'tribalChief', + values: '0', + method: 'set(uint256,uint120,address,bool)', + arguments: ['12', '0', '0x0000000000000000000000000000000000000000', true], + description: 'Set Pool 12 rewards to 0 to allow principle withdrawal and set rewarder to 0x0' + }, + { + target: 'tribalChief', + values: '0', + method: 'set(uint256,uint120,address,bool)', + arguments: ['13', '0', '0x0000000000000000000000000000000000000000', true], + description: 'Set Pool 13 rewards to 0 to allow principle withdrawal and set rewarder to 0x0' + }, + { + target: 'tribalChief', + values: '0', + method: 'set(uint256,uint120,address,bool)', + arguments: ['14', '0', '0x0000000000000000000000000000000000000000', true], + description: 'Set Pool 14 rewards to 0 to allow principle withdrawal and set rewarder to 0x0' + }, + { + target: 'tribalChief', + values: '0', + method: 'set(uint256,uint120,address,bool)', + arguments: ['15', '0', '0x0000000000000000000000000000000000000000', true], + description: 'Set Pool 15 rewards to 0 to allow principle withdrawal and set rewarder to 0x0' + }, + { + target: 'tribalChief', + values: '0', + method: 'set(uint256,uint120,address,bool)', + arguments: ['16', '0', '0x0000000000000000000000000000000000000000', true], + description: 'Set Pool 16 rewards to 0 to allow principle withdrawal and set rewarder to 0x0' + }, { target: 'tribalChief', values: '0', method: 'set(uint256,uint120,address,bool)', - arguments: ['3', '1', '0x0000000000000000000000000000000000000000', false], - description: 'Set Fei Rari pool AP points to 1. Do not set the rewarder, overwrite is false' + arguments: ['17', '0', '0x0000000000000000000000000000000000000000', true], + description: 'Set Pool 17 rewards to 0 to allow principle withdrawal and set rewarder to 0x0' }, //// Set block rewards to effectively 0 @@ -172,6 +291,7 @@ const end_tribe_incentives: ProposalDescription = { TIP-109: Discontinue Tribe Incentives This proposal will disable all Tribe incentives. Specifically it: + - Unlocks all pools to allow principle to be withdrawn - Sets the allocation points of all pools effectively to 0 - Updates the reward variables of incentivised pools - Sets the amount of Tribe issued per block by the Tribal Chief to effectively zero From 03fdd22cf5ac1fd151c7fc7ce3b37d7ddae69375 Mon Sep 17 00:00:00 2001 From: thomas-waite Date: Thu, 2 Jun 2022 14:55:36 +0100 Subject: [PATCH 188/274] feat: grant TC timelock TribalChief admin --- proposals/dao/end_tribe_incentives.ts | 5 +++++ proposals/description/end_tribe_incentives.ts | 11 +++++++++++ protocol-configuration/permissions.ts | 2 +- 3 files changed, 17 insertions(+), 1 deletion(-) diff --git a/proposals/dao/end_tribe_incentives.ts b/proposals/dao/end_tribe_incentives.ts index 5e3e5b7ec..43263c588 100644 --- a/proposals/dao/end_tribe_incentives.ts +++ b/proposals/dao/end_tribe_incentives.ts @@ -50,6 +50,11 @@ const validate: ValidateUpgradeFunc = async (addresses, oldContracts, contracts, const tribe = contracts.tribe; const tribalChief = contracts.tribalChief; + // 0. Validate TC timelock has TRIBAL_CHIEF_ADMIN_ROLE role + expect( + await contracts.core.hasRole(ethers.utils.id('TRIBAL_CHIEF_ADMIN_ROLE'), addresses.tribalCouncilTimelock) + ).to.equal(true); + // 1. Verify TribalChief block rewards are 0 expect(await tribalChief.tribePerBlock()).to.equal(0); diff --git a/proposals/description/end_tribe_incentives.ts b/proposals/description/end_tribe_incentives.ts index 00ec7f494..e04f12a97 100644 --- a/proposals/description/end_tribe_incentives.ts +++ b/proposals/description/end_tribe_incentives.ts @@ -12,6 +12,15 @@ const end_tribe_incentives: ProposalDescription = { arguments: [['0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11', '12', '13', '14', '15', '16', '17']], description: 'Update reward variables on all pools registered for Tribe rewards' }, + /////// TC grants itself TRIBAL_CHIEF_ADMIN_ROLE + { + target: 'core', + values: '0', + method: 'grantRole(bytes32,address)', + arguments: ['0x23970cab3799b6876df4319661e6c03cc45bd59628799d92e988dd8cbdc90e31', '{tribalCouncilTimelock}'], + description: 'Grant TRIBAL_CHIEF_ADMIN_ROLE to Tribal Council timelock' + }, + ///////////// Replicate onlyGovernor behaviour or resetRewards() //// Unlock pools all pools to allow principle withdrawal { @@ -163,6 +172,8 @@ const end_tribe_incentives: ProposalDescription = { arguments: ['2', '0', '0x0000000000000000000000000000000000000000', true], description: 'Set Pool 2 rewards to 0 to allow principle withdrawal and set rewarder to 0x0' }, + + // Note: Setting a single pool here to have an AP point != 0 { target: 'tribalChief', values: '0', diff --git a/protocol-configuration/permissions.ts b/protocol-configuration/permissions.ts index 153f2f9d6..3dcf1755f 100644 --- a/protocol-configuration/permissions.ts +++ b/protocol-configuration/permissions.ts @@ -36,7 +36,7 @@ export const permissions = { RATE_LIMITED_MINTER_ADMIN: [], PARAMETER_ADMIN: [], PSM_ADMIN_ROLE: ['tribalCouncilTimelock'], - TRIBAL_CHIEF_ADMIN_ROLE: ['optimisticTimelock', 'tribalChiefSyncV2'], + TRIBAL_CHIEF_ADMIN_ROLE: ['optimisticTimelock', 'tribalChiefSyncV2', 'tribalCouncilTimelock'], FUSE_ADMIN: ['optimisticTimelock', 'tribalChiefSyncV2', 'tribalCouncilTimelock'], VOTIUM_ADMIN_ROLE: ['opsOptimisticTimelock'], PCV_GUARDIAN_ADMIN_ROLE: ['optimisticTimelock', 'tribalCouncilTimelock'], From 05cbc3b8f80727cf3aac3f59d469381e9265bead Mon Sep 17 00:00:00 2001 From: thomas-waite Date: Thu, 2 Jun 2022 15:51:56 +0100 Subject: [PATCH 189/274] refactor: do not change rewarder, more verification --- proposals/dao/end_tribe_incentives.ts | 37 ++++++---- proposals/description/end_tribe_incentives.ts | 74 +++++++++---------- 2 files changed, 59 insertions(+), 52 deletions(-) diff --git a/proposals/dao/end_tribe_incentives.ts b/proposals/dao/end_tribe_incentives.ts index 43263c588..902074920 100644 --- a/proposals/dao/end_tribe_incentives.ts +++ b/proposals/dao/end_tribe_incentives.ts @@ -8,6 +8,9 @@ import { ValidateUpgradeFunc } from '@custom-types/types'; import { getImpersonatedSigner } from '@test/helpers'; +import { forceEth } from '@test/integration/setup/utils'; + +const toBN = ethers.BigNumber.from; /* @@ -20,6 +23,9 @@ Steps: 2. Set TribalChief block reward to zero, to stop distributing new rewards */ +const NEW_TRIBE_BLOCK_REWARD = 100000; +const NEW_TOTAL_ALLOC_POINTS = 1; + const fipNumber = 'TIP-109: Discontinue Tribe Incentives'; // Do any deployments @@ -56,7 +62,7 @@ const validate: ValidateUpgradeFunc = async (addresses, oldContracts, contracts, ).to.equal(true); // 1. Verify TribalChief block rewards are 0 - expect(await tribalChief.tribePerBlock()).to.equal(0); + expect(await tribalChief.tribePerBlock()).to.equal(NEW_TRIBE_BLOCK_REWARD); // 2. Validate number of pools is as expected const poolIds = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17]; @@ -67,38 +73,39 @@ const validate: ValidateUpgradeFunc = async (addresses, oldContracts, contracts, const feiRariPoolId = '3'; for (const pid in poolIds) { const poolInfo = await tribalChief.poolInfo(pid); - const rewarder = await tribalChief.rewarders(pid); - console.log({ poolInfo }); - expect(poolInfo.unlocked).to.equal(true); - expect(rewarder).to.equal(ethers.constants.AddressZero); if (pid == feiRariPoolId) { - expect(poolInfo.allocPoint).to.be.bignumber.equal(1); + expect(poolInfo.allocPoint).to.be.equal(NEW_TOTAL_ALLOC_POINTS.toString()); } else { - expect(poolInfo.allocPoint).to.be.bignumber.equal(0); + expect(poolInfo.allocPoint).to.be.equal('0'); } } // 4. Verify total AP points is 1 - expect(await tribalChief.totalAllocPoint()).to.be.bignumber.equal(1); + expect(await tribalChief.totalAllocPoint()).to.be.equal(NEW_TOTAL_ALLOC_POINTS.toString()); // 5. Validate that can harvest Tribe rewards const receiver = '0xbEA4B2357e8ec53AF60BbcA4bc570332a7C7E232'; const initialBalance = await tribe.balanceOf(receiver); - const poolId = 0; // UniswapV2 Fei-Tribe LP pool - const stakerInFeiTribe = '0x7d809969f6a04777f0a87ff94b57e56078e5fe0f'; - const stakerInFeiTribeSigner = await getImpersonatedSigner(stakerInFeiTribe); + const poolId = 1; + // This is a staking token wrapper + const stakedTokenAddress = '0x06cb22615BA53E60D67Bf6C341a0fD5E718E1655'; + const stakerInPool = '0x019EdcB493Bd91e2b25b70f26D5d9041Fd7EF946'; + const stakerInPoolSigner = await getImpersonatedSigner(stakerInPool); + await forceEth(stakerInPool); + + const stakedToken = await ethers.getContractAt('StakingTokenWrapper', stakedTokenAddress); - await tribalChief.connect(stakerInFeiTribeSigner).harvest(poolId, receiver); + await tribalChief.connect(stakerInPoolSigner).harvest(poolId, receiver); const finalBalance = await tribe.balanceOf(receiver); const harvestedTribe = finalBalance.sub(initialBalance); - console.log('Harvested tribe: ', harvestedTribe.toString()); - expect(harvestedTribe).to.be.bignumber.at.least(0); + console.log('harvested tribe: ', harvestedTribe); + expect(harvestedTribe).to.be.bignumber.at.least(toBN(1)); // 6. Validate can withdraw principle from staked pool - // TODO + await tribalChief.connect(stakerInPoolSigner).withdrawAllAndHarvest(poolId, receiver); }; export { deploy, setup, teardown, validate }; diff --git a/proposals/description/end_tribe_incentives.ts b/proposals/description/end_tribe_incentives.ts index e04f12a97..df15f54ca 100644 --- a/proposals/description/end_tribe_incentives.ts +++ b/proposals/description/end_tribe_incentives.ts @@ -150,27 +150,27 @@ const end_tribe_incentives: ProposalDescription = { description: 'Unlock pool 17' }, - //////// Set Pool allocation points to 0 and set Rewarder address to 0x0 + //////// Set Pool allocation points to 0 and set Rewarder address to 0x0. This also updates reward variables { target: 'tribalChief', values: '0', method: 'set(uint256,uint120,address,bool)', - arguments: ['0', '0', '0x0000000000000000000000000000000000000000', true], - description: 'Set Pool 0 rewards to 0 to allow principle withdrawal and set rewarder to 0x0' + arguments: ['0', '0', '0x0000000000000000000000000000000000000000', false], + description: 'Set Pool 0 rewards to 0 to allow principle withdrawal and do not overwrite or change the rewarder' }, { target: 'tribalChief', values: '0', method: 'set(uint256,uint120,address,bool)', - arguments: ['1', '0', '0x0000000000000000000000000000000000000000', true], - description: 'Set Pool 1 rewards to 0 to allow principle withdrawal and set rewarder to 0x0' + arguments: ['1', '0', '0x0000000000000000000000000000000000000000', false], + description: 'Set Pool 1 rewards to 0 to allow principle withdrawal and do not overwrite or change the rewarder' }, { target: 'tribalChief', values: '0', method: 'set(uint256,uint120,address,bool)', - arguments: ['2', '0', '0x0000000000000000000000000000000000000000', true], - description: 'Set Pool 2 rewards to 0 to allow principle withdrawal and set rewarder to 0x0' + arguments: ['2', '0', '0x0000000000000000000000000000000000000000', false], + description: 'Set Pool 2 rewards to 0 to allow principle withdrawal and do not overwrite or change the rewarder' }, // Note: Setting a single pool here to have an AP point != 0 @@ -178,106 +178,106 @@ const end_tribe_incentives: ProposalDescription = { target: 'tribalChief', values: '0', method: 'set(uint256,uint120,address,bool)', - arguments: ['3', '1', '0x0000000000000000000000000000000000000000', true], - description: 'Set Pool 3 rewards to 1 to allow principle withdrawal and set rewarder to 0x0' + arguments: ['3', '1', '0x0000000000000000000000000000000000000000', false], + description: 'Set Pool 3 rewards to 1 to allow principle withdrawal and do not overwrite or change the rewarder' }, { target: 'tribalChief', values: '0', method: 'set(uint256,uint120,address,bool)', - arguments: ['4', '0', '0x0000000000000000000000000000000000000000', true], - description: 'Set Pool 4 rewards to 0 to allow principle withdrawal and set rewarder to 0x0' + arguments: ['4', '0', '0x0000000000000000000000000000000000000000', false], + description: 'Set Pool 4 rewards to 0 to allow principle withdrawal and do not overwrite or change the rewarder' }, { target: 'tribalChief', values: '0', method: 'set(uint256,uint120,address,bool)', - arguments: ['5', '0', '0x0000000000000000000000000000000000000000', true], - description: 'Set Pool 5 rewards to 0 to allow principle withdrawal and set rewarder to 0x0' + arguments: ['5', '0', '0x0000000000000000000000000000000000000000', false], + description: 'Set Pool 5 rewards to 0 to allow principle withdrawal and do not overwrite or change the rewarder' }, { target: 'tribalChief', values: '0', method: 'set(uint256,uint120,address,bool)', - arguments: ['6', '0', '0x0000000000000000000000000000000000000000', true], - description: 'Set Pool 6 rewards to 0 to allow principle withdrawal and set rewarder to 0x0' + arguments: ['6', '0', '0x0000000000000000000000000000000000000000', false], + description: 'Set Pool 6 rewards to 0 to allow principle withdrawal and do not overwrite or change the rewarder' }, { target: 'tribalChief', values: '0', method: 'set(uint256,uint120,address,bool)', - arguments: ['7', '0', '0x0000000000000000000000000000000000000000', true], - description: 'Set Pool 7 rewards to 0 to allow principle withdrawal and set rewarder to 0x0' + arguments: ['7', '0', '0x0000000000000000000000000000000000000000', false], + description: 'Set Pool 7 rewards to 0 to allow principle withdrawal and do not overwrite or change the rewarder' }, { target: 'tribalChief', values: '0', method: 'set(uint256,uint120,address,bool)', - arguments: ['8', '0', '0x0000000000000000000000000000000000000000', true], - description: 'Set Pool 8 rewards to 0 to allow principle withdrawal and set rewarder to 0x0' + arguments: ['8', '0', '0x0000000000000000000000000000000000000000', false], + description: 'Set Pool 8 rewards to 0 to allow principle withdrawal and do not overwrite or change the rewarder' }, { target: 'tribalChief', values: '0', method: 'set(uint256,uint120,address,bool)', - arguments: ['9', '0', '0x0000000000000000000000000000000000000000', true], - description: 'Set Pool 9 rewards to 0 to allow principle withdrawal and set rewarder to 0x0' + arguments: ['9', '0', '0x0000000000000000000000000000000000000000', false], + description: 'Set Pool 9 rewards to 0 to allow principle withdrawal and do not overwrite or change the rewarder' }, { target: 'tribalChief', values: '0', method: 'set(uint256,uint120,address,bool)', - arguments: ['10', '0', '0x0000000000000000000000000000000000000000', true], - description: 'Set Pool 10 rewards to 0 to allow principle withdrawal and set rewarder to 0x0' + arguments: ['10', '0', '0x0000000000000000000000000000000000000000', false], + description: 'Set Pool 10 rewards to 0 to allow principle withdrawal and do not overwrite or change the rewarder' }, { target: 'tribalChief', values: '0', method: 'set(uint256,uint120,address,bool)', - arguments: ['11', '0', '0x0000000000000000000000000000000000000000', true], - description: 'Set Pool 11 rewards to 0 to allow principle withdrawal and set rewarder to 0x0' + arguments: ['11', '0', '0x0000000000000000000000000000000000000000', false], + description: 'Set Pool 11 rewards to 0 to allow principle withdrawal and do not overwrite or change the rewarder' }, { target: 'tribalChief', values: '0', method: 'set(uint256,uint120,address,bool)', - arguments: ['12', '0', '0x0000000000000000000000000000000000000000', true], - description: 'Set Pool 12 rewards to 0 to allow principle withdrawal and set rewarder to 0x0' + arguments: ['12', '0', '0x0000000000000000000000000000000000000000', false], + description: 'Set Pool 12 rewards to 0 to allow principle withdrawal and do not overwrite or change the rewarder' }, { target: 'tribalChief', values: '0', method: 'set(uint256,uint120,address,bool)', - arguments: ['13', '0', '0x0000000000000000000000000000000000000000', true], - description: 'Set Pool 13 rewards to 0 to allow principle withdrawal and set rewarder to 0x0' + arguments: ['13', '0', '0x0000000000000000000000000000000000000000', false], + description: 'Set Pool 13 rewards to 0 to allow principle withdrawal and do not overwrite or change the rewarder' }, { target: 'tribalChief', values: '0', method: 'set(uint256,uint120,address,bool)', - arguments: ['14', '0', '0x0000000000000000000000000000000000000000', true], - description: 'Set Pool 14 rewards to 0 to allow principle withdrawal and set rewarder to 0x0' + arguments: ['14', '0', '0x0000000000000000000000000000000000000000', false], + description: 'Set Pool 14 rewards to 0 to allow principle withdrawal and do not overwrite or change the rewarder' }, { target: 'tribalChief', values: '0', method: 'set(uint256,uint120,address,bool)', - arguments: ['15', '0', '0x0000000000000000000000000000000000000000', true], - description: 'Set Pool 15 rewards to 0 to allow principle withdrawal and set rewarder to 0x0' + arguments: ['15', '0', '0x0000000000000000000000000000000000000000', false], + description: 'Set Pool 15 rewards to 0 to allow principle withdrawal and do not overwrite or change the rewarder' }, { target: 'tribalChief', values: '0', method: 'set(uint256,uint120,address,bool)', - arguments: ['16', '0', '0x0000000000000000000000000000000000000000', true], - description: 'Set Pool 16 rewards to 0 to allow principle withdrawal and set rewarder to 0x0' + arguments: ['16', '0', '0x0000000000000000000000000000000000000000', false], + description: 'Set Pool 16 rewards to 0 to allow principle withdrawal and do not overwrite or change the rewarder' }, { target: 'tribalChief', values: '0', method: 'set(uint256,uint120,address,bool)', - arguments: ['17', '0', '0x0000000000000000000000000000000000000000', true], - description: 'Set Pool 17 rewards to 0 to allow principle withdrawal and set rewarder to 0x0' + arguments: ['17', '0', '0x0000000000000000000000000000000000000000', false], + description: 'Set Pool 17 rewards to 0 to allow principle withdrawal and do not overwrite or change the rewarder' }, //// Set block rewards to effectively 0 From 22cfafc76083d88121018e65d6121790db998561 Mon Sep 17 00:00:00 2001 From: thomas-waite Date: Thu, 2 Jun 2022 15:54:32 +0100 Subject: [PATCH 190/274] test: verify withdrawn principle --- proposals/dao/end_tribe_incentives.ts | 16 ++++++++++++---- proposals/description/end_tribe_incentives.ts | 8 -------- test/integration/proposals_config.ts | 2 +- 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/proposals/dao/end_tribe_incentives.ts b/proposals/dao/end_tribe_incentives.ts index 902074920..4fcf7a453 100644 --- a/proposals/dao/end_tribe_incentives.ts +++ b/proposals/dao/end_tribe_incentives.ts @@ -16,11 +16,13 @@ const toBN = ethers.BigNumber.from; TIP-109: Discontinue Tribe Incentives -Ends all Tribe Incentives being distributed +Ends all Tribe Incentives being distributed. -Steps: -1. Mass update all pools registered for Tribe rewards, so they have all rewards they are entitled to so far -2. Set TribalChief block reward to zero, to stop distributing new rewards +Specifically: +- Unlock all pools to release principle +- Set AP rewards of all pools to 0, and set one pool AP reward to 1 +- Effectively set Tribe block reward to 0 +- Remove CREAM deposit from CR */ const NEW_TRIBE_BLOCK_REWARD = 100000; @@ -105,7 +107,13 @@ const validate: ValidateUpgradeFunc = async (addresses, oldContracts, contracts, expect(harvestedTribe).to.be.bignumber.at.least(toBN(1)); // 6. Validate can withdraw principle from staked pool + const receiverBalanceBefore = await stakedToken.balanceOf(receiver); await tribalChief.connect(stakerInPoolSigner).withdrawAllAndHarvest(poolId, receiver); + const receiverBalanceAfter = await stakedToken.balanceOf(receiver); + const withdrawnPrinciple = receiverBalanceAfter.sub(receiverBalanceBefore); + console.log('withdrawn principle: ', withdrawnPrinciple.toString()); + + expect(withdrawnPrinciple).to.be.bignumber.at.least(toBN(1)); }; export { deploy, setup, teardown, validate }; diff --git a/proposals/description/end_tribe_incentives.ts b/proposals/description/end_tribe_incentives.ts index df15f54ca..af36d3f9a 100644 --- a/proposals/description/end_tribe_incentives.ts +++ b/proposals/description/end_tribe_incentives.ts @@ -4,14 +4,6 @@ const end_tribe_incentives: ProposalDescription = { // Pool ID is where the pool is in the array title: 'TIP-109: Discontinue Tribe Incentives', commands: [ - ///// Update reward variables of all pools - { - target: 'tribalChief', - values: '0', - method: 'massUpdatePools(uint256[])', - arguments: [['0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11', '12', '13', '14', '15', '16', '17']], - description: 'Update reward variables on all pools registered for Tribe rewards' - }, /////// TC grants itself TRIBAL_CHIEF_ADMIN_ROLE { target: 'core', diff --git a/test/integration/proposals_config.ts b/test/integration/proposals_config.ts index 11394a1a2..c1e650513 100644 --- a/test/integration/proposals_config.ts +++ b/test/integration/proposals_config.ts @@ -28,7 +28,7 @@ const proposals: ProposalsConfigMap = { totalValue: 0, // amount of ETH to send to DAO execution proposal: end_tribe_incentives, // full proposal file, imported from '@proposals/description/fip_xx.ts' proposalId: '', - affectedContractSignoff: ['tribalChief', 'creamDepositWrapper'], + affectedContractSignoff: ['core', 'tribalChief', 'tribalCouncilTimelock', 'creamDepositWrapper'], deprecatedContractSignoff: [], category: ProposalCategory.DEBUG_TC } From bd07d8de7be7811624dd7d3c5c4a5f6701526417 Mon Sep 17 00:00:00 2001 From: thomas-waite Date: Thu, 2 Jun 2022 16:05:20 +0100 Subject: [PATCH 191/274] refactor: various config fixes --- .../collateralizationOracle.ts | 1 - protocol-configuration/mainnetAddresses.ts | 2 +- protocol-configuration/tribalchief.ts | 34 +++++++++---------- test/integration/proposals_config.ts | 10 ++++-- 4 files changed, 26 insertions(+), 21 deletions(-) diff --git a/protocol-configuration/collateralizationOracle.ts b/protocol-configuration/collateralizationOracle.ts index 61ebc4241..6ed1e8c77 100644 --- a/protocol-configuration/collateralizationOracle.ts +++ b/protocol-configuration/collateralizationOracle.ts @@ -16,7 +16,6 @@ const collateralizationAddresses = { dai: ['compoundDaiPCVDepositWrapper', 'daiFixedPricePSM', 'dpiToDaiLensDai'], usd: ['namedStaticPCVDepositWrapper', 'd3poolCurvePCVDeposit', 'd3poolConvexPCVDeposit'], bal: ['balancerDepositBalWeth', 'balancerLensVeBalBal', 'balancerGaugeStaker'], - cream: ['creamDepositWrapper'], weth: [ 'ethLidoPCVDepositWrapper', 'compoundEthPCVDepositWrapper', diff --git a/protocol-configuration/mainnetAddresses.ts b/protocol-configuration/mainnetAddresses.ts index 51ef7ba1b..e7301939b 100644 --- a/protocol-configuration/mainnetAddresses.ts +++ b/protocol-configuration/mainnetAddresses.ts @@ -519,7 +519,7 @@ const MainnetAddresses: MainnetAddresses = { creamDepositWrapper: { artifactName: 'ERC20PCVDepositWrapper', address: '0x3a1838Ac9EcA864054bebB82C32455Dd7d7Fc89c', - category: AddressCategory.Deprecated + category: AddressCategory.PCV }, ethLidoPCVDepositWrapper: { artifactName: 'PCVDepositWrapper', diff --git a/protocol-configuration/tribalchief.ts b/protocol-configuration/tribalchief.ts index 7e583de6d..da5248ca5 100644 --- a/protocol-configuration/tribalchief.ts +++ b/protocol-configuration/tribalchief.ts @@ -1,24 +1,24 @@ import { TribalChiefConfig } from '../types/types'; const config: TribalChiefConfig = { - feiTribePair: { allocPoint: 0, unlocked: false }, // Uniswap-v2 FEI/TRIBE LP - curve3Metapool: { allocPoint: 0, unlocked: false }, // Curve 3crv-FEI metapool LP + feiTribePair: { allocPoint: 0, unlocked: true }, // Uniswap-v2 FEI/TRIBE LP + curve3Metapool: { allocPoint: 0, unlocked: true }, // Curve 3crv-FEI metapool LP gUniFeiDaiLP: { allocPoint: 0, unlocked: true }, // G-UNI DAI/FEI 0.05% fee tier - stakingTokenWrapperRari: { allocPoint: 1, unlocked: false }, // FeiRari: TRIBE - stakingTokenWrapperGROLaaS: { allocPoint: 0, unlocked: false }, // LaaS: GRO - stakingTokenWrapperFOXLaaS: { allocPoint: 0, unlocked: false }, // LaaS: FOX - stakingTokenWrapperUMALaaS: { allocPoint: 0, unlocked: false }, // LaaS: UMA - stakingTokenWrapperSYNLaaS: { allocPoint: 0, unlocked: false }, // LaaS: SYN - stakingTokenWrapperNEARLaaS: { allocPoint: 0, unlocked: false }, // LaaS: NEAR - stakingTokenWrapperKYLINLaaS: { allocPoint: 0, unlocked: false }, // LaaS: KYLIN - stakingTokenWrapperMStableLaaS: { allocPoint: 0, unlocked: false }, // LaaS: MStable - stakingTokenWrapperPoolTogetherLaaS: { allocPoint: 0, unlocked: false }, // LaaS: PoolTogether - stakingTokenWrapperBribeD3pool: { allocPoint: 0, unlocked: false }, // Votium bribes: d3pool - d3StakingTokenWrapper: { allocPoint: 0, unlocked: false }, // FeiRari: d3pool LP - fei3CrvStakingtokenWrapper: { allocPoint: 0, unlocked: false }, // FeiRari: 3crv-FEI metapool LP - feiDaiStakingTokenWrapper: { allocPoint: 0, unlocked: false }, // FeiRari: G-UNI DAI/FEI 0.05% fee tier - feiUsdcStakingTokenWrapper: { allocPoint: 0, unlocked: false }, // FeiRari: G-UNI USDC/FEI 0.01% fee tier - stakingTokenWrapperBribe3Crvpool: { allocPoint: 0, unlocked: false } // Votium bribes: 3crv-FEI metapool + stakingTokenWrapperRari: { allocPoint: 1, unlocked: true }, // FeiRari: TRIBE + stakingTokenWrapperGROLaaS: { allocPoint: 0, unlocked: true }, // LaaS: GRO + stakingTokenWrapperFOXLaaS: { allocPoint: 0, unlocked: true }, // LaaS: FOX + stakingTokenWrapperUMALaaS: { allocPoint: 0, unlocked: true }, // LaaS: UMA + stakingTokenWrapperSYNLaaS: { allocPoint: 0, unlocked: true }, // LaaS: SYN + stakingTokenWrapperNEARLaaS: { allocPoint: 0, unlocked: true }, // LaaS: NEAR + stakingTokenWrapperKYLINLaaS: { allocPoint: 0, unlocked: true }, // LaaS: KYLIN + stakingTokenWrapperMStableLaaS: { allocPoint: 0, unlocked: true }, // LaaS: MStable + stakingTokenWrapperPoolTogetherLaaS: { allocPoint: 0, unlocked: true }, // LaaS: PoolTogether + stakingTokenWrapperBribeD3pool: { allocPoint: 0, unlocked: true }, // Votium bribes: d3pool + d3StakingTokenWrapper: { allocPoint: 0, unlocked: true }, // FeiRari: d3pool LP + fei3CrvStakingtokenWrapper: { allocPoint: 0, unlocked: true }, // FeiRari: 3crv-FEI metapool LP + feiDaiStakingTokenWrapper: { allocPoint: 0, unlocked: true }, // FeiRari: G-UNI DAI/FEI 0.05% fee tier + feiUsdcStakingTokenWrapper: { allocPoint: 0, unlocked: true }, // FeiRari: G-UNI USDC/FEI 0.01% fee tier + stakingTokenWrapperBribe3Crvpool: { allocPoint: 0, unlocked: true } // Votium bribes: 3crv-FEI metapool }; export default config; diff --git a/test/integration/proposals_config.ts b/test/integration/proposals_config.ts index c1e650513..6fafc2699 100644 --- a/test/integration/proposals_config.ts +++ b/test/integration/proposals_config.ts @@ -28,9 +28,15 @@ const proposals: ProposalsConfigMap = { totalValue: 0, // amount of ETH to send to DAO execution proposal: end_tribe_incentives, // full proposal file, imported from '@proposals/description/fip_xx.ts' proposalId: '', - affectedContractSignoff: ['core', 'tribalChief', 'tribalCouncilTimelock', 'creamDepositWrapper'], + affectedContractSignoff: [ + 'core', + 'tribalChief', + 'tribalCouncilTimelock', + 'creamDepositWrapper', + 'collateralizationOracle' + ], deprecatedContractSignoff: [], - category: ProposalCategory.DEBUG_TC + category: ProposalCategory.TC } }; From c7a5fb0731d4d13c2ed6fa703b62d3527a70882b Mon Sep 17 00:00:00 2001 From: thomas-waite Date: Thu, 2 Jun 2022 16:38:01 +0100 Subject: [PATCH 192/274] test: make most e2es pass --- protocol-configuration/tribalchief.ts | 36 +++++++++++++------------- test/integration/tests/staking.ts | 16 ++++++++++-- test/integration/tests/votium-bribe.ts | 4 +++ 3 files changed, 36 insertions(+), 20 deletions(-) diff --git a/protocol-configuration/tribalchief.ts b/protocol-configuration/tribalchief.ts index da5248ca5..fb904e278 100644 --- a/protocol-configuration/tribalchief.ts +++ b/protocol-configuration/tribalchief.ts @@ -1,24 +1,24 @@ import { TribalChiefConfig } from '../types/types'; const config: TribalChiefConfig = { - feiTribePair: { allocPoint: 0, unlocked: true }, // Uniswap-v2 FEI/TRIBE LP - curve3Metapool: { allocPoint: 0, unlocked: true }, // Curve 3crv-FEI metapool LP - gUniFeiDaiLP: { allocPoint: 0, unlocked: true }, // G-UNI DAI/FEI 0.05% fee tier - stakingTokenWrapperRari: { allocPoint: 1, unlocked: true }, // FeiRari: TRIBE - stakingTokenWrapperGROLaaS: { allocPoint: 0, unlocked: true }, // LaaS: GRO - stakingTokenWrapperFOXLaaS: { allocPoint: 0, unlocked: true }, // LaaS: FOX - stakingTokenWrapperUMALaaS: { allocPoint: 0, unlocked: true }, // LaaS: UMA - stakingTokenWrapperSYNLaaS: { allocPoint: 0, unlocked: true }, // LaaS: SYN - stakingTokenWrapperNEARLaaS: { allocPoint: 0, unlocked: true }, // LaaS: NEAR - stakingTokenWrapperKYLINLaaS: { allocPoint: 0, unlocked: true }, // LaaS: KYLIN - stakingTokenWrapperMStableLaaS: { allocPoint: 0, unlocked: true }, // LaaS: MStable - stakingTokenWrapperPoolTogetherLaaS: { allocPoint: 0, unlocked: true }, // LaaS: PoolTogether - stakingTokenWrapperBribeD3pool: { allocPoint: 0, unlocked: true }, // Votium bribes: d3pool - d3StakingTokenWrapper: { allocPoint: 0, unlocked: true }, // FeiRari: d3pool LP - fei3CrvStakingtokenWrapper: { allocPoint: 0, unlocked: true }, // FeiRari: 3crv-FEI metapool LP - feiDaiStakingTokenWrapper: { allocPoint: 0, unlocked: true }, // FeiRari: G-UNI DAI/FEI 0.05% fee tier - feiUsdcStakingTokenWrapper: { allocPoint: 0, unlocked: true }, // FeiRari: G-UNI USDC/FEI 0.01% fee tier - stakingTokenWrapperBribe3Crvpool: { allocPoint: 0, unlocked: true } // Votium bribes: 3crv-FEI metapool + feiTribePair: { allocPoint: 0, unlocked: true }, // Uniswap-v2 FEI/TRIBE LP, 0 (poolId) + curve3Metapool: { allocPoint: 0, unlocked: true }, // Curve 3crv-FEI metapool LP, 1 + gUniFeiDaiLP: { allocPoint: 0, unlocked: true }, // G-UNI DAI/FEI 0.05% fee tier, 2 + stakingTokenWrapperRari: { allocPoint: 1, unlocked: true }, // FeiRari: TRIBE, 3 + stakingTokenWrapperGROLaaS: { allocPoint: 0, unlocked: true }, // LaaS: GRO, 4 + stakingTokenWrapperFOXLaaS: { allocPoint: 0, unlocked: true }, // LaaS: FOX, 5 + stakingTokenWrapperUMALaaS: { allocPoint: 0, unlocked: true }, // LaaS: UMA, 6 + stakingTokenWrapperSYNLaaS: { allocPoint: 0, unlocked: true }, // LaaS: SYN, 7 + stakingTokenWrapperNEARLaaS: { allocPoint: 0, unlocked: true }, // LaaS: NEAR, 8 + stakingTokenWrapperKYLINLaaS: { allocPoint: 0, unlocked: true }, // LaaS: KYLIN, 9 + stakingTokenWrapperMStableLaaS: { allocPoint: 0, unlocked: true }, // LaaS: MStable, 10 + stakingTokenWrapperPoolTogetherLaaS: { allocPoint: 0, unlocked: true }, // LaaS: PoolTogether, 11 + stakingTokenWrapperBribeD3pool: { allocPoint: 0, unlocked: true }, // Votium bribes: d3pool, 12 + d3StakingTokenWrapper: { allocPoint: 0, unlocked: true }, // FeiRari: d3pool LP, 13 + fei3CrvStakingtokenWrapper: { allocPoint: 0, unlocked: true }, // FeiRari: 3crv-FEI metapool LP, 14 + feiDaiStakingTokenWrapper: { allocPoint: 0, unlocked: true }, // FeiRari: G-UNI DAI/FEI 0.05% fee tier, 15 + feiUsdcStakingTokenWrapper: { allocPoint: 0, unlocked: true }, // FeiRari: G-UNI USDC/FEI 0.01% fee tier, 16 + stakingTokenWrapperBribe3Crvpool: { allocPoint: 0, unlocked: true } // Votium bribes: 3crv-FEI metapool, 17 }; export default config; diff --git a/test/integration/tests/staking.ts b/test/integration/tests/staking.ts index 72d9caa4f..2021d39aa 100644 --- a/test/integration/tests/staking.ts +++ b/test/integration/tests/staking.ts @@ -11,11 +11,10 @@ import { solidity } from 'ethereum-waffle'; import { BigNumber, Contract } from 'ethers'; import hre, { ethers } from 'hardhat'; import { NamedAddresses, NamedContracts } from '@custom-types/types'; -import { expectApprox, getImpersonatedSigner, resetFork, time } from '@test/helpers'; +import { expectApprox, getImpersonatedSigner, time } from '@test/helpers'; import proposals from '@test/integration/proposals_config'; import { TestEndtoEndCoordinator } from '../setup'; import { forceEth } from '@test/integration/setup/utils'; -import { BN } from 'ethereumjs-util'; const toBN = ethers.BigNumber.from; @@ -199,6 +198,19 @@ describe('e2e-staking', function () { params: [optimisticTimelock.address] }); await forceEth(optimisticTimelock.address); + + // TribalChief fixture: setup with non-zero block reward and various pools with allocation points + const daoSigner = await getImpersonatedSigner(contracts.feiDAOTimelock.address); + await forceEth(contracts.feiDAOTimelock.address); + await contracts.tribalChief.connect(daoSigner).updateBlockReward('26150000000000000000'); + + // Initialise various pools with rewards + await contracts.tribalChief.connect(daoSigner).set(pid, poolAllocPoints, ethers.constants.AddressZero, false); + await contracts.tribalChief.connect(daoSigner).set(12, 250, ethers.constants.AddressZero, false); + await contracts.tribalChief.connect(daoSigner).set(13, 250, ethers.constants.AddressZero, false); + await contracts.tribalChief.connect(daoSigner).set(15, 100, ethers.constants.AddressZero, false); + await contracts.tribalChief.connect(daoSigner).set(16, 500, ethers.constants.AddressZero, false); + await contracts.tribalChief.connect(daoSigner).set(17, 250, ethers.constants.AddressZero, false); }); describe('Staking Token Wrapper', async () => { diff --git a/test/integration/tests/votium-bribe.ts b/test/integration/tests/votium-bribe.ts index 1f3b60e39..b44ffcca6 100644 --- a/test/integration/tests/votium-bribe.ts +++ b/test/integration/tests/votium-bribe.ts @@ -43,6 +43,10 @@ describe('votium-bribe', function () { await forceEth(contracts.opsOptimisticTimelock.address); daoSigner = await getImpersonatedSigner(contracts.feiDAOTimelock.address); await forceEth(contracts.feiDAOTimelock.address); + + // Setup TribalChief so that rewards are active + await contracts.tribalChief.connect(daoSigner).updateBlockReward('26150000000000000000'); + await contracts.tribalChief.connect(daoSigner).set(12, 250, ethers.constants.AddressZero, false); }); describe('When no voting round is active', async function () { From dbc5ccbb2ff2a9f7557f91153972b0edf8977278 Mon Sep 17 00:00:00 2001 From: thomas-waite Date: Thu, 2 Jun 2022 17:02:17 +0100 Subject: [PATCH 193/274] test: set pool alloc points to tests pass --- proposals/dao/end_tribe_incentives.ts | 3 -- test/integration/tests/staking.ts | 45 ++++++++++++++++++++------- 2 files changed, 33 insertions(+), 15 deletions(-) diff --git a/proposals/dao/end_tribe_incentives.ts b/proposals/dao/end_tribe_incentives.ts index 4fcf7a453..e4c73e4cf 100644 --- a/proposals/dao/end_tribe_incentives.ts +++ b/proposals/dao/end_tribe_incentives.ts @@ -103,7 +103,6 @@ const validate: ValidateUpgradeFunc = async (addresses, oldContracts, contracts, await tribalChief.connect(stakerInPoolSigner).harvest(poolId, receiver); const finalBalance = await tribe.balanceOf(receiver); const harvestedTribe = finalBalance.sub(initialBalance); - console.log('harvested tribe: ', harvestedTribe); expect(harvestedTribe).to.be.bignumber.at.least(toBN(1)); // 6. Validate can withdraw principle from staked pool @@ -111,8 +110,6 @@ const validate: ValidateUpgradeFunc = async (addresses, oldContracts, contracts, await tribalChief.connect(stakerInPoolSigner).withdrawAllAndHarvest(poolId, receiver); const receiverBalanceAfter = await stakedToken.balanceOf(receiver); const withdrawnPrinciple = receiverBalanceAfter.sub(receiverBalanceBefore); - console.log('withdrawn principle: ', withdrawnPrinciple.toString()); - expect(withdrawnPrinciple).to.be.bignumber.at.least(toBN(1)); }; diff --git a/test/integration/tests/staking.ts b/test/integration/tests/staking.ts index 2021d39aa..713d93444 100644 --- a/test/integration/tests/staking.ts +++ b/test/integration/tests/staking.ts @@ -186,6 +186,21 @@ describe('e2e-staking', function () { before(async () => { stakingTokenWrapper = contracts.stakingTokenWrapperRari; tribalChief = contracts.tribalChief as TribalChief; + + // TribalChief fixture: setup with non-zero block reward and various pools with allocation points + const daoSigner = await getImpersonatedSigner(contracts.feiDAOTimelock.address); + await forceEth(contracts.feiDAOTimelock.address); + await tribalChief.connect(daoSigner).updateBlockReward('26150000000000000000'); + + // Initialise various pools with rewards + await tribalChief.connect(daoSigner).set(pid, poolAllocPoints, ethers.constants.AddressZero, false); + await tribalChief.connect(daoSigner).set(12, 250, ethers.constants.AddressZero, false); + await tribalChief.connect(daoSigner).set(13, 250, ethers.constants.AddressZero, false); + await tribalChief.connect(daoSigner).set(14, 1000, ethers.constants.AddressZero, false); + await tribalChief.connect(daoSigner).set(15, 100, ethers.constants.AddressZero, false); + await tribalChief.connect(daoSigner).set(16, 500, ethers.constants.AddressZero, false); + await tribalChief.connect(daoSigner).set(17, 250, ethers.constants.AddressZero, false); + tribePerBlock = await tribalChief.tribePerBlock(); rewardsDistributorAdmin = contracts.rewardsDistributorAdmin; @@ -199,18 +214,7 @@ describe('e2e-staking', function () { }); await forceEth(optimisticTimelock.address); - // TribalChief fixture: setup with non-zero block reward and various pools with allocation points - const daoSigner = await getImpersonatedSigner(contracts.feiDAOTimelock.address); - await forceEth(contracts.feiDAOTimelock.address); - await contracts.tribalChief.connect(daoSigner).updateBlockReward('26150000000000000000'); - - // Initialise various pools with rewards - await contracts.tribalChief.connect(daoSigner).set(pid, poolAllocPoints, ethers.constants.AddressZero, false); - await contracts.tribalChief.connect(daoSigner).set(12, 250, ethers.constants.AddressZero, false); - await contracts.tribalChief.connect(daoSigner).set(13, 250, ethers.constants.AddressZero, false); - await contracts.tribalChief.connect(daoSigner).set(15, 100, ethers.constants.AddressZero, false); - await contracts.tribalChief.connect(daoSigner).set(16, 500, ethers.constants.AddressZero, false); - await contracts.tribalChief.connect(daoSigner).set(17, 250, ethers.constants.AddressZero, false); + totalAllocPoint = await tribalChief.totalAllocPoint(); }); describe('Staking Token Wrapper', async () => { @@ -345,6 +349,23 @@ describe('e2e-staking', function () { }); describe('TribalChiefSyncV2', async () => { + before(async () => { + const tribalChief = contracts.tribalChief; + // Fixture: Set Tribe block reward to be greater than 0 + const daoSigner = await getImpersonatedSigner(contracts.feiDAOTimelock.address); + await forceEth(contracts.feiDAOTimelock.address); + await contracts.tribalChief.connect(daoSigner).updateBlockReward('26150000000000000000'); + + // Initialise various pools with rewards + await tribalChief.connect(daoSigner).set(3, 1000, ethers.constants.AddressZero, false); + await tribalChief.connect(daoSigner).set(12, 250, ethers.constants.AddressZero, false); + await tribalChief.connect(daoSigner).set(13, 250, ethers.constants.AddressZero, false); + await tribalChief.connect(daoSigner).set(14, 1000, ethers.constants.AddressZero, false); + await tribalChief.connect(daoSigner).set(15, 100, ethers.constants.AddressZero, false); + await tribalChief.connect(daoSigner).set(16, 500, ethers.constants.AddressZero, false); + await tribalChief.connect(daoSigner).set(17, 250, ethers.constants.AddressZero, false); + }); + it('auto-sync works correctly', async () => { const tribalChiefSync: TribalChiefSyncV2 = contracts.tribalChiefSyncV2 as TribalChiefSyncV2; const tribalChiefSyncExtension: TribalChiefSyncExtension = From 18f56d08208dd0a2ebfae3f369fb2a4d8b39904d Mon Sep 17 00:00:00 2001 From: thomas-waite Date: Thu, 2 Jun 2022 17:11:56 +0100 Subject: [PATCH 194/274] deps: update --- proposals/dao/end_tribe_incentives.ts | 2 +- proposals/description/end_tribe_incentives.ts | 2 +- protocol-configuration/dependencies.ts | 5 ----- protocol-configuration/mainnetAddresses.ts | 2 +- test/integration/proposals_config.ts | 10 ++-------- 5 files changed, 5 insertions(+), 16 deletions(-) diff --git a/proposals/dao/end_tribe_incentives.ts b/proposals/dao/end_tribe_incentives.ts index e4c73e4cf..91e57cef0 100644 --- a/proposals/dao/end_tribe_incentives.ts +++ b/proposals/dao/end_tribe_incentives.ts @@ -63,7 +63,7 @@ const validate: ValidateUpgradeFunc = async (addresses, oldContracts, contracts, await contracts.core.hasRole(ethers.utils.id('TRIBAL_CHIEF_ADMIN_ROLE'), addresses.tribalCouncilTimelock) ).to.equal(true); - // 1. Verify TribalChief block rewards are 0 + // 1. Verify TribalChief block rewards are effectively 0 expect(await tribalChief.tribePerBlock()).to.equal(NEW_TRIBE_BLOCK_REWARD); // 2. Validate number of pools is as expected diff --git a/proposals/description/end_tribe_incentives.ts b/proposals/description/end_tribe_incentives.ts index af36d3f9a..b28fd9c93 100644 --- a/proposals/description/end_tribe_incentives.ts +++ b/proposals/description/end_tribe_incentives.ts @@ -142,7 +142,7 @@ const end_tribe_incentives: ProposalDescription = { description: 'Unlock pool 17' }, - //////// Set Pool allocation points to 0 and set Rewarder address to 0x0. This also updates reward variables + //////// Set Pool allocation points to 0. This also updates reward variables { target: 'tribalChief', values: '0', diff --git a/protocol-configuration/dependencies.ts b/protocol-configuration/dependencies.ts index 2543725c5..82efbe7c6 100644 --- a/protocol-configuration/dependencies.ts +++ b/protocol-configuration/dependencies.ts @@ -247,7 +247,6 @@ const dependencies: DependencyMap = { 'feiDAO', 'fei', 'proxyAdmin', - 'creamDepositWrapper', 'wethDepositWrapper', 'agEurDepositWrapper', 'aaveTribeIncentivesController', @@ -475,7 +474,6 @@ const dependencies: DependencyMap = { 'aaveFeiPCVDepositWrapper', 'compoundDaiPCVDepositWrapper', 'compoundEthPCVDepositWrapper', - 'creamDepositWrapper', 'wethDepositWrapper', 'agEurDepositWrapper', 'ethLidoPCVDepositWrapper', @@ -515,9 +513,6 @@ const dependencies: DependencyMap = { compoundEthPCVDepositWrapper: { contractDependencies: ['collateralizationOracle'] }, - creamDepositWrapper: { - contractDependencies: ['feiDAOTimelock', 'collateralizationOracle'] - }, wethDepositWrapper: { contractDependencies: ['feiDAOTimelock', 'collateralizationOracle'] }, diff --git a/protocol-configuration/mainnetAddresses.ts b/protocol-configuration/mainnetAddresses.ts index e7301939b..51ef7ba1b 100644 --- a/protocol-configuration/mainnetAddresses.ts +++ b/protocol-configuration/mainnetAddresses.ts @@ -519,7 +519,7 @@ const MainnetAddresses: MainnetAddresses = { creamDepositWrapper: { artifactName: 'ERC20PCVDepositWrapper', address: '0x3a1838Ac9EcA864054bebB82C32455Dd7d7Fc89c', - category: AddressCategory.PCV + category: AddressCategory.Deprecated }, ethLidoPCVDepositWrapper: { artifactName: 'PCVDepositWrapper', diff --git a/test/integration/proposals_config.ts b/test/integration/proposals_config.ts index 6fafc2699..aba5e0519 100644 --- a/test/integration/proposals_config.ts +++ b/test/integration/proposals_config.ts @@ -28,14 +28,8 @@ const proposals: ProposalsConfigMap = { totalValue: 0, // amount of ETH to send to DAO execution proposal: end_tribe_incentives, // full proposal file, imported from '@proposals/description/fip_xx.ts' proposalId: '', - affectedContractSignoff: [ - 'core', - 'tribalChief', - 'tribalCouncilTimelock', - 'creamDepositWrapper', - 'collateralizationOracle' - ], - deprecatedContractSignoff: [], + affectedContractSignoff: ['core', 'tribalChief', 'tribalCouncilTimelock', 'collateralizationOracle'], + deprecatedContractSignoff: ['creamDepositWrapper'], category: ProposalCategory.TC } }; From 333c21e93be550dae7ebd70ff044f0220a318536 Mon Sep 17 00:00:00 2001 From: thomas-waite Date: Thu, 2 Jun 2022 17:53:28 +0100 Subject: [PATCH 195/274] docs: update copy --- proposals/description/end_tribe_incentives.ts | 36 +++++++++---------- 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/proposals/description/end_tribe_incentives.ts b/proposals/description/end_tribe_incentives.ts index b28fd9c93..286ceafe8 100644 --- a/proposals/description/end_tribe_incentives.ts +++ b/proposals/description/end_tribe_incentives.ts @@ -148,21 +148,21 @@ const end_tribe_incentives: ProposalDescription = { values: '0', method: 'set(uint256,uint120,address,bool)', arguments: ['0', '0', '0x0000000000000000000000000000000000000000', false], - description: 'Set Pool 0 rewards to 0 to allow principle withdrawal and do not overwrite or change the rewarder' + description: 'Set Pool 0 rewards to 0 and do not overwrite or change the rewarder' }, { target: 'tribalChief', values: '0', method: 'set(uint256,uint120,address,bool)', arguments: ['1', '0', '0x0000000000000000000000000000000000000000', false], - description: 'Set Pool 1 rewards to 0 to allow principle withdrawal and do not overwrite or change the rewarder' + description: 'Set Pool 1 rewards to 0 and do not overwrite or change the rewarder' }, { target: 'tribalChief', values: '0', method: 'set(uint256,uint120,address,bool)', arguments: ['2', '0', '0x0000000000000000000000000000000000000000', false], - description: 'Set Pool 2 rewards to 0 to allow principle withdrawal and do not overwrite or change the rewarder' + description: 'Set Pool 2 rewards to 0 and do not overwrite or change the rewarder' }, // Note: Setting a single pool here to have an AP point != 0 @@ -171,105 +171,105 @@ const end_tribe_incentives: ProposalDescription = { values: '0', method: 'set(uint256,uint120,address,bool)', arguments: ['3', '1', '0x0000000000000000000000000000000000000000', false], - description: 'Set Pool 3 rewards to 1 to allow principle withdrawal and do not overwrite or change the rewarder' + description: 'Set Pool 3 rewards to 1 and do not overwrite or change the rewarder' }, { target: 'tribalChief', values: '0', method: 'set(uint256,uint120,address,bool)', arguments: ['4', '0', '0x0000000000000000000000000000000000000000', false], - description: 'Set Pool 4 rewards to 0 to allow principle withdrawal and do not overwrite or change the rewarder' + description: 'Set Pool 4 rewards to 0 and do not overwrite or change the rewarder' }, { target: 'tribalChief', values: '0', method: 'set(uint256,uint120,address,bool)', arguments: ['5', '0', '0x0000000000000000000000000000000000000000', false], - description: 'Set Pool 5 rewards to 0 to allow principle withdrawal and do not overwrite or change the rewarder' + description: 'Set Pool 5 rewards to 0 and do not overwrite or change the rewarder' }, { target: 'tribalChief', values: '0', method: 'set(uint256,uint120,address,bool)', arguments: ['6', '0', '0x0000000000000000000000000000000000000000', false], - description: 'Set Pool 6 rewards to 0 to allow principle withdrawal and do not overwrite or change the rewarder' + description: 'Set Pool 6 rewards to 0 and do not overwrite or change the rewarder' }, { target: 'tribalChief', values: '0', method: 'set(uint256,uint120,address,bool)', arguments: ['7', '0', '0x0000000000000000000000000000000000000000', false], - description: 'Set Pool 7 rewards to 0 to allow principle withdrawal and do not overwrite or change the rewarder' + description: 'Set Pool 7 rewards to 0 and do not overwrite or change the rewarder' }, { target: 'tribalChief', values: '0', method: 'set(uint256,uint120,address,bool)', arguments: ['8', '0', '0x0000000000000000000000000000000000000000', false], - description: 'Set Pool 8 rewards to 0 to allow principle withdrawal and do not overwrite or change the rewarder' + description: 'Set Pool 8 rewards to 0 and do not overwrite or change the rewarder' }, { target: 'tribalChief', values: '0', method: 'set(uint256,uint120,address,bool)', arguments: ['9', '0', '0x0000000000000000000000000000000000000000', false], - description: 'Set Pool 9 rewards to 0 to allow principle withdrawal and do not overwrite or change the rewarder' + description: 'Set Pool 9 rewards to 0 and do not overwrite or change the rewarder' }, { target: 'tribalChief', values: '0', method: 'set(uint256,uint120,address,bool)', arguments: ['10', '0', '0x0000000000000000000000000000000000000000', false], - description: 'Set Pool 10 rewards to 0 to allow principle withdrawal and do not overwrite or change the rewarder' + description: 'Set Pool 10 rewards to 0 and do not overwrite or change the rewarder' }, { target: 'tribalChief', values: '0', method: 'set(uint256,uint120,address,bool)', arguments: ['11', '0', '0x0000000000000000000000000000000000000000', false], - description: 'Set Pool 11 rewards to 0 to allow principle withdrawal and do not overwrite or change the rewarder' + description: 'Set Pool 11 rewards to 0 and do not overwrite or change the rewarder' }, { target: 'tribalChief', values: '0', method: 'set(uint256,uint120,address,bool)', arguments: ['12', '0', '0x0000000000000000000000000000000000000000', false], - description: 'Set Pool 12 rewards to 0 to allow principle withdrawal and do not overwrite or change the rewarder' + description: 'Set Pool 12 rewards to 0 and do not overwrite or change the rewarder' }, { target: 'tribalChief', values: '0', method: 'set(uint256,uint120,address,bool)', arguments: ['13', '0', '0x0000000000000000000000000000000000000000', false], - description: 'Set Pool 13 rewards to 0 to allow principle withdrawal and do not overwrite or change the rewarder' + description: 'Set Pool 13 rewards to 0 and do not overwrite or change the rewarder' }, { target: 'tribalChief', values: '0', method: 'set(uint256,uint120,address,bool)', arguments: ['14', '0', '0x0000000000000000000000000000000000000000', false], - description: 'Set Pool 14 rewards to 0 to allow principle withdrawal and do not overwrite or change the rewarder' + description: 'Set Pool 14 rewards to 0 and do not overwrite or change the rewarder' }, { target: 'tribalChief', values: '0', method: 'set(uint256,uint120,address,bool)', arguments: ['15', '0', '0x0000000000000000000000000000000000000000', false], - description: 'Set Pool 15 rewards to 0 to allow principle withdrawal and do not overwrite or change the rewarder' + description: 'Set Pool 15 rewards to 0 and do not overwrite or change the rewarder' }, { target: 'tribalChief', values: '0', method: 'set(uint256,uint120,address,bool)', arguments: ['16', '0', '0x0000000000000000000000000000000000000000', false], - description: 'Set Pool 16 rewards to 0 to allow principle withdrawal and do not overwrite or change the rewarder' + description: 'Set Pool 16 rewards to 0 and do not overwrite or change the rewarder' }, { target: 'tribalChief', values: '0', method: 'set(uint256,uint120,address,bool)', arguments: ['17', '0', '0x0000000000000000000000000000000000000000', false], - description: 'Set Pool 17 rewards to 0 to allow principle withdrawal and do not overwrite or change the rewarder' + description: 'Set Pool 17 rewards to 0 and do not overwrite or change the rewarder' }, //// Set block rewards to effectively 0 From c806ca6917f58fcd9576301e9f86316dd0f092e1 Mon Sep 17 00:00:00 2001 From: thomas-waite Date: Thu, 2 Jun 2022 18:41:52 +0100 Subject: [PATCH 196/274] refactor: remove unlock calls --- proposals/dao/end_tribe_incentives.ts | 4 +- proposals/description/end_tribe_incentives.ts | 129 ------------------ 2 files changed, 1 insertion(+), 132 deletions(-) diff --git a/proposals/dao/end_tribe_incentives.ts b/proposals/dao/end_tribe_incentives.ts index 91e57cef0..3b1e2b470 100644 --- a/proposals/dao/end_tribe_incentives.ts +++ b/proposals/dao/end_tribe_incentives.ts @@ -19,7 +19,6 @@ TIP-109: Discontinue Tribe Incentives Ends all Tribe Incentives being distributed. Specifically: -- Unlock all pools to release principle - Set AP rewards of all pools to 0, and set one pool AP reward to 1 - Effectively set Tribe block reward to 0 - Remove CREAM deposit from CR @@ -71,11 +70,10 @@ const validate: ValidateUpgradeFunc = async (addresses, oldContracts, contracts, const numPools = await tribalChief.numPools(); expect(numPools).to.equal(poolIds.length); - // 3. Validate that all pools are unlocked, rewarders are set to 0 and AP points are set to zero, apart from Fei-Rari + // 3. Validate that all pool AP points are set to zero, apart from Fei-Rari const feiRariPoolId = '3'; for (const pid in poolIds) { const poolInfo = await tribalChief.poolInfo(pid); - expect(poolInfo.unlocked).to.equal(true); if (pid == feiRariPoolId) { expect(poolInfo.allocPoint).to.be.equal(NEW_TOTAL_ALLOC_POINTS.toString()); diff --git a/proposals/description/end_tribe_incentives.ts b/proposals/description/end_tribe_incentives.ts index 286ceafe8..41c1ac06c 100644 --- a/proposals/description/end_tribe_incentives.ts +++ b/proposals/description/end_tribe_incentives.ts @@ -14,134 +14,6 @@ const end_tribe_incentives: ProposalDescription = { }, ///////////// Replicate onlyGovernor behaviour or resetRewards() - //// Unlock pools all pools to allow principle withdrawal - { - target: 'tribalChief', - values: '0', - method: 'unlockPool(uint256)', - arguments: ['0'], - description: 'Unlock pool 0' - }, - { - target: 'tribalChief', - values: '0', - method: 'unlockPool(uint256)', - arguments: ['1'], - description: 'Unlock pool 1' - }, - { - target: 'tribalChief', - values: '0', - method: 'unlockPool(uint256)', - arguments: ['2'], - description: 'Unlock pool 2' - }, - { - target: 'tribalChief', - values: '0', - method: 'unlockPool(uint256)', - arguments: ['3'], - description: 'Unlock pool 3' - }, - { - target: 'tribalChief', - values: '0', - method: 'unlockPool(uint256)', - arguments: ['4'], - description: 'Unlock pool 4' - }, - { - target: 'tribalChief', - values: '0', - method: 'unlockPool(uint256)', - arguments: ['5'], - description: 'Unlock pool 5' - }, - { - target: 'tribalChief', - values: '0', - method: 'unlockPool(uint256)', - arguments: ['6'], - description: 'Unlock pool 6' - }, - { - target: 'tribalChief', - values: '0', - method: 'unlockPool(uint256)', - arguments: ['7'], - description: 'Unlock pool 7' - }, - { - target: 'tribalChief', - values: '0', - method: 'unlockPool(uint256)', - arguments: ['8'], - description: 'Unlock pool 8' - }, - { - target: 'tribalChief', - values: '0', - method: 'unlockPool(uint256)', - arguments: ['9'], - description: 'Unlock pool 9' - }, - { - target: 'tribalChief', - values: '0', - method: 'unlockPool(uint256)', - arguments: ['10'], - description: 'Unlock pool 10' - }, - { - target: 'tribalChief', - values: '0', - method: 'unlockPool(uint256)', - arguments: ['11'], - description: 'Unlock pool 11' - }, - { - target: 'tribalChief', - values: '0', - method: 'unlockPool(uint256)', - arguments: ['12'], - description: 'Unlock pool 12' - }, - { - target: 'tribalChief', - values: '0', - method: 'unlockPool(uint256)', - arguments: ['13'], - description: 'Unlock pool 13' - }, - { - target: 'tribalChief', - values: '0', - method: 'unlockPool(uint256)', - arguments: ['14'], - description: 'Unlock pool 14' - }, - { - target: 'tribalChief', - values: '0', - method: 'unlockPool(uint256)', - arguments: ['15'], - description: 'Unlock pool 15' - }, - { - target: 'tribalChief', - values: '0', - method: 'unlockPool(uint256)', - arguments: ['16'], - description: 'Unlock pool 16' - }, - { - target: 'tribalChief', - values: '0', - method: 'unlockPool(uint256)', - arguments: ['17'], - description: 'Unlock pool 17' - }, - //////// Set Pool allocation points to 0. This also updates reward variables { target: 'tribalChief', @@ -294,7 +166,6 @@ const end_tribe_incentives: ProposalDescription = { TIP-109: Discontinue Tribe Incentives This proposal will disable all Tribe incentives. Specifically it: - - Unlocks all pools to allow principle to be withdrawn - Sets the allocation points of all pools effectively to 0 - Updates the reward variables of incentivised pools - Sets the amount of Tribe issued per block by the Tribal Chief to effectively zero From 1f91eacd5a8d9035845bd5fa221218109bf7ba6b Mon Sep 17 00:00:00 2001 From: thomas-waite Date: Thu, 2 Jun 2022 19:05:10 +0100 Subject: [PATCH 197/274] refactor: update TribalChief config --- protocol-configuration/tribalchief.ts | 34 +++++++++++++-------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/protocol-configuration/tribalchief.ts b/protocol-configuration/tribalchief.ts index fb904e278..20aba1491 100644 --- a/protocol-configuration/tribalchief.ts +++ b/protocol-configuration/tribalchief.ts @@ -1,24 +1,24 @@ import { TribalChiefConfig } from '../types/types'; const config: TribalChiefConfig = { - feiTribePair: { allocPoint: 0, unlocked: true }, // Uniswap-v2 FEI/TRIBE LP, 0 (poolId) - curve3Metapool: { allocPoint: 0, unlocked: true }, // Curve 3crv-FEI metapool LP, 1 + feiTribePair: { allocPoint: 0, unlocked: false }, // Uniswap-v2 FEI/TRIBE LP, 0 (poolId) + curve3Metapool: { allocPoint: 0, unlocked: false }, // Curve 3crv-FEI metapool LP, 1 gUniFeiDaiLP: { allocPoint: 0, unlocked: true }, // G-UNI DAI/FEI 0.05% fee tier, 2 - stakingTokenWrapperRari: { allocPoint: 1, unlocked: true }, // FeiRari: TRIBE, 3 - stakingTokenWrapperGROLaaS: { allocPoint: 0, unlocked: true }, // LaaS: GRO, 4 - stakingTokenWrapperFOXLaaS: { allocPoint: 0, unlocked: true }, // LaaS: FOX, 5 - stakingTokenWrapperUMALaaS: { allocPoint: 0, unlocked: true }, // LaaS: UMA, 6 - stakingTokenWrapperSYNLaaS: { allocPoint: 0, unlocked: true }, // LaaS: SYN, 7 - stakingTokenWrapperNEARLaaS: { allocPoint: 0, unlocked: true }, // LaaS: NEAR, 8 - stakingTokenWrapperKYLINLaaS: { allocPoint: 0, unlocked: true }, // LaaS: KYLIN, 9 - stakingTokenWrapperMStableLaaS: { allocPoint: 0, unlocked: true }, // LaaS: MStable, 10 - stakingTokenWrapperPoolTogetherLaaS: { allocPoint: 0, unlocked: true }, // LaaS: PoolTogether, 11 - stakingTokenWrapperBribeD3pool: { allocPoint: 0, unlocked: true }, // Votium bribes: d3pool, 12 - d3StakingTokenWrapper: { allocPoint: 0, unlocked: true }, // FeiRari: d3pool LP, 13 - fei3CrvStakingtokenWrapper: { allocPoint: 0, unlocked: true }, // FeiRari: 3crv-FEI metapool LP, 14 - feiDaiStakingTokenWrapper: { allocPoint: 0, unlocked: true }, // FeiRari: G-UNI DAI/FEI 0.05% fee tier, 15 - feiUsdcStakingTokenWrapper: { allocPoint: 0, unlocked: true }, // FeiRari: G-UNI USDC/FEI 0.01% fee tier, 16 - stakingTokenWrapperBribe3Crvpool: { allocPoint: 0, unlocked: true } // Votium bribes: 3crv-FEI metapool, 17 + stakingTokenWrapperRari: { allocPoint: 1, unlocked: false }, // FeiRari: TRIBE, 3 + stakingTokenWrapperGROLaaS: { allocPoint: 0, unlocked: false }, // LaaS: GRO, 4 + stakingTokenWrapperFOXLaaS: { allocPoint: 0, unlocked: false }, // LaaS: FOX, 5 + stakingTokenWrapperUMALaaS: { allocPoint: 0, unlocked: false }, // LaaS: UMA, 6 + stakingTokenWrapperSYNLaaS: { allocPoint: 0, unlocked: false }, // LaaS: SYN, 7 + stakingTokenWrapperNEARLaaS: { allocPoint: 0, unlocked: false }, // LaaS: NEAR, 8 + stakingTokenWrapperKYLINLaaS: { allocPoint: 0, unlocked: false }, // LaaS: KYLIN, 9 + stakingTokenWrapperMStableLaaS: { allocPoint: 0, unlocked: false }, // LaaS: MStable, 10 + stakingTokenWrapperPoolTogetherLaaS: { allocPoint: 0, unlocked: false }, // LaaS: PoolTogether, 11 + stakingTokenWrapperBribeD3pool: { allocPoint: 0, unlocked: false }, // Votium bribes: d3pool, 12 + d3StakingTokenWrapper: { allocPoint: 0, unlocked: false }, // FeiRari: d3pool LP, 13 + fei3CrvStakingtokenWrapper: { allocPoint: 0, unlocked: false }, // FeiRari: 3crv-FEI metapool LP, 14 + feiDaiStakingTokenWrapper: { allocPoint: 0, unlocked: false }, // FeiRari: G-UNI DAI/FEI 0.05% fee tier, 15 + feiUsdcStakingTokenWrapper: { allocPoint: 0, unlocked: false }, // FeiRari: G-UNI USDC/FEI 0.01% fee tier, 16 + stakingTokenWrapperBribe3Crvpool: { allocPoint: 0, unlocked: false } // Votium bribes: 3crv-FEI metapool, 17 }; export default config; From 6d6fa06deac57be416696022c6286e685e110765 Mon Sep 17 00:00:00 2001 From: thomas-waite Date: Thu, 2 Jun 2022 23:38:02 +0100 Subject: [PATCH 198/274] refactor: revoke roles from incentives system --- proposals/dao/end_tribe_incentives.ts | 8 +++++- proposals/description/end_tribe_incentives.ts | 26 +++++++++++++++++-- protocol-configuration/permissions.ts | 4 +-- protocol-configuration/tribalchief.ts | 4 +-- 4 files changed, 35 insertions(+), 7 deletions(-) diff --git a/proposals/dao/end_tribe_incentives.ts b/proposals/dao/end_tribe_incentives.ts index 3b1e2b470..354fefa81 100644 --- a/proposals/dao/end_tribe_incentives.ts +++ b/proposals/dao/end_tribe_incentives.ts @@ -62,6 +62,12 @@ const validate: ValidateUpgradeFunc = async (addresses, oldContracts, contracts, await contracts.core.hasRole(ethers.utils.id('TRIBAL_CHIEF_ADMIN_ROLE'), addresses.tribalCouncilTimelock) ).to.equal(true); + expect( + await contracts.core.hasRole(ethers.utils.id('TRIBAL_CHIEF_ADMIN_ROLE'), addresses.tribalChiefSyncV2) + ).to.equal(false); + + expect(await contracts.core.hasRole(ethers.utils.id('FUSE_ADMIN'), addresses.tribalChiefSyncV2)).to.equal(false); + // 1. Verify TribalChief block rewards are effectively 0 expect(await tribalChief.tribePerBlock()).to.equal(NEW_TRIBE_BLOCK_REWARD); @@ -71,7 +77,7 @@ const validate: ValidateUpgradeFunc = async (addresses, oldContracts, contracts, expect(numPools).to.equal(poolIds.length); // 3. Validate that all pool AP points are set to zero, apart from Fei-Rari - const feiRariPoolId = '3'; + const feiRariPoolId = '0'; for (const pid in poolIds) { const poolInfo = await tribalChief.poolInfo(pid); diff --git a/proposals/description/end_tribe_incentives.ts b/proposals/description/end_tribe_incentives.ts index 41c1ac06c..166e83e12 100644 --- a/proposals/description/end_tribe_incentives.ts +++ b/proposals/description/end_tribe_incentives.ts @@ -19,7 +19,7 @@ const end_tribe_incentives: ProposalDescription = { target: 'tribalChief', values: '0', method: 'set(uint256,uint120,address,bool)', - arguments: ['0', '0', '0x0000000000000000000000000000000000000000', false], + arguments: ['0', '1', '0x0000000000000000000000000000000000000000', false], description: 'Set Pool 0 rewards to 0 and do not overwrite or change the rewarder' }, { @@ -42,7 +42,7 @@ const end_tribe_incentives: ProposalDescription = { target: 'tribalChief', values: '0', method: 'set(uint256,uint120,address,bool)', - arguments: ['3', '1', '0x0000000000000000000000000000000000000000', false], + arguments: ['3', '0', '0x0000000000000000000000000000000000000000', false], description: 'Set Pool 3 rewards to 1 and do not overwrite or change the rewarder' }, { @@ -153,6 +153,28 @@ const end_tribe_incentives: ProposalDescription = { description: 'Set Tribal Chief block reward effectively to zero. Setting to 100000' }, + ///// Deprecate roles of Incentives system + { + target: 'core', + values: '0', + method: 'revokeRole(bytes32,address)', + arguments: [ + '0x7f85477db6c0857f19179a2b3846a7ddbc64caeeb3a02ef34771b82f5ab926e4', // FUSE_ADMIN + '{tribalChiefSyncV2}' + ], + description: 'Revoke FUSE_ADMIN from tribalChiefSyncV2' + }, + { + target: 'core', + values: '0', + method: 'revokeRole(bytes32,address)', + arguments: [ + '0x23970cab3799b6876df4319661e6c03cc45bd59628799d92e988dd8cbdc90e31', // TRIBAL_CHIEF_ADMIN_ROLE + '{tribalChiefSyncV2}' + ], + description: 'Revoke TRIBAL_CHIEF_ADMIN_ROLE from tribalChiefSyncV2' + }, + ////// Remove CREAM from CR { target: 'collateralizationOracle', diff --git a/protocol-configuration/permissions.ts b/protocol-configuration/permissions.ts index 3dcf1755f..ad270aa16 100644 --- a/protocol-configuration/permissions.ts +++ b/protocol-configuration/permissions.ts @@ -36,8 +36,8 @@ export const permissions = { RATE_LIMITED_MINTER_ADMIN: [], PARAMETER_ADMIN: [], PSM_ADMIN_ROLE: ['tribalCouncilTimelock'], - TRIBAL_CHIEF_ADMIN_ROLE: ['optimisticTimelock', 'tribalChiefSyncV2', 'tribalCouncilTimelock'], - FUSE_ADMIN: ['optimisticTimelock', 'tribalChiefSyncV2', 'tribalCouncilTimelock'], + TRIBAL_CHIEF_ADMIN_ROLE: ['optimisticTimelock', 'tribalCouncilTimelock'], + FUSE_ADMIN: ['optimisticTimelock', 'tribalCouncilTimelock'], VOTIUM_ADMIN_ROLE: ['opsOptimisticTimelock'], PCV_GUARDIAN_ADMIN_ROLE: ['optimisticTimelock', 'tribalCouncilTimelock'], PCV_SAFE_MOVER_ROLE: ['tribalCouncilTimelock'], diff --git a/protocol-configuration/tribalchief.ts b/protocol-configuration/tribalchief.ts index 20aba1491..763ad0cc3 100644 --- a/protocol-configuration/tribalchief.ts +++ b/protocol-configuration/tribalchief.ts @@ -1,10 +1,10 @@ import { TribalChiefConfig } from '../types/types'; const config: TribalChiefConfig = { - feiTribePair: { allocPoint: 0, unlocked: false }, // Uniswap-v2 FEI/TRIBE LP, 0 (poolId) + feiTribePair: { allocPoint: 1, unlocked: false }, // Uniswap-v2 FEI/TRIBE LP, 0 (poolId) curve3Metapool: { allocPoint: 0, unlocked: false }, // Curve 3crv-FEI metapool LP, 1 gUniFeiDaiLP: { allocPoint: 0, unlocked: true }, // G-UNI DAI/FEI 0.05% fee tier, 2 - stakingTokenWrapperRari: { allocPoint: 1, unlocked: false }, // FeiRari: TRIBE, 3 + stakingTokenWrapperRari: { allocPoint: 0, unlocked: false }, // FeiRari: TRIBE, 3 stakingTokenWrapperGROLaaS: { allocPoint: 0, unlocked: false }, // LaaS: GRO, 4 stakingTokenWrapperFOXLaaS: { allocPoint: 0, unlocked: false }, // LaaS: FOX, 5 stakingTokenWrapperUMALaaS: { allocPoint: 0, unlocked: false }, // LaaS: UMA, 6 From dcddfb7d8ac78beb263080778fa0badcb957462b Mon Sep 17 00:00:00 2001 From: thomas-waite Date: Fri, 3 Jun 2022 00:38:30 +0100 Subject: [PATCH 199/274] feat: dismantle internal ACL reward admin --- proposals/dao/end_tribe_incentives.ts | 41 ++++++++++++- proposals/description/end_tribe_incentives.ts | 61 +++++++++++++++++++ test/integration/proposals_config.ts | 9 ++- 3 files changed, 108 insertions(+), 3 deletions(-) diff --git a/proposals/dao/end_tribe_incentives.ts b/proposals/dao/end_tribe_incentives.ts index 354fefa81..bd704cc8c 100644 --- a/proposals/dao/end_tribe_incentives.ts +++ b/proposals/dao/end_tribe_incentives.ts @@ -1,4 +1,4 @@ -import hre, { ethers, artifacts } from 'hardhat'; +import hre, { ethers } from 'hardhat'; import { expect } from 'chai'; import { DeployUpgradeFunc, @@ -76,7 +76,7 @@ const validate: ValidateUpgradeFunc = async (addresses, oldContracts, contracts, const numPools = await tribalChief.numPools(); expect(numPools).to.equal(poolIds.length); - // 3. Validate that all pool AP points are set to zero, apart from Fei-Rari + // 3. Validate that all pool AP points are set to zero, apart from Fei-Tribe Uniswap V2 const feiRariPoolId = '0'; for (const pid in poolIds) { const poolInfo = await tribalChief.poolInfo(pid); @@ -88,6 +88,43 @@ const validate: ValidateUpgradeFunc = async (addresses, oldContracts, contracts, } } + // 4. Verify rewardsDistributorAdmin internal ACL revoked + const rewardsDistributorAdmin = contracts.rewardsDistributorAdmin; + expect( + await rewardsDistributorAdmin.hasRole( + ethers.utils.id('AUTO_REWARDS_DISTRIBUTOR_ROLE'), + addresses.feiDaiAutoRewardsDistributor + ) + ).to.equal(false); + + expect( + await rewardsDistributorAdmin.hasRole( + ethers.utils.id('AUTO_REWARDS_DISTRIBUTOR_ROLE'), + addresses.feiUsdcAutoRewardsDistributor + ) + ).to.equal(false); + + expect( + await rewardsDistributorAdmin.hasRole( + ethers.utils.id('AUTO_REWARDS_DISTRIBUTOR_ROLE'), + addresses.autoRewardsDistributor + ) + ).to.equal(false); + + expect( + await rewardsDistributorAdmin.hasRole( + ethers.utils.id('AUTO_REWARDS_DISTRIBUTOR_ROLE'), + addresses.d3AutoRewardsDistributor + ) + ).to.equal(false); + + expect( + await rewardsDistributorAdmin.hasRole( + ethers.utils.id('AUTO_REWARDS_DISTRIBUTOR_ROLE'), + addresses.fei3CrvAutoRewardsDistributor + ) + ).to.equal(false); + // 4. Verify total AP points is 1 expect(await tribalChief.totalAllocPoint()).to.be.equal(NEW_TOTAL_ALLOC_POINTS.toString()); diff --git a/proposals/description/end_tribe_incentives.ts b/proposals/description/end_tribe_incentives.ts index 166e83e12..ef054daf3 100644 --- a/proposals/description/end_tribe_incentives.ts +++ b/proposals/description/end_tribe_incentives.ts @@ -175,6 +175,67 @@ const end_tribe_incentives: ProposalDescription = { description: 'Revoke TRIBAL_CHIEF_ADMIN_ROLE from tribalChiefSyncV2' }, + // Deprecate RewardDistributorAdmin internal roles + { + target: 'rewardsDistributorAdmin', + values: '0', + method: 'becomeAdmin()', + arguments: [], + description: + 'Grant the TC timelock the DEFAULT_ADMIN_ROLE, to it can dismantle the RewardDistributorAdmin permissions' + // TODO: Maybe clear this up after? + }, + { + target: 'rewardsDistributorAdmin', + values: '0', + method: 'revokeRole(bytes32,address)', + arguments: [ + '0x19cca239eaee0f28c6ba4c8c860332b8a23b35008b89b0507b96138ca5691cbb', // AUTO_REWARDS_DISTRIBUTOR_ROLE + '{feiDaiAutoRewardsDistributor}' + ], + description: 'Revoke AUTO_REWARDS_DISTRIBUTOR_ROLE from feiDaiAutoRewardsDistributor' + }, + { + target: 'rewardsDistributorAdmin', + values: '0', + method: 'revokeRole(bytes32,address)', + arguments: [ + '0x19cca239eaee0f28c6ba4c8c860332b8a23b35008b89b0507b96138ca5691cbb', // AUTO_REWARDS_DISTRIBUTOR_ROLE + '{feiUsdcAutoRewardsDistributor}' + ], + description: 'Revoke AUTO_REWARDS_DISTRIBUTOR_ROLE from feiUsdcAutoRewardsDistributor' + }, + { + target: 'rewardsDistributorAdmin', + values: '0', + method: 'revokeRole(bytes32,address)', + arguments: [ + '0x19cca239eaee0f28c6ba4c8c860332b8a23b35008b89b0507b96138ca5691cbb', // AUTO_REWARDS_DISTRIBUTOR_ROLE + '{autoRewardsDistributor}' + ], + description: 'Revoke AUTO_REWARDS_DISTRIBUTOR_ROLE from autoRewardsDistributor' + }, + { + target: 'rewardsDistributorAdmin', + values: '0', + method: 'revokeRole(bytes32,address)', + arguments: [ + '0x19cca239eaee0f28c6ba4c8c860332b8a23b35008b89b0507b96138ca5691cbb', // AUTO_REWARDS_DISTRIBUTOR_ROLE + '{d3AutoRewardsDistributor}' + ], + description: 'Revoke AUTO_REWARDS_DISTRIBUTOR_ROLE from d3AutoRewardsDistributor' + }, + { + target: 'rewardsDistributorAdmin', + values: '0', + method: 'revokeRole(bytes32,address)', + arguments: [ + '0x19cca239eaee0f28c6ba4c8c860332b8a23b35008b89b0507b96138ca5691cbb', // AUTO_REWARDS_DISTRIBUTOR_ROLE + '{fei3CrvAutoRewardsDistributor}' + ], + description: 'Revoke AUTO_REWARDS_DISTRIBUTOR_ROLE from fei3CrvAutoRewardsDistributor' + }, + ////// Remove CREAM from CR { target: 'collateralizationOracle', diff --git a/test/integration/proposals_config.ts b/test/integration/proposals_config.ts index aba5e0519..bdcb2d8e8 100644 --- a/test/integration/proposals_config.ts +++ b/test/integration/proposals_config.ts @@ -29,7 +29,14 @@ const proposals: ProposalsConfigMap = { proposal: end_tribe_incentives, // full proposal file, imported from '@proposals/description/fip_xx.ts' proposalId: '', affectedContractSignoff: ['core', 'tribalChief', 'tribalCouncilTimelock', 'collateralizationOracle'], - deprecatedContractSignoff: ['creamDepositWrapper'], + deprecatedContractSignoff: [ + 'creamDepositWrapper', + 'fei3CrvAutoRewardsDistributor', + 'd3AutoRewardsDistributor', + 'autoRewardsDistributor', + 'feiDaiAutoRewardsDistributor', + 'feiUsdcAutoRewardsDistributor' + ], category: ProposalCategory.TC } }; From 0a7aff5debfca47d6e9ecfc77338680624bb961a Mon Sep 17 00:00:00 2001 From: thomas-waite Date: Fri, 3 Jun 2022 00:39:48 +0100 Subject: [PATCH 200/274] feat: sync all reward distributors --- proposals/description/end_tribe_incentives.ts | 36 +++++++++++ protocol-configuration/dependencies.ts | 61 +++---------------- protocol-configuration/mainnetAddresses.ts | 10 +-- 3 files changed, 50 insertions(+), 57 deletions(-) diff --git a/proposals/description/end_tribe_incentives.ts b/proposals/description/end_tribe_incentives.ts index ef054daf3..9496ac0b5 100644 --- a/proposals/description/end_tribe_incentives.ts +++ b/proposals/description/end_tribe_incentives.ts @@ -153,6 +153,42 @@ const end_tribe_incentives: ProposalDescription = { description: 'Set Tribal Chief block reward effectively to zero. Setting to 100000' }, + //// Sync new reward speeds on all AutoRewardDistributors + { + target: 'autoRewardsDistributor', + values: '0', + method: 'setAutoRewardsDistribution()', + arguments: [], + description: 'Sync the reward speed of the AutoRewardsDistributor' + }, + { + target: 'd3AutoRewardsDistributor', + values: '0', + method: 'setAutoRewardsDistribution()', + arguments: [], + description: 'Sync the reward speed of the d3AutoRewardsDistributor' + }, + { + target: 'fei3CrvAutoRewardsDistributor', + values: '0', + method: 'setAutoRewardsDistribution()', + arguments: [], + description: 'Sync the reward speed of the fei3CrvAutoRewardsDistributor' + }, + { + target: 'feiDaiAutoRewardsDistributor', + values: '0', + method: 'setAutoRewardsDistribution()', + arguments: [], + description: 'Sync the reward speed of the feiDaiAutoRewardsDistributor' + }, + { + target: 'feiUsdcAutoRewardsDistributor', + values: '0', + method: 'setAutoRewardsDistribution()', + arguments: [], + description: 'Sync the reward speed of the feiUsdcAutoRewardsDistributor' + }, ///// Deprecate roles of Incentives system { target: 'core', diff --git a/protocol-configuration/dependencies.ts b/protocol-configuration/dependencies.ts index 82efbe7c6..546b27c2d 100644 --- a/protocol-configuration/dependencies.ts +++ b/protocol-configuration/dependencies.ts @@ -114,7 +114,6 @@ const dependencies: DependencyMap = { 'tribeUsdCompositeOracle', 'zeroConstantOracle', 'collateralizationOracleKeeper', - 'autoRewardsDistributor', 'erc20Dripper', 'tribalChief', 'fuseAdmin', @@ -657,9 +656,6 @@ const dependencies: DependencyMap = { aaveTribeIncentivesControllerImpl: { contractDependencies: ['aaveTribeIncentivesController'] }, - autoRewardsDistributor: { - contractDependencies: ['core', 'rewardsDistributorAdmin', 'tribalChiefSyncV2', 'tribalChief', 'rariPool8Tribe'] - }, erc20Dripper: { contractDependencies: ['core', 'tribe', 'tribalChief', 'tribeMinter'] }, @@ -685,40 +681,20 @@ const dependencies: DependencyMap = { 'feiUsdcStakingTokenWrapper' ] }, - fei3CrvAutoRewardsDistributor: { - contractDependencies: ['fei3CrvStakingtokenWrapper', 'tribalChief', 'rewardsDistributorAdmin', 'rariPool8Fei3Crv'] - }, - d3AutoRewardsDistributor: { - contractDependencies: ['d3StakingTokenWrapper', 'tribalChief', 'rewardsDistributorAdmin', 'rariPool8d3'] - }, - feiDaiAutoRewardsDistributor: { - contractDependencies: ['feiDaiStakingTokenWrapper', 'tribalChief', 'rewardsDistributorAdmin'] - }, - feiUsdcAutoRewardsDistributor: { - contractDependencies: ['feiUsdcStakingTokenWrapper', 'tribalChief', 'rewardsDistributorAdmin'] - }, fei3CrvStakingtokenWrapper: { - contractDependencies: ['fei3CrvAutoRewardsDistributor', 'tribalChief', 'rariRewardsDistributorDelegator'] + contractDependencies: ['tribalChief', 'rariRewardsDistributorDelegator'] }, feiDaiStakingTokenWrapper: { - contractDependencies: ['feiDaiAutoRewardsDistributor', 'tribalChief', 'rariRewardsDistributorDelegator'] + contractDependencies: ['tribalChief', 'rariRewardsDistributorDelegator'] }, feiUsdcStakingTokenWrapper: { - contractDependencies: ['feiUsdcAutoRewardsDistributor', 'tribalChief', 'rariRewardsDistributorDelegator'] + contractDependencies: ['tribalChief', 'rariRewardsDistributorDelegator'] }, d3StakingTokenWrapper: { - contractDependencies: ['d3AutoRewardsDistributor', 'tribalChief', 'rariRewardsDistributorDelegator'] + contractDependencies: ['tribalChief', 'rariRewardsDistributorDelegator'] }, rewardsDistributorAdmin: { - contractDependencies: [ - 'rariRewardsDistributorDelegator', - 'optimisticTimelock', - 'autoRewardsDistributor', // rewards dripper role - 'fei3CrvAutoRewardsDistributor', - 'd3AutoRewardsDistributor', - 'feiDaiAutoRewardsDistributor', - 'feiUsdcAutoRewardsDistributor' - ] + contractDependencies: ['rariRewardsDistributorDelegator', 'optimisticTimelock'] }, stwBulkHarvest: { contractDependencies: [ @@ -767,7 +743,6 @@ const dependencies: DependencyMap = { tribalChief: { contractDependencies: [ 'core', - 'autoRewardsDistributor', 'tribalChiefSyncV2', 'optimisticTimelock', 'erc20Dripper', @@ -783,14 +758,10 @@ const dependencies: DependencyMap = { 'stakingTokenWrapperUMALaaS', 'tribalChiefImpl', 'proxyAdmin', - 'fei3CrvAutoRewardsDistributor', - 'd3AutoRewardsDistributor', 'fei3CrvStakingtokenWrapper', 'd3StakingTokenWrapper', 'feiDaiStakingTokenWrapper', - 'feiUsdcStakingTokenWrapper', - 'feiDaiAutoRewardsDistributor', - 'feiUsdcAutoRewardsDistributor' + 'feiUsdcStakingTokenWrapper' ] }, tribalChiefImpl: { @@ -798,7 +769,6 @@ const dependencies: DependencyMap = { }, tribalChiefSyncV2: { contractDependencies: [ - 'autoRewardsDistributor', // triggers autoRewardsDistributor after updates 'optimisticTimelock', // executes atomic updates 'tribalChief' // mass updates pools ] @@ -862,30 +832,17 @@ const dependencies: DependencyMap = { contractDependencies: ['rariPool8Fei3Crv', 'rariPool8d3'] }, rariPool8Fei3Crv: { - contractDependencies: [ - 'rariPool8CTokenImpl', - 'tribe', - 'rariPool8Comptroller', - 'rariRewardsDistributorDelegator', - 'fei3CrvAutoRewardsDistributor' - ] + contractDependencies: ['rariPool8CTokenImpl', 'tribe', 'rariPool8Comptroller', 'rariRewardsDistributorDelegator'] }, rariPool8d3: { - contractDependencies: [ - 'rariPool8CTokenImpl', - 'tribe', - 'rariPool8Comptroller', - 'rariRewardsDistributorDelegator', - 'd3AutoRewardsDistributor' - ] + contractDependencies: ['rariPool8CTokenImpl', 'tribe', 'rariPool8Comptroller', 'rariRewardsDistributorDelegator'] }, rariPool8Tribe: { contractDependencies: [ 'tribe', 'rariPool8Comptroller', 'rariPool8TribeIrm', - 'rariRewardsDistributorDelegator', // Drips TRIBE rewards - 'autoRewardsDistributor' + 'rariRewardsDistributorDelegator' // Drips TRIBE rewards ] }, rariPool8TribeIrm: { diff --git a/protocol-configuration/mainnetAddresses.ts b/protocol-configuration/mainnetAddresses.ts index 51ef7ba1b..0b7e0c021 100644 --- a/protocol-configuration/mainnetAddresses.ts +++ b/protocol-configuration/mainnetAddresses.ts @@ -819,17 +819,17 @@ const MainnetAddresses: MainnetAddresses = { autoRewardsDistributor: { artifactName: 'AutoRewardsDistributor', address: '0x61be49dfbd869a601fea076e1a1379903e61a895', - category: AddressCategory.Rewards + category: AddressCategory.Deprecated }, d3AutoRewardsDistributor: { artifactName: 'AutoRewardsDistributorV2', address: '0x9Fd318C3F8f8583Fd40a0C2fba058fB7097E11d4', - category: AddressCategory.Rewards + category: AddressCategory.Deprecated }, fei3CrvAutoRewardsDistributor: { artifactName: 'AutoRewardsDistributorV2', address: '0x15f6D0d95aceCD7570e8Ff6128D953BC6aA3573C', - category: AddressCategory.Rewards + category: AddressCategory.Deprecated }, erc20Dripper: { artifactName: 'ERC20Dripper', @@ -919,12 +919,12 @@ const MainnetAddresses: MainnetAddresses = { feiDaiAutoRewardsDistributor: { artifactName: 'AutoRewardsDistributorV2', address: '0xE6Fef62A834D9b0BA1Da832769D6E99135dD2E0e', - category: AddressCategory.Rewards + category: AddressCategory.Deprecated }, feiUsdcAutoRewardsDistributor: { artifactName: 'AutoRewardsDistributorV2', address: '0x1126f1fA7Da556F8F82846223E3C2176B5631707', - category: AddressCategory.Rewards + category: AddressCategory.Deprecated }, d3StakingTokenWrapper: { artifactName: 'StakingTokenWrapper', From 7b83a03af031a3bd690de8eb3a1d4575827ada50 Mon Sep 17 00:00:00 2001 From: thomas-waite Date: Fri, 3 Jun 2022 01:17:32 +0100 Subject: [PATCH 201/274] deps: deprecate various contracts --- proposals/description/end_tribe_incentives.ts | 1 - protocol-configuration/dependencies.ts | 80 +------------------ protocol-configuration/mainnetAddresses.ts | 33 ++++---- test/integration/proposals_config.ts | 26 +++++- 4 files changed, 44 insertions(+), 96 deletions(-) diff --git a/proposals/description/end_tribe_incentives.ts b/proposals/description/end_tribe_incentives.ts index 9496ac0b5..b8d283906 100644 --- a/proposals/description/end_tribe_incentives.ts +++ b/proposals/description/end_tribe_incentives.ts @@ -219,7 +219,6 @@ const end_tribe_incentives: ProposalDescription = { arguments: [], description: 'Grant the TC timelock the DEFAULT_ADMIN_ROLE, to it can dismantle the RewardDistributorAdmin permissions' - // TODO: Maybe clear this up after? }, { target: 'rewardsDistributorAdmin', diff --git a/protocol-configuration/dependencies.ts b/protocol-configuration/dependencies.ts index 546b27c2d..605ddca68 100644 --- a/protocol-configuration/dependencies.ts +++ b/protocol-configuration/dependencies.ts @@ -269,7 +269,6 @@ const dependencies: DependencyMap = { optimisticTimelock: { contractDependencies: [ 'core', - 'rewardsDistributorAdmin', 'tribalChiefSyncV2', 'rariPool8Comptroller', 'optimisticMultisig', @@ -671,97 +670,24 @@ const dependencies: DependencyMap = { contractDependencies: [ 'rariPool8Tribe', 'rariRewardsDistributorDelegate', // impl - 'rewardsDistributorAdmin', //admin 'rariPool8Comptroller', - 'fei3CrvStakingtokenWrapper', 'd3StakingTokenWrapper', 'rariPool8Fei3Crv', - 'rariPool8d3', - 'feiDaiStakingTokenWrapper', - 'feiUsdcStakingTokenWrapper' + 'rariPool8d3' ] }, - fei3CrvStakingtokenWrapper: { - contractDependencies: ['tribalChief', 'rariRewardsDistributorDelegator'] - }, - feiDaiStakingTokenWrapper: { - contractDependencies: ['tribalChief', 'rariRewardsDistributorDelegator'] - }, - feiUsdcStakingTokenWrapper: { - contractDependencies: ['tribalChief', 'rariRewardsDistributorDelegator'] - }, d3StakingTokenWrapper: { contractDependencies: ['tribalChief', 'rariRewardsDistributorDelegator'] }, - rewardsDistributorAdmin: { - contractDependencies: ['rariRewardsDistributorDelegator', 'optimisticTimelock'] - }, - stwBulkHarvest: { - contractDependencies: [ - 'stakingTokenWrapperFOXLaaS', - 'stakingTokenWrapperBribeD3pool', - 'stakingTokenWrapperGROLaaS', - 'stakingTokenWrapperKYLINLaaS', - 'stakingTokenWrapperMStableLaaS', - 'stakingTokenWrapperNEARLaaS', - 'stakingTokenWrapperPoolTogetherLaaS', - 'stakingTokenWrapperRari', - 'stakingTokenWrapperSYNLaaS', - 'stakingTokenWrapperUMALaaS' - ] - }, - stakingTokenWrapperFOXLaaS: { - contractDependencies: ['tribalChief', 'stwBulkHarvest'] - }, - stakingTokenWrapperBribeD3pool: { - contractDependencies: ['tribalChief', 'votiumBriberD3pool', 'stwBulkHarvest'] - }, - stakingTokenWrapperGROLaaS: { - contractDependencies: ['tribalChief', 'stwBulkHarvest'] - }, - stakingTokenWrapperKYLINLaaS: { - contractDependencies: ['tribalChief', 'stwBulkHarvest'] - }, - stakingTokenWrapperMStableLaaS: { - contractDependencies: ['tribalChief', 'stwBulkHarvest'] - }, - stakingTokenWrapperNEARLaaS: { - contractDependencies: ['tribalChief', 'stwBulkHarvest'] - }, - stakingTokenWrapperPoolTogetherLaaS: { - contractDependencies: ['tribalChief', 'stwBulkHarvest'] - }, - stakingTokenWrapperRari: { - contractDependencies: ['tribalChief', 'stwBulkHarvest'] - }, - stakingTokenWrapperSYNLaaS: { - contractDependencies: ['tribalChief', 'stwBulkHarvest'] - }, - stakingTokenWrapperUMALaaS: { - contractDependencies: ['tribalChief', 'stwBulkHarvest'] - }, tribalChief: { contractDependencies: [ 'core', 'tribalChiefSyncV2', 'optimisticTimelock', 'erc20Dripper', - 'stakingTokenWrapperBribeD3pool', - 'stakingTokenWrapperFOXLaaS', - 'stakingTokenWrapperGROLaaS', - 'stakingTokenWrapperKYLINLaaS', - 'stakingTokenWrapperMStableLaaS', - 'stakingTokenWrapperNEARLaaS', - 'stakingTokenWrapperPoolTogetherLaaS', - 'stakingTokenWrapperRari', - 'stakingTokenWrapperSYNLaaS', - 'stakingTokenWrapperUMALaaS', 'tribalChiefImpl', 'proxyAdmin', - 'fei3CrvStakingtokenWrapper', - 'd3StakingTokenWrapper', - 'feiDaiStakingTokenWrapper', - 'feiUsdcStakingTokenWrapper' + 'd3StakingTokenWrapper' ] }, tribalChiefImpl: { @@ -774,7 +700,7 @@ const dependencies: DependencyMap = { ] }, votiumBriberD3pool: { - contractDependencies: ['stakingTokenWrapperBribeD3pool', 'opsOptimisticTimelock'] + contractDependencies: ['opsOptimisticTimelock'] }, votiumBriber3Crvpool: { contractDependencies: ['opsOptimisticTimelock'] diff --git a/protocol-configuration/mainnetAddresses.ts b/protocol-configuration/mainnetAddresses.ts index 0b7e0c021..27eeb0262 100644 --- a/protocol-configuration/mainnetAddresses.ts +++ b/protocol-configuration/mainnetAddresses.ts @@ -841,6 +841,7 @@ const MainnetAddresses: MainnetAddresses = { address: '0x220f93183a69d1598e8405310cB361CFF504146F', category: AddressCategory.Rewards }, + // TODO: This has ~$1.5M TRIBE on it rariRewardsDistributorDelegator: { artifactName: 'IRewardsDistributorAdmin', address: '0x73F16f0c0Cd1A078A54894974C5C054D8dC1A3d7', @@ -849,72 +850,72 @@ const MainnetAddresses: MainnetAddresses = { rewardsDistributorAdmin: { artifactName: 'RewardsDistributorAdmin', address: '0x4e979E8b136Cd7BdEBB83ea50a599C3BED1e15c0', - category: AddressCategory.Rewards + category: AddressCategory.Deprecated }, stakingTokenWrapperBribeD3pool: { artifactName: 'StakingTokenWrapper', address: '0x462515dC7c21C728C8b7A777fDC89EEdAcF74537', - category: AddressCategory.Rewards + category: AddressCategory.Deprecated }, stakingTokenWrapperFOXLaaS: { artifactName: 'StakingTokenWrapper', address: '0x3CD384ff1Fa1cbA8f06DF326AF4cbDA634aF94e8', - category: AddressCategory.Rewards + category: AddressCategory.Deprecated }, stakingTokenWrapperGROLaaS: { artifactName: 'StakingTokenWrapper', address: '0x508629e8E0B96986Df4D0F1F60aadeF1d0FbaE96', - category: AddressCategory.Rewards + category: AddressCategory.Deprecated }, stakingTokenWrapperKYLINLaaS: { artifactName: 'StakingTokenWrapper', address: '0xFe266d143dB42a9835e2B1AB43B64a46278398cc', - category: AddressCategory.Rewards + category: AddressCategory.Deprecated }, stakingTokenWrapperMStableLaaS: { artifactName: 'StakingTokenWrapper', address: '0x9B9ad20Cd99Cac3B536b94497A18346d66db0379', - category: AddressCategory.Rewards + category: AddressCategory.Deprecated }, stakingTokenWrapperNEARLaaS: { artifactName: 'StakingTokenWrapper', address: '0x3b3591a4f7FD386E9987Eb48d898e29b57c30c47', - category: AddressCategory.Rewards + category: AddressCategory.Deprecated }, stakingTokenWrapperPoolTogetherLaaS: { artifactName: 'StakingTokenWrapper', address: '0x6b018170311F3DA23c3fA62AFe1b2D0638522CCD', - category: AddressCategory.Rewards + category: AddressCategory.Deprecated }, stakingTokenWrapperRari: { artifactName: 'StakingTokenWrapper', address: '0xd81Be1B9A7895C996704A8DDa794BbA4454EeB90', - category: AddressCategory.Rewards + category: AddressCategory.Deprecated }, stakingTokenWrapperSYNLaaS: { artifactName: 'StakingTokenWrapper', address: '0x5Db85e395735Bb42eEB720Fe2EE69627d246e300', - category: AddressCategory.Rewards + category: AddressCategory.Deprecated }, stakingTokenWrapperUMALaaS: { artifactName: 'StakingTokenWrapper', address: '0x90B336dFF819b9e4b3D9A32cabdcAB0E92836065', - category: AddressCategory.Rewards + category: AddressCategory.Deprecated }, fei3CrvStakingtokenWrapper: { artifactName: 'StakingTokenWrapper', address: '0x7013dc2e3c0D5ca3c0a6a66F6B5883eD203ac49c', - category: AddressCategory.Rewards + category: AddressCategory.Deprecated }, feiDaiStakingTokenWrapper: { artifactName: 'StakingTokenWrapper', address: '0x601FFddACcAF7F05600D7E7561a51C745B8A2A3e', - category: AddressCategory.Rewards + category: AddressCategory.Deprecated }, feiUsdcStakingTokenWrapper: { artifactName: 'StakingTokenWrapper', address: '0x0A0542Adf2fA8e85DD797697da537448b2e7c3EE', - category: AddressCategory.Rewards + category: AddressCategory.Deprecated }, feiDaiAutoRewardsDistributor: { artifactName: 'AutoRewardsDistributorV2', @@ -934,7 +935,7 @@ const MainnetAddresses: MainnetAddresses = { stwBulkHarvest: { artifactName: 'STWBulkHarvest', address: '0x83433D925048d7e9D2D7Eec2A0Efbb4456Af2F93', - category: AddressCategory.Rewards + category: AddressCategory.Deprecated }, tribalChief: { artifactName: 'TribalChief', @@ -959,7 +960,7 @@ const MainnetAddresses: MainnetAddresses = { stakingTokenWrapperBribe3Crvpool: { artifactName: 'StakingTokenWrapper', address: '0xaC98807E5CC43f134b00E87349e4ea3eDf927961', - category: AddressCategory.Rewards + category: AddressCategory.Deprecated }, votiumBriber3Crvpool: { artifactName: 'VotiumBriber', diff --git a/test/integration/proposals_config.ts b/test/integration/proposals_config.ts index bdcb2d8e8..5194b7834 100644 --- a/test/integration/proposals_config.ts +++ b/test/integration/proposals_config.ts @@ -28,14 +28,36 @@ const proposals: ProposalsConfigMap = { totalValue: 0, // amount of ETH to send to DAO execution proposal: end_tribe_incentives, // full proposal file, imported from '@proposals/description/fip_xx.ts' proposalId: '', - affectedContractSignoff: ['core', 'tribalChief', 'tribalCouncilTimelock', 'collateralizationOracle'], + affectedContractSignoff: [ + 'core', + 'tribalChief', + 'tribalCouncilTimelock', + 'collateralizationOracle', + 'tribalChiefSyncV2' + ], deprecatedContractSignoff: [ 'creamDepositWrapper', 'fei3CrvAutoRewardsDistributor', 'd3AutoRewardsDistributor', 'autoRewardsDistributor', 'feiDaiAutoRewardsDistributor', - 'feiUsdcAutoRewardsDistributor' + 'feiUsdcAutoRewardsDistributor', + 'stakingTokenWrapperRari', + 'stakingTokenWrapperFOXLaaS', + 'stakingTokenWrapperGROLaaS', + 'stakingTokenWrapperKYLINLaaS', + 'stakingTokenWrapperMStableLaaS', + 'stakingTokenWrapperNEARLaaS', + 'stakingTokenWrapperPoolTogetherLaaS', + 'stakingTokenWrapperUMALaaS', + 'stakingTokenWrapperSYNLaaS', + 'rewardsDistributorAdmin', + 'stwHarvest', + 'stakingTokenWrapperBribeD3pool', + 'fei3CrvStakingtokenWrapper', + 'feiDaiStakingTokenWrapper', + 'feiUsdcStakingTokenWrapper', + 'stakingTokenWrapperBribe3Crvpool' ], category: ProposalCategory.TC } From 026b832e6db14d07d2f16fd10a26a82711ce4606 Mon Sep 17 00:00:00 2001 From: thomas-waite Date: Fri, 3 Jun 2022 01:33:23 +0100 Subject: [PATCH 202/274] deps: more deprecation --- proposals/dao/end_tribe_incentives.ts | 3 +++ proposals/description/end_tribe_incentives.ts | 12 +++++++++ protocol-configuration/dependencies.ts | 26 ++----------------- protocol-configuration/mainnetAddresses.ts | 9 ++++--- protocol-configuration/permissions.ts | 2 +- test/integration/proposals_config.ts | 14 +++++----- 6 files changed, 29 insertions(+), 37 deletions(-) diff --git a/proposals/dao/end_tribe_incentives.ts b/proposals/dao/end_tribe_incentives.ts index bd704cc8c..67508d30f 100644 --- a/proposals/dao/end_tribe_incentives.ts +++ b/proposals/dao/end_tribe_incentives.ts @@ -67,6 +67,9 @@ const validate: ValidateUpgradeFunc = async (addresses, oldContracts, contracts, ).to.equal(false); expect(await contracts.core.hasRole(ethers.utils.id('FUSE_ADMIN'), addresses.tribalChiefSyncV2)).to.equal(false); + expect(await contracts.core.hasRole(ethers.utils.id('VOTIUM_ADMIN_ROLE'), addresses.tribalChiefSyncV2)).to.equal( + false + ); // 1. Verify TribalChief block rewards are effectively 0 expect(await tribalChief.tribePerBlock()).to.equal(NEW_TRIBE_BLOCK_REWARD); diff --git a/proposals/description/end_tribe_incentives.ts b/proposals/description/end_tribe_incentives.ts index b8d283906..3f7d0ad44 100644 --- a/proposals/description/end_tribe_incentives.ts +++ b/proposals/description/end_tribe_incentives.ts @@ -271,6 +271,18 @@ const end_tribe_incentives: ProposalDescription = { description: 'Revoke AUTO_REWARDS_DISTRIBUTOR_ROLE from fei3CrvAutoRewardsDistributor' }, + //// Revoke VOTIUM_ROLE, no longer needed + { + target: 'core', + values: '0', + method: 'revokeRole(bytes32,address)', + arguments: [ + '0x2d46c62aa6fbc9b550f22e00476aebb90f4ea69cd492a68db4d444217763330d', // VOTIUM_ADMIN_ROLE + '{opsOptimisticTimelock}' + ], + description: 'Revoke VOTIUM_ROLE from opsOptimisticTimelock as no longer required' + }, + ////// Remove CREAM from CR { target: 'collateralizationOracle', diff --git a/protocol-configuration/dependencies.ts b/protocol-configuration/dependencies.ts index 605ddca68..0a4175391 100644 --- a/protocol-configuration/dependencies.ts +++ b/protocol-configuration/dependencies.ts @@ -264,12 +264,11 @@ const dependencies: DependencyMap = { contractDependencies: ['optimisticTimelock'] }, opsOptimisticTimelock: { - contractDependencies: ['votiumBriberD3pool', 'votiumBriber3Crvpool'] + contractDependencies: ['votiumBriber3Crvpool'] }, optimisticTimelock: { contractDependencies: [ 'core', - 'tribalChiefSyncV2', 'rariPool8Comptroller', 'optimisticMultisig', 'optimisticMinter', @@ -671,37 +670,16 @@ const dependencies: DependencyMap = { 'rariPool8Tribe', 'rariRewardsDistributorDelegate', // impl 'rariPool8Comptroller', - 'd3StakingTokenWrapper', 'rariPool8Fei3Crv', 'rariPool8d3' ] }, - d3StakingTokenWrapper: { - contractDependencies: ['tribalChief', 'rariRewardsDistributorDelegator'] - }, tribalChief: { - contractDependencies: [ - 'core', - 'tribalChiefSyncV2', - 'optimisticTimelock', - 'erc20Dripper', - 'tribalChiefImpl', - 'proxyAdmin', - 'd3StakingTokenWrapper' - ] + contractDependencies: ['core', 'optimisticTimelock', 'erc20Dripper', 'tribalChiefImpl', 'proxyAdmin'] }, tribalChiefImpl: { contractDependencies: ['tribalChief'] }, - tribalChiefSyncV2: { - contractDependencies: [ - 'optimisticTimelock', // executes atomic updates - 'tribalChief' // mass updates pools - ] - }, - votiumBriberD3pool: { - contractDependencies: ['opsOptimisticTimelock'] - }, votiumBriber3Crvpool: { contractDependencies: ['opsOptimisticTimelock'] }, diff --git a/protocol-configuration/mainnetAddresses.ts b/protocol-configuration/mainnetAddresses.ts index 27eeb0262..e5307473b 100644 --- a/protocol-configuration/mainnetAddresses.ts +++ b/protocol-configuration/mainnetAddresses.ts @@ -930,7 +930,7 @@ const MainnetAddresses: MainnetAddresses = { d3StakingTokenWrapper: { artifactName: 'StakingTokenWrapper', address: '0xAa267d0A5A0A56Ef0F17bB4A28f85a5C4e0394F6', - category: AddressCategory.Rewards + category: AddressCategory.Deprecated }, stwBulkHarvest: { artifactName: 'STWBulkHarvest', @@ -950,18 +950,19 @@ const MainnetAddresses: MainnetAddresses = { tribalChiefSyncV2: { artifactName: 'TribalChiefSyncV2', address: '0xb41c594f9a6a2E0882212598337AF8145f63731b', - category: AddressCategory.Rewards + category: AddressCategory.Deprecated }, tribalChiefSyncExtension: { artifactName: 'TribalChiefSyncExtension', address: '0x7b834cA07f81d52bB52d98DaE560D1442b2d7dBa', - category: AddressCategory.Rewards + category: AddressCategory.Deprecated }, stakingTokenWrapperBribe3Crvpool: { artifactName: 'StakingTokenWrapper', address: '0xaC98807E5CC43f134b00E87349e4ea3eDf927961', category: AddressCategory.Deprecated }, + // TODO: This has $50k TRIBE on it, should withdraw votiumBriber3Crvpool: { artifactName: 'VotiumBriber', address: '0x8B6A295a35171E2F05B1579E485017B999810dcb', @@ -970,7 +971,7 @@ const MainnetAddresses: MainnetAddresses = { votiumBriberD3pool: { artifactName: 'VotiumBriber', address: '0x0BEC570466B466aB689Ad33F1Ce5238CA43C8003', - category: AddressCategory.Rewards + category: AddressCategory.Deprecated }, rariPool8ConvexD3Plugin: { artifactName: 'IConvexERC4626', diff --git a/protocol-configuration/permissions.ts b/protocol-configuration/permissions.ts index ad270aa16..f6f5896df 100644 --- a/protocol-configuration/permissions.ts +++ b/protocol-configuration/permissions.ts @@ -38,7 +38,7 @@ export const permissions = { PSM_ADMIN_ROLE: ['tribalCouncilTimelock'], TRIBAL_CHIEF_ADMIN_ROLE: ['optimisticTimelock', 'tribalCouncilTimelock'], FUSE_ADMIN: ['optimisticTimelock', 'tribalCouncilTimelock'], - VOTIUM_ADMIN_ROLE: ['opsOptimisticTimelock'], + VOTIUM_ADMIN_ROLE: [], PCV_GUARDIAN_ADMIN_ROLE: ['optimisticTimelock', 'tribalCouncilTimelock'], PCV_SAFE_MOVER_ROLE: ['tribalCouncilTimelock'], METAGOVERNANCE_VOTE_ADMIN: ['feiDAOTimelock', 'opsOptimisticTimelock', 'tribalCouncilTimelock'], diff --git a/test/integration/proposals_config.ts b/test/integration/proposals_config.ts index 5194b7834..efd5a5c69 100644 --- a/test/integration/proposals_config.ts +++ b/test/integration/proposals_config.ts @@ -28,13 +28,7 @@ const proposals: ProposalsConfigMap = { totalValue: 0, // amount of ETH to send to DAO execution proposal: end_tribe_incentives, // full proposal file, imported from '@proposals/description/fip_xx.ts' proposalId: '', - affectedContractSignoff: [ - 'core', - 'tribalChief', - 'tribalCouncilTimelock', - 'collateralizationOracle', - 'tribalChiefSyncV2' - ], + affectedContractSignoff: ['core', 'tribalChief', 'tribalCouncilTimelock', 'collateralizationOracle'], deprecatedContractSignoff: [ 'creamDepositWrapper', 'fei3CrvAutoRewardsDistributor', @@ -57,7 +51,11 @@ const proposals: ProposalsConfigMap = { 'fei3CrvStakingtokenWrapper', 'feiDaiStakingTokenWrapper', 'feiUsdcStakingTokenWrapper', - 'stakingTokenWrapperBribe3Crvpool' + 'stakingTokenWrapperBribe3Crvpool', + 'tribalChiefSyncV2', + 'tribalChiefSyncExtension', + 'd3StakingTokenWrapper', + 'votiumBriberD3pool' ], category: ProposalCategory.TC } From 23a90d496653d9b611ef134d6732a166ed2ed8e7 Mon Sep 17 00:00:00 2001 From: thomas-waite Date: Fri, 3 Jun 2022 01:49:53 +0100 Subject: [PATCH 203/274] style: minor touchups --- proposals/dao/end_tribe_incentives.ts | 2 +- proposals/description/end_tribe_incentives.ts | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/proposals/dao/end_tribe_incentives.ts b/proposals/dao/end_tribe_incentives.ts index 67508d30f..6319d0be8 100644 --- a/proposals/dao/end_tribe_incentives.ts +++ b/proposals/dao/end_tribe_incentives.ts @@ -67,7 +67,7 @@ const validate: ValidateUpgradeFunc = async (addresses, oldContracts, contracts, ).to.equal(false); expect(await contracts.core.hasRole(ethers.utils.id('FUSE_ADMIN'), addresses.tribalChiefSyncV2)).to.equal(false); - expect(await contracts.core.hasRole(ethers.utils.id('VOTIUM_ADMIN_ROLE'), addresses.tribalChiefSyncV2)).to.equal( + expect(await contracts.core.hasRole(ethers.utils.id('VOTIUM_ADMIN_ROLE'), addresses.opsOptimisticTimelock)).to.equal( false ); diff --git a/proposals/description/end_tribe_incentives.ts b/proposals/description/end_tribe_incentives.ts index 3f7d0ad44..69cb5fa69 100644 --- a/proposals/description/end_tribe_incentives.ts +++ b/proposals/description/end_tribe_incentives.ts @@ -15,6 +15,8 @@ const end_tribe_incentives: ProposalDescription = { ///////////// Replicate onlyGovernor behaviour or resetRewards() //////// Set Pool allocation points to 0. This also updates reward variables + + // FEI-TRIBE LP has a single AP point { target: 'tribalChief', values: '0', @@ -36,8 +38,6 @@ const end_tribe_incentives: ProposalDescription = { arguments: ['2', '0', '0x0000000000000000000000000000000000000000', false], description: 'Set Pool 2 rewards to 0 and do not overwrite or change the rewarder' }, - - // Note: Setting a single pool here to have an AP point != 0 { target: 'tribalChief', values: '0', From df1deda06504769ab423d1d8e6cab50dfb5c7ff3 Mon Sep 17 00:00:00 2001 From: thomas-waite Date: Fri, 3 Jun 2022 01:58:43 +0100 Subject: [PATCH 204/274] test: fix e2es --- test/integration/proposals_config.ts | 8 +++++++- test/integration/tests/staking.ts | 2 ++ test/integration/tests/votium-bribe.ts | 5 +++++ 3 files changed, 14 insertions(+), 1 deletion(-) diff --git a/test/integration/proposals_config.ts b/test/integration/proposals_config.ts index efd5a5c69..de82ce2a2 100644 --- a/test/integration/proposals_config.ts +++ b/test/integration/proposals_config.ts @@ -28,7 +28,13 @@ const proposals: ProposalsConfigMap = { totalValue: 0, // amount of ETH to send to DAO execution proposal: end_tribe_incentives, // full proposal file, imported from '@proposals/description/fip_xx.ts' proposalId: '', - affectedContractSignoff: ['core', 'tribalChief', 'tribalCouncilTimelock', 'collateralizationOracle'], + affectedContractSignoff: [ + 'core', + 'tribalChief', + 'tribalCouncilTimelock', + 'collateralizationOracle', + 'opsOptimisticTimelock' + ], deprecatedContractSignoff: [ 'creamDepositWrapper', 'fei3CrvAutoRewardsDistributor', diff --git a/test/integration/tests/staking.ts b/test/integration/tests/staking.ts index 713d93444..02d68cc41 100644 --- a/test/integration/tests/staking.ts +++ b/test/integration/tests/staking.ts @@ -201,6 +201,8 @@ describe('e2e-staking', function () { await tribalChief.connect(daoSigner).set(16, 500, ethers.constants.AddressZero, false); await tribalChief.connect(daoSigner).set(17, 250, ethers.constants.AddressZero, false); + // TOOD: Grant various autoRewardDistributors the relevant role + tribePerBlock = await tribalChief.tribePerBlock(); rewardsDistributorAdmin = contracts.rewardsDistributorAdmin; diff --git a/test/integration/tests/votium-bribe.ts b/test/integration/tests/votium-bribe.ts index b44ffcca6..4bba674b5 100644 --- a/test/integration/tests/votium-bribe.ts +++ b/test/integration/tests/votium-bribe.ts @@ -47,6 +47,11 @@ describe('votium-bribe', function () { // Setup TribalChief so that rewards are active await contracts.tribalChief.connect(daoSigner).updateBlockReward('26150000000000000000'); await contracts.tribalChief.connect(daoSigner).set(12, 250, ethers.constants.AddressZero, false); + + // Grant bribeSigner role to interact with VotiumBribers + await contracts.core + .connect(daoSigner) + .grantRole(ethers.utils.id('VOTIUM_ADMIN_ROLE'), contracts.opsOptimisticTimelock.address); }); describe('When no voting round is active', async function () { From 6a7efa16a851bbaaffcaf1da8ee6688bad80bb45 Mon Sep 17 00:00:00 2001 From: thomas-waite Date: Fri, 3 Jun 2022 14:09:41 +0100 Subject: [PATCH 205/274] test: more e2e fixes --- test/integration/tests/staking.ts | 127 ++++++++++++++++++++---------- 1 file changed, 87 insertions(+), 40 deletions(-) diff --git a/test/integration/tests/staking.ts b/test/integration/tests/staking.ts index 02d68cc41..7f208d4e0 100644 --- a/test/integration/tests/staking.ts +++ b/test/integration/tests/staking.ts @@ -1,8 +1,13 @@ import { AutoRewardsDistributor, + Core, + FeiDAOTimelock, + RewardsDistributorAdmin, + StakingTokenWrapper, TribalChief, TribalChiefSyncExtension, - TribalChiefSyncV2 + TribalChiefSyncV2, + Tribe } from '@custom-types/contracts'; import { SignerWithAddress } from '@nomiclabs/hardhat-ethers/signers'; import chai, { expect } from 'chai'; @@ -18,7 +23,43 @@ import { forceEth } from '@test/integration/setup/utils'; const toBN = ethers.BigNumber.from; -describe('e2e-staking', function () { +const setupIncentivesFixtures = async ( + core: Core, + tribalChief: TribalChief, + feiDAOTimelock: FeiDAOTimelock, + rewardsDistributorAdmin: RewardsDistributorAdmin, + autoRewardsDistributors: AutoRewardsDistributor[], + pid: number, + poolAllocPoints: number, + addresses: NamedAddresses +) => { + // TribalChief fixture: setup with non-zero block reward and various pools with allocation points + const daoSigner = await getImpersonatedSigner(feiDAOTimelock.address); + await forceEth(feiDAOTimelock.address); + await tribalChief.connect(daoSigner).updateBlockReward('26150000000000000000'); + + // Initialise various pools with rewards + await tribalChief.connect(daoSigner).set(pid, poolAllocPoints, ethers.constants.AddressZero, false); + await tribalChief.connect(daoSigner).set(12, 250, ethers.constants.AddressZero, false); + await tribalChief.connect(daoSigner).set(13, 250, ethers.constants.AddressZero, false); + await tribalChief.connect(daoSigner).set(14, 1000, ethers.constants.AddressZero, false); + await tribalChief.connect(daoSigner).set(15, 100, ethers.constants.AddressZero, false); + await tribalChief.connect(daoSigner).set(16, 500, ethers.constants.AddressZero, false); + await tribalChief.connect(daoSigner).set(17, 250, ethers.constants.AddressZero, false); + + // Grant out roles + await core.connect(daoSigner).grantRole(ethers.utils.id('TRIBAL_CHIEF_ADMIN_ROLE'), addresses.tribalChiefSyncV2); + await rewardsDistributorAdmin.connect(daoSigner).becomeAdmin(); + + for (const rewardDistributor of autoRewardsDistributors) { + console.log('granting role: ', rewardDistributor.address); + await rewardsDistributorAdmin + .connect(daoSigner) + .grantRole(ethers.utils.id('AUTO_REWARDS_DISTRIBUTOR_ROLE'), rewardDistributor.address); + } +}; + +describe.only('e2e-staking', function () { let contracts: NamedContracts; let contractAddresses: NamedAddresses; let deployAddress: string; @@ -172,43 +213,41 @@ describe('e2e-staking', function () { }); describe('FeiRari Tribe Staking Rewards', async () => { - let tribe: Contract; + let tribe: Tribe; let tribalChief: TribalChief; let tribePerBlock: BigNumber; let autoRewardsDistributor: AutoRewardsDistributor; - let rewardsDistributorAdmin: Contract; - let stakingTokenWrapper: Contract; + let rewardsDistributorAdmin: RewardsDistributorAdmin; + let stakingTokenWrapper: StakingTokenWrapper; const poolAllocPoints = 1000; const pid = 3; let optimisticTimelock: SignerWithAddress; let totalAllocPoint: BigNumber; before(async () => { - stakingTokenWrapper = contracts.stakingTokenWrapperRari; + stakingTokenWrapper = contracts.stakingTokenWrapperRari as StakingTokenWrapper; tribalChief = contracts.tribalChief as TribalChief; - - // TribalChief fixture: setup with non-zero block reward and various pools with allocation points - const daoSigner = await getImpersonatedSigner(contracts.feiDAOTimelock.address); - await forceEth(contracts.feiDAOTimelock.address); - await tribalChief.connect(daoSigner).updateBlockReward('26150000000000000000'); - - // Initialise various pools with rewards - await tribalChief.connect(daoSigner).set(pid, poolAllocPoints, ethers.constants.AddressZero, false); - await tribalChief.connect(daoSigner).set(12, 250, ethers.constants.AddressZero, false); - await tribalChief.connect(daoSigner).set(13, 250, ethers.constants.AddressZero, false); - await tribalChief.connect(daoSigner).set(14, 1000, ethers.constants.AddressZero, false); - await tribalChief.connect(daoSigner).set(15, 100, ethers.constants.AddressZero, false); - await tribalChief.connect(daoSigner).set(16, 500, ethers.constants.AddressZero, false); - await tribalChief.connect(daoSigner).set(17, 250, ethers.constants.AddressZero, false); - - // TOOD: Grant various autoRewardDistributors the relevant role + rewardsDistributorAdmin = contracts.rewardsDistributorAdmin as RewardsDistributorAdmin; + autoRewardsDistributor = contracts.autoRewardsDistributor as AutoRewardsDistributor; + tribe = contracts.tribe as Tribe; + + const feiDAOTimelock = contracts.feiDAOTimelock as FeiDAOTimelock; + const d3AutoRewardsDistributor = contracts.d3AutoRewardsDistributor as AutoRewardsDistributor; + const fei3CrvAutoRewardsDistributor = contracts.fei3CrvAutoRewardsDistributor as AutoRewardsDistributor; + + await setupIncentivesFixtures( + contracts.core as Core, + tribalChief, + feiDAOTimelock, + rewardsDistributorAdmin, + [autoRewardsDistributor, d3AutoRewardsDistributor, fei3CrvAutoRewardsDistributor], + pid, + poolAllocPoints, + contractAddresses + ); tribePerBlock = await tribalChief.tribePerBlock(); - rewardsDistributorAdmin = contracts.rewardsDistributorAdmin; - autoRewardsDistributor = contracts.autoRewardsDistributor as AutoRewardsDistributor; - tribe = contracts.tribe; - optimisticTimelock = await ethers.getSigner(contracts.optimisticTimelock.address); await hre.network.provider.request({ method: 'hardhat_impersonateAccount', @@ -352,23 +391,31 @@ describe('e2e-staking', function () { describe('TribalChiefSyncV2', async () => { before(async () => { - const tribalChief = contracts.tribalChief; + const tribalChief = contracts.tribalChief as TribalChief; + const rewardsDistributorAdmin = contracts.rewardsDistributorAdmin as RewardsDistributorAdmin; + const autoRewardsDistributor = contracts.autoRewardsDistributor as AutoRewardsDistributor; + const feiDAOTimelock = contracts.feiDAOTimelock as FeiDAOTimelock; + + const d3AutoRewardsDistributor = contracts.d3AutoRewardsDistributor as AutoRewardsDistributor; + const fei3CrvAutoRewardsDistributor = contracts.fei3CrvAutoRewardsDistributor as AutoRewardsDistributor; + + const pid = 3; + const poolAllocPoints = 1000; + // Fixture: Set Tribe block reward to be greater than 0 - const daoSigner = await getImpersonatedSigner(contracts.feiDAOTimelock.address); - await forceEth(contracts.feiDAOTimelock.address); - await contracts.tribalChief.connect(daoSigner).updateBlockReward('26150000000000000000'); - - // Initialise various pools with rewards - await tribalChief.connect(daoSigner).set(3, 1000, ethers.constants.AddressZero, false); - await tribalChief.connect(daoSigner).set(12, 250, ethers.constants.AddressZero, false); - await tribalChief.connect(daoSigner).set(13, 250, ethers.constants.AddressZero, false); - await tribalChief.connect(daoSigner).set(14, 1000, ethers.constants.AddressZero, false); - await tribalChief.connect(daoSigner).set(15, 100, ethers.constants.AddressZero, false); - await tribalChief.connect(daoSigner).set(16, 500, ethers.constants.AddressZero, false); - await tribalChief.connect(daoSigner).set(17, 250, ethers.constants.AddressZero, false); + await setupIncentivesFixtures( + contracts.core as Core, + tribalChief, + feiDAOTimelock, + rewardsDistributorAdmin, + [autoRewardsDistributor, d3AutoRewardsDistributor, fei3CrvAutoRewardsDistributor], + pid, + poolAllocPoints, + contractAddresses + ); }); - it('auto-sync works correctly', async () => { + it.only('auto-sync works correctly', async () => { const tribalChiefSync: TribalChiefSyncV2 = contracts.tribalChiefSyncV2 as TribalChiefSyncV2; const tribalChiefSyncExtension: TribalChiefSyncExtension = contracts.tribalChiefSyncExtension as TribalChiefSyncExtension; From 7b5c8bf5a24025fee33199f97966d6628be436fc Mon Sep 17 00:00:00 2001 From: thomas-waite Date: Fri, 3 Jun 2022 14:15:25 +0100 Subject: [PATCH 206/274] deps: fix dependency issue --- test/integration/proposals_config.ts | 2 +- test/integration/tests/staking.ts | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/test/integration/proposals_config.ts b/test/integration/proposals_config.ts index de82ce2a2..aab450ec0 100644 --- a/test/integration/proposals_config.ts +++ b/test/integration/proposals_config.ts @@ -52,7 +52,7 @@ const proposals: ProposalsConfigMap = { 'stakingTokenWrapperUMALaaS', 'stakingTokenWrapperSYNLaaS', 'rewardsDistributorAdmin', - 'stwHarvest', + 'stwBulkHarvest', 'stakingTokenWrapperBribeD3pool', 'fei3CrvStakingtokenWrapper', 'feiDaiStakingTokenWrapper', diff --git a/test/integration/tests/staking.ts b/test/integration/tests/staking.ts index 7f208d4e0..7f4ef5d99 100644 --- a/test/integration/tests/staking.ts +++ b/test/integration/tests/staking.ts @@ -59,7 +59,7 @@ const setupIncentivesFixtures = async ( } }; -describe.only('e2e-staking', function () { +describe('e2e-staking', function () { let contracts: NamedContracts; let contractAddresses: NamedAddresses; let deployAddress: string; @@ -415,7 +415,7 @@ describe.only('e2e-staking', function () { ); }); - it.only('auto-sync works correctly', async () => { + it('auto-sync works correctly', async () => { const tribalChiefSync: TribalChiefSyncV2 = contracts.tribalChiefSyncV2 as TribalChiefSyncV2; const tribalChiefSyncExtension: TribalChiefSyncExtension = contracts.tribalChiefSyncExtension as TribalChiefSyncExtension; From 41ca530c5757ae2bd18c183925562b60a8a5bcf6 Mon Sep 17 00:00:00 2001 From: thomas-waite Date: Fri, 3 Jun 2022 14:31:51 +0100 Subject: [PATCH 207/274] test: break out into set of e2e tests --- proposals/dao/end_tribe_incentives.ts | 25 ------ test/integration/tests/tribeIncentivesEnd.ts | 95 ++++++++++++++++++++ 2 files changed, 95 insertions(+), 25 deletions(-) create mode 100644 test/integration/tests/tribeIncentivesEnd.ts diff --git a/proposals/dao/end_tribe_incentives.ts b/proposals/dao/end_tribe_incentives.ts index 6319d0be8..5c67f60a2 100644 --- a/proposals/dao/end_tribe_incentives.ts +++ b/proposals/dao/end_tribe_incentives.ts @@ -130,31 +130,6 @@ const validate: ValidateUpgradeFunc = async (addresses, oldContracts, contracts, // 4. Verify total AP points is 1 expect(await tribalChief.totalAllocPoint()).to.be.equal(NEW_TOTAL_ALLOC_POINTS.toString()); - - // 5. Validate that can harvest Tribe rewards - const receiver = '0xbEA4B2357e8ec53AF60BbcA4bc570332a7C7E232'; - const initialBalance = await tribe.balanceOf(receiver); - - const poolId = 1; - // This is a staking token wrapper - const stakedTokenAddress = '0x06cb22615BA53E60D67Bf6C341a0fD5E718E1655'; - const stakerInPool = '0x019EdcB493Bd91e2b25b70f26D5d9041Fd7EF946'; - const stakerInPoolSigner = await getImpersonatedSigner(stakerInPool); - await forceEth(stakerInPool); - - const stakedToken = await ethers.getContractAt('StakingTokenWrapper', stakedTokenAddress); - - await tribalChief.connect(stakerInPoolSigner).harvest(poolId, receiver); - const finalBalance = await tribe.balanceOf(receiver); - const harvestedTribe = finalBalance.sub(initialBalance); - expect(harvestedTribe).to.be.bignumber.at.least(toBN(1)); - - // 6. Validate can withdraw principle from staked pool - const receiverBalanceBefore = await stakedToken.balanceOf(receiver); - await tribalChief.connect(stakerInPoolSigner).withdrawAllAndHarvest(poolId, receiver); - const receiverBalanceAfter = await stakedToken.balanceOf(receiver); - const withdrawnPrinciple = receiverBalanceAfter.sub(receiverBalanceBefore); - expect(withdrawnPrinciple).to.be.bignumber.at.least(toBN(1)); }; export { deploy, setup, teardown, validate }; diff --git a/test/integration/tests/tribeIncentivesEnd.ts b/test/integration/tests/tribeIncentivesEnd.ts new file mode 100644 index 000000000..7cfc440e0 --- /dev/null +++ b/test/integration/tests/tribeIncentivesEnd.ts @@ -0,0 +1,95 @@ +import chai, { expect } from 'chai'; +import CBN from 'chai-bn'; +import { solidity } from 'ethereum-waffle'; +import { Contract } from 'ethers'; +import hre, { ethers } from 'hardhat'; +import { NamedAddresses, NamedContracts } from '@custom-types/types'; +import { expectApprox, getImpersonatedSigner, overwriteChainlinkAggregator, resetFork, time } from '@test/helpers'; +import proposals from '@test/integration/proposals_config'; +import { TestEndtoEndCoordinator } from '../setup'; +import { forceEth } from '@test/integration/setup/utils'; +import { TribalChief, Tribe } from '@custom-types/contracts'; + +const toBN = ethers.BigNumber.from; + +describe('e2e-end-tribe-incentives', function () { + let contracts: NamedContracts; + let contractAddresses: NamedAddresses; + let deployAddress: string; + let e2eCoord: TestEndtoEndCoordinator; + let doLogging: boolean; + let tribe: Tribe; + let tribalChief: TribalChief; + const receiver = '0xbEA4B2357e8ec53AF60BbcA4bc570332a7C7E232'; + + before(async () => { + chai.use(CBN(ethers.BigNumber)); + chai.use(solidity); + await resetFork(); + }); + + before(async function () { + // Setup test environment and get contracts + const version = 1; + deployAddress = (await ethers.getSigners())[0].address; + if (!deployAddress) throw new Error(`No deploy address!`); + + doLogging = Boolean(process.env.LOGGING); + + const config = { + logging: doLogging, + deployAddress: deployAddress, + version: version + }; + + e2eCoord = new TestEndtoEndCoordinator(config, proposals); + + doLogging && console.log(`Loading environment...`); + ({ contracts, contractAddresses } = await e2eCoord.loadEnvironment()); + doLogging && console.log(`Environment loaded.`); + + tribe = contracts.tribe as Tribe; + tribalChief = contracts.tribalChief as TribalChief; + }); + + it('should be able to harvest existing TRIBE rewards and withdraw principle from an LP pool', async () => { + const initialBalance = await tribe.balanceOf(receiver); + + const poolId = 1; + const curve3Metapool = '0x06cb22615BA53E60D67Bf6C341a0fD5E718E1655'; + const stakerInPool = '0x019EdcB493Bd91e2b25b70f26D5d9041Fd7EF946'; + const stakerInPoolSigner = await getImpersonatedSigner(stakerInPool); + await forceEth(stakerInPool); + + const curveLPToken = await ethers.getContractAt('ERC20', curve3Metapool); + + // Harvest already earnt TRIBE rewards + await tribalChief.connect(stakerInPoolSigner).harvest(poolId, receiver); + const finalBalance = await tribe.balanceOf(receiver); + const harvestedTribe = finalBalance.sub(initialBalance); + expect(harvestedTribe).to.be.bignumber.at.least(toBN(1)); + + // Withdraw principle from staked pool + const receiverBalanceBefore = await curveLPToken.balanceOf(receiver); + await tribalChief.connect(stakerInPoolSigner).withdrawAllAndHarvest(poolId, receiver); + const receiverBalanceAfter = await curveLPToken.balanceOf(receiver); + const withdrawnPrinciple = receiverBalanceAfter.sub(receiverBalanceBefore); + expect(withdrawnPrinciple).to.be.bignumber.at.least(toBN(1)); + }); + + it('should NOT be able to harvest future TRIBE rewards from an LP pool', async () => { + // Fast forward time by a few blocks + // Try to withdraw + // Should withdraw basically zero + }); + + it('should be able to harvest existing TRIBE rewards and withdraw principle from an AutoRewardDistributor in a Fuse pool', async () => { + // Find a staker in a Rari pool eligible for rewards + }); + + it('should NOT be able to harvest future TRIBE rewards from an AutoRewardDistributor in a Fuse pool', async () => { + // Fast forward time by a few blocks + // Try to withdraw + // Should withdraw basically zero + }); +}); From 8d1e6e7376f9ce70401bbdb8320df9b462fe9c5e Mon Sep 17 00:00:00 2001 From: thomas-waite Date: Fri, 3 Jun 2022 16:33:03 +0100 Subject: [PATCH 208/274] feat: add RewardsDistributorDelegator interface --- .../rewards/IRewardsDistributorDelegator.sol | 143 ++++++++++++++++++ protocol-configuration/mainnetAddresses.ts | 2 +- 2 files changed, 144 insertions(+), 1 deletion(-) create mode 100644 contracts/fuse/rewards/IRewardsDistributorDelegator.sol diff --git a/contracts/fuse/rewards/IRewardsDistributorDelegator.sol b/contracts/fuse/rewards/IRewardsDistributorDelegator.sol new file mode 100644 index 000000000..e9a60a2f8 --- /dev/null +++ b/contracts/fuse/rewards/IRewardsDistributorDelegator.sol @@ -0,0 +1,143 @@ +pragma solidity ^0.8.0; + +import {CToken} from "../../external/fuse/CToken.sol"; + +interface IRewardsDistributorDelegator { + /// @notice The portion of compRate that each market currently receives + function compSupplySpeeds(address) external view returns (uint256); + + /// @notice The portion of compRate that each market currently receives + function compBorrowSpeeds(address) external view returns (uint256); + + /// @notice Role for AutoRewardsDistributor contracts + function AUTO_REWARDS_DISTRIBUTOR_ROLE() external view returns (bytes32); + + /*** Set Admin ***/ + + /** + * @notice Begins transfer of admin rights. The newPendingAdmin must call `_acceptAdmin` to finalize the transfer. + * @dev Admin function to begin change of admin. The newPendingAdmin must call `_acceptAdmin` to finalize the transfer. + * @param newPendingAdmin New pending admin. + */ + function _setPendingAdmin(address newPendingAdmin) external; + + /** + * @notice Accepts transfer of admin rights. msg.sender must be pendingAdmin + * @dev Admin function for pending admin to accept role and update admin + */ + function _acceptAdmin() external; + + /** + * @notice Keeps the flywheel moving pre-mint and pre-redeem + * @dev Called by the Comptroller + * @param cToken The relevant market + * @param supplier The minter/redeemer + */ + function flywheelPreSupplierAction(address cToken, address supplier) external; + + /** + * @notice Keeps the flywheel moving pre-borrow and pre-repay + * @dev Called by the Comptroller + * @param cToken The relevant market + * @param borrower The borrower + */ + function flywheelPreBorrowerAction(address cToken, address borrower) external; + + /** + * @notice Keeps the flywheel moving pre-transfer and pre-seize + * @dev Called by the Comptroller + * @param cToken The relevant market + * @param src The account which sources the tokens + * @param dst The account which receives the tokens + */ + function flywheelPreTransferAction( + address cToken, + address src, + address dst + ) external; + + /** + * @notice Calculate additional accrued COMP for a contributor since last accrual + * @param contributor The address to calculate contributor rewards for + */ + function updateContributorRewards(address contributor) external; + + /** + * @notice Claim all the comp accrued by holder in all markets + * @param holder The address to claim COMP for + */ + function claimRewards(address holder) external; + + /** + * @notice Claim all the comp accrued by holder in the specified markets + * @param holder The address to claim COMP for + * @param cTokens The list of markets to claim COMP in + */ + function claimRewards(address holder, CToken[] memory cTokens) external; + + /** + * @notice Claim all comp accrued by the holders + * @param holders The addresses to claim COMP for + * @param cTokens The list of markets to claim COMP in + * @param borrowers Whether or not to claim COMP earned by borrowing + * @param suppliers Whether or not to claim COMP earned by supplying + */ + function claimRewards( + address[] memory holders, + CToken[] memory cTokens, + bool borrowers, + bool suppliers + ) external; + + /*** Comp Distribution Admin ***/ + + /** + * @notice Transfer COMP to the recipient + * @dev Note: If there is not enough COMP, we do not perform the transfer all. + * @param recipient The address of the recipient to transfer COMP to + * @param amount The amount of COMP to (possibly) transfer + */ + function _grantComp(address recipient, uint256 amount) external; + + /** + * @notice Set COMP speed for a single market + * @param cToken The market whose COMP speed to update + * @param compSpeed New COMP speed for market + */ + function _setCompSupplySpeed(CToken cToken, uint256 compSpeed) external; + + /** + * @notice Set COMP speed for a single market + * @param cToken The market whose COMP speed to update + * @param compSpeed New COMP speed for market + */ + function _setCompBorrowSpeed(CToken cToken, uint256 compSpeed) external; + + /** + * @notice Set COMP borrow and supply speeds for the specified markets. + * @param cTokens The markets whose COMP speed to update. + * @param supplySpeeds New supply-side COMP speed for the corresponding market. + * @param borrowSpeeds New borrow-side COMP speed for the corresponding market. + */ + function _setCompSpeeds( + CToken[] memory cTokens, + uint256[] memory supplySpeeds, + uint256[] memory borrowSpeeds + ) external; + + /** + * @notice Set COMP speed for a single contributor + * @param contributor The contributor whose COMP speed to update + * @param compSpeed New COMP speed for contributor + */ + function _setContributorCompSpeed(address contributor, uint256 compSpeed) external; + + /*** Helper Functions */ + + function getBlockNumber() external view returns (uint256); + + /** + * @notice Returns an array of all markets. + */ + function getAllMarkets() external view returns (CToken[] memory); +} diff --git a/protocol-configuration/mainnetAddresses.ts b/protocol-configuration/mainnetAddresses.ts index e5307473b..be2665256 100644 --- a/protocol-configuration/mainnetAddresses.ts +++ b/protocol-configuration/mainnetAddresses.ts @@ -843,7 +843,7 @@ const MainnetAddresses: MainnetAddresses = { }, // TODO: This has ~$1.5M TRIBE on it rariRewardsDistributorDelegator: { - artifactName: 'IRewardsDistributorAdmin', + artifactName: 'IRewardsDistributorDelegator', address: '0x73F16f0c0Cd1A078A54894974C5C054D8dC1A3d7', category: AddressCategory.Rewards }, From 95e17429b01cb5a4642fa6733d86cb774cec4e7b Mon Sep 17 00:00:00 2001 From: thomas-waite Date: Fri, 3 Jun 2022 16:51:00 +0100 Subject: [PATCH 209/274] test: e2e for not being able to harvest --- test/integration/tests/tribeIncentivesEnd.ts | 50 ++++++++++++-------- 1 file changed, 31 insertions(+), 19 deletions(-) diff --git a/test/integration/tests/tribeIncentivesEnd.ts b/test/integration/tests/tribeIncentivesEnd.ts index 7cfc440e0..b9ff682d9 100644 --- a/test/integration/tests/tribeIncentivesEnd.ts +++ b/test/integration/tests/tribeIncentivesEnd.ts @@ -1,16 +1,17 @@ import chai, { expect } from 'chai'; import CBN from 'chai-bn'; import { solidity } from 'ethereum-waffle'; -import { Contract } from 'ethers'; -import hre, { ethers } from 'hardhat'; +import { ethers } from 'hardhat'; import { NamedAddresses, NamedContracts } from '@custom-types/types'; -import { expectApprox, getImpersonatedSigner, overwriteChainlinkAggregator, resetFork, time } from '@test/helpers'; +import { getImpersonatedSigner, resetFork, time } from '@test/helpers'; import proposals from '@test/integration/proposals_config'; import { TestEndtoEndCoordinator } from '../setup'; import { forceEth } from '@test/integration/setup/utils'; import { TribalChief, Tribe } from '@custom-types/contracts'; const toBN = ethers.BigNumber.from; +chai.use(CBN(ethers.BigNumber)); +chai.use(solidity); describe('e2e-end-tribe-incentives', function () { let contracts: NamedContracts; @@ -20,15 +21,16 @@ describe('e2e-end-tribe-incentives', function () { let doLogging: boolean; let tribe: Tribe; let tribalChief: TribalChief; + const receiver = '0xbEA4B2357e8ec53AF60BbcA4bc570332a7C7E232'; + const curvePoolId = 1; + const curve3Metapool = '0x06cb22615BA53E60D67Bf6C341a0fD5E718E1655'; + const curvePoolStaker = '0x019EdcB493Bd91e2b25b70f26D5d9041Fd7EF946'; + const pool8User = '0x9544A83A8cB74062c836AA11565d4BB4A54fe40D'; - before(async () => { - chai.use(CBN(ethers.BigNumber)); - chai.use(solidity); + beforeEach(async function () { await resetFork(); - }); - before(async function () { // Setup test environment and get contracts const version = 1; deployAddress = (await ethers.getSigners())[0].address; @@ -54,33 +56,43 @@ describe('e2e-end-tribe-incentives', function () { it('should be able to harvest existing TRIBE rewards and withdraw principle from an LP pool', async () => { const initialBalance = await tribe.balanceOf(receiver); - - const poolId = 1; - const curve3Metapool = '0x06cb22615BA53E60D67Bf6C341a0fD5E718E1655'; - const stakerInPool = '0x019EdcB493Bd91e2b25b70f26D5d9041Fd7EF946'; - const stakerInPoolSigner = await getImpersonatedSigner(stakerInPool); - await forceEth(stakerInPool); + const stakerInPoolSigner = await getImpersonatedSigner(curvePoolStaker); + await forceEth(curvePoolStaker); const curveLPToken = await ethers.getContractAt('ERC20', curve3Metapool); // Harvest already earnt TRIBE rewards - await tribalChief.connect(stakerInPoolSigner).harvest(poolId, receiver); + await tribalChief.connect(stakerInPoolSigner).harvest(curvePoolId, receiver); const finalBalance = await tribe.balanceOf(receiver); const harvestedTribe = finalBalance.sub(initialBalance); expect(harvestedTribe).to.be.bignumber.at.least(toBN(1)); // Withdraw principle from staked pool const receiverBalanceBefore = await curveLPToken.balanceOf(receiver); - await tribalChief.connect(stakerInPoolSigner).withdrawAllAndHarvest(poolId, receiver); + await tribalChief.connect(stakerInPoolSigner).withdrawAllAndHarvest(curvePoolId, receiver); const receiverBalanceAfter = await curveLPToken.balanceOf(receiver); const withdrawnPrinciple = receiverBalanceAfter.sub(receiverBalanceBefore); expect(withdrawnPrinciple).to.be.bignumber.at.least(toBN(1)); }); it('should NOT be able to harvest future TRIBE rewards from an LP pool', async () => { - // Fast forward time by a few blocks - // Try to withdraw - // Should withdraw basically zero + // Harvest, to zero out already earned rewards + const firstHarvestInitial = await tribe.balanceOf(receiver); + const stakerInPoolSigner = await getImpersonatedSigner(curvePoolStaker); + await tribalChief.connect(stakerInPoolSigner).harvest(curvePoolId, receiver); + const firstHarvestFinal = await tribe.balanceOf(receiver); + expect(firstHarvestFinal.sub(firstHarvestInitial)).to.be.bignumber.greaterThan(toBN(1)); + + // Advance time, to check that rewards aren't accruing + await time.increase(86400); + + // Attempt to harvest again. As rewards have been stopped, it should not harvest any Tribe + const balanceBeforeHarvest = await tribe.balanceOf(receiver); + await tribalChief.connect(stakerInPoolSigner).harvest(curvePoolId, receiver); + const balanceAfterHarvest = await tribe.balanceOf(receiver); + + const harvestedTribe = balanceAfterHarvest.sub(balanceBeforeHarvest); + expect(harvestedTribe).to.equal(0); }); it('should be able to harvest existing TRIBE rewards and withdraw principle from an AutoRewardDistributor in a Fuse pool', async () => { From 86dceffca4d26ade45f9ba956b0ee0153c2d67ba Mon Sep 17 00:00:00 2001 From: thomas-waite Date: Fri, 3 Jun 2022 16:52:52 +0100 Subject: [PATCH 210/274] test: add ARD based e2e tests --- proposals/dao/end_tribe_incentives.ts | 12 +++++- test/integration/tests/tribeIncentivesEnd.ts | 40 ++++++++++++++++++-- 2 files changed, 47 insertions(+), 5 deletions(-) diff --git a/proposals/dao/end_tribe_incentives.ts b/proposals/dao/end_tribe_incentives.ts index 5c67f60a2..6b8649d42 100644 --- a/proposals/dao/end_tribe_incentives.ts +++ b/proposals/dao/end_tribe_incentives.ts @@ -128,8 +128,18 @@ const validate: ValidateUpgradeFunc = async (addresses, oldContracts, contracts, ) ).to.equal(false); - // 4. Verify total AP points is 1 + // 5. Verify total AP points is 1 expect(await tribalChief.totalAllocPoint()).to.be.equal(NEW_TOTAL_ALLOC_POINTS.toString()); + + // 6. Verify an AutoRewardDistributor speed is set correctly + const d3Ctoken = await contracts.rariPool8Comptroller.cTokensByUnderlying(addresses.curveD3pool); + + const d3RewardSpeed = await contracts.d3AutoRewardsDistributor.getNewRewardSpeed(); + expect(d3RewardSpeed[1]).to.equal(false); // updateNeeded + expect(d3RewardSpeed[0]).to.equal(0); // newSpeed + + const delegatorReportedSpeed = await contracts.rariRewardsDistributorDelegator.compSupplySpeeds(d3Ctoken); + expect(delegatorReportedSpeed).to.equal(0); }; export { deploy, setup, teardown, validate }; diff --git a/test/integration/tests/tribeIncentivesEnd.ts b/test/integration/tests/tribeIncentivesEnd.ts index b9ff682d9..e86aa0dcf 100644 --- a/test/integration/tests/tribeIncentivesEnd.ts +++ b/test/integration/tests/tribeIncentivesEnd.ts @@ -95,13 +95,45 @@ describe('e2e-end-tribe-incentives', function () { expect(harvestedTribe).to.equal(0); }); - it('should be able to harvest existing TRIBE rewards and withdraw principle from an AutoRewardDistributor in a Fuse pool', async () => { - // Find a staker in a Rari pool eligible for rewards + it('should be able to harvest existing TRIBE rewards from an AutoRewardDistributor in a Fuse pool', async () => { + const { rariRewardsDistributorDelegator, stakingTokenWrapperRari, tribe } = contracts; + + // 2. Harvest Rari staking token wrapper + const delegatorBalanceBeforeHarvest = await tribe.balanceOf(rariRewardsDistributorDelegator.address); + await stakingTokenWrapperRari.harvest(); + const delegatorBalanceAfterHarvest = await tribe.balanceOf(rariRewardsDistributorDelegator.address); + expect(delegatorBalanceAfterHarvest.sub(delegatorBalanceBeforeHarvest)).to.be.bignumber.at.least(toBN(1)); + + // 3. Market participant claims TRIBE rewards + const userBalanceBefore = await tribe.balanceOf(pool8User); + await rariRewardsDistributorDelegator['claimRewards(address)'](pool8User); + const userBalanceAfter = await tribe.balanceOf(pool8User); + const userHarvestedTribe = userBalanceAfter.sub(userBalanceBefore); + expect(userHarvestedTribe).to.be.bignumber.at.least(toBN(1)); }); it('should NOT be able to harvest future TRIBE rewards from an AutoRewardDistributor in a Fuse pool', async () => { + const { rariRewardsDistributorDelegator, stakingTokenWrapperRari, tribe } = contracts; + + // 1. Harvest staking token wrapper to clear out all earned rewards. User also harvests their rewards + await stakingTokenWrapperRari.harvest(); + await rariRewardsDistributorDelegator['claimRewards(address)'](pool8User); + // Fast forward time by a few blocks - // Try to withdraw - // Should withdraw basically zero + await time.increase(86400 * 7); + + // 2. Attempt to harvest more rewards for ARD from Staking Token wrapper. Should harvest 0, as rewards have stopped + const ardBalanceBefore = await tribe.balanceOf(rariRewardsDistributorDelegator.address); + await stakingTokenWrapperRari.harvest(); + const ardBalanceAfter = await tribe.balanceOf(rariRewardsDistributorDelegator.address); + const ardHarvestedTribe = ardBalanceAfter.sub(ardBalanceBefore); + expect(ardHarvestedTribe).to.equal(0); + + // 3. Have user attempt to harvest TRIBE rewards, should harvest 0 TRIBE + const userBalanceBefore = await tribe.balanceOf(pool8User); + await rariRewardsDistributorDelegator['claimRewards(address)'](pool8User); + const userBalanceAfter = await tribe.balanceOf(pool8User); + const userHarvestedTribe = userBalanceAfter.sub(userBalanceBefore); + expect(userHarvestedTribe).to.equal(0); }); }); From 20309b323282e67a05bb7cc029c6df28c4f2272e Mon Sep 17 00:00:00 2001 From: thomas-waite Date: Fri, 3 Jun 2022 16:59:08 +0100 Subject: [PATCH 211/274] docs: touchups --- proposals/description/end_tribe_incentives.ts | 3 +-- test/integration/tests/tribeIncentivesEnd.ts | 4 ++-- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/proposals/description/end_tribe_incentives.ts b/proposals/description/end_tribe_incentives.ts index 69cb5fa69..384b576f0 100644 --- a/proposals/description/end_tribe_incentives.ts +++ b/proposals/description/end_tribe_incentives.ts @@ -1,7 +1,6 @@ import { ProposalDescription } from '@custom-types/types'; const end_tribe_incentives: ProposalDescription = { - // Pool ID is where the pool is in the array title: 'TIP-109: Discontinue Tribe Incentives', commands: [ /////// TC grants itself TRIBAL_CHIEF_ADMIN_ROLE @@ -22,7 +21,7 @@ const end_tribe_incentives: ProposalDescription = { values: '0', method: 'set(uint256,uint120,address,bool)', arguments: ['0', '1', '0x0000000000000000000000000000000000000000', false], - description: 'Set Pool 0 rewards to 0 and do not overwrite or change the rewarder' + description: 'Set Pool 0 rewards to 1 and do not overwrite or change the rewarder' }, { target: 'tribalChief', diff --git a/test/integration/tests/tribeIncentivesEnd.ts b/test/integration/tests/tribeIncentivesEnd.ts index e86aa0dcf..0bc8167fa 100644 --- a/test/integration/tests/tribeIncentivesEnd.ts +++ b/test/integration/tests/tribeIncentivesEnd.ts @@ -98,13 +98,13 @@ describe('e2e-end-tribe-incentives', function () { it('should be able to harvest existing TRIBE rewards from an AutoRewardDistributor in a Fuse pool', async () => { const { rariRewardsDistributorDelegator, stakingTokenWrapperRari, tribe } = contracts; - // 2. Harvest Rari staking token wrapper + // 1. Harvest Rari staking token wrapper const delegatorBalanceBeforeHarvest = await tribe.balanceOf(rariRewardsDistributorDelegator.address); await stakingTokenWrapperRari.harvest(); const delegatorBalanceAfterHarvest = await tribe.balanceOf(rariRewardsDistributorDelegator.address); expect(delegatorBalanceAfterHarvest.sub(delegatorBalanceBeforeHarvest)).to.be.bignumber.at.least(toBN(1)); - // 3. Market participant claims TRIBE rewards + // 2. Market participant claims TRIBE rewards const userBalanceBefore = await tribe.balanceOf(pool8User); await rariRewardsDistributorDelegator['claimRewards(address)'](pool8User); const userBalanceAfter = await tribe.balanceOf(pool8User); From 79e6c50a8f09b9a77b8b7855750666144585b42b Mon Sep 17 00:00:00 2001 From: thomas-waite Date: Fri, 3 Jun 2022 17:21:49 +0100 Subject: [PATCH 212/274] docs: update action comment --- proposals/description/end_tribe_incentives.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/proposals/description/end_tribe_incentives.ts b/proposals/description/end_tribe_incentives.ts index 384b576f0..f47b3c6e0 100644 --- a/proposals/description/end_tribe_incentives.ts +++ b/proposals/description/end_tribe_incentives.ts @@ -42,7 +42,7 @@ const end_tribe_incentives: ProposalDescription = { values: '0', method: 'set(uint256,uint120,address,bool)', arguments: ['3', '0', '0x0000000000000000000000000000000000000000', false], - description: 'Set Pool 3 rewards to 1 and do not overwrite or change the rewarder' + description: 'Set Pool 3 rewards to 0 and do not overwrite or change the rewarder' }, { target: 'tribalChief', From 2bfe14463a5d98dd266cf6b085694b4c81a37534 Mon Sep 17 00:00:00 2001 From: thomas-waite Date: Fri, 3 Jun 2022 18:08:11 +0100 Subject: [PATCH 213/274] docs: update incentives description --- proposals/description/end_tribe_incentives.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/proposals/description/end_tribe_incentives.ts b/proposals/description/end_tribe_incentives.ts index f47b3c6e0..67c58b23d 100644 --- a/proposals/description/end_tribe_incentives.ts +++ b/proposals/description/end_tribe_incentives.ts @@ -298,6 +298,9 @@ const end_tribe_incentives: ProposalDescription = { - Sets the allocation points of all pools effectively to 0 - Updates the reward variables of incentivised pools - Sets the amount of Tribe issued per block by the Tribal Chief to effectively zero + - Dismantle internal ACL/permission mapping of the rewardsDistributorAdmin + - Sync all AutoRewardDistributors + - Revoke TribeRoles from incentives system It also removes CREAM from the Collaterisation Oracle ` From 610c8316724a4a6a40432ed4d3983fbc38daf021 Mon Sep 17 00:00:00 2001 From: Joey Santoro Date: Fri, 3 Jun 2022 18:07:38 -0700 Subject: [PATCH 214/274] initial proposal --- proposals/dao/eth_lbp.ts | 312 +++++++++++++++++++++++++++ proposals/description/eth_lbp.ts | 78 +++++++ test/integration/proposals_config.ts | 120 ++++++----- test/integration/tests/backstop.ts | 2 +- 4 files changed, 456 insertions(+), 56 deletions(-) create mode 100644 proposals/dao/eth_lbp.ts create mode 100644 proposals/description/eth_lbp.ts diff --git a/proposals/dao/eth_lbp.ts b/proposals/dao/eth_lbp.ts new file mode 100644 index 000000000..efd8a955e --- /dev/null +++ b/proposals/dao/eth_lbp.ts @@ -0,0 +1,312 @@ +import { ethers } from 'hardhat'; +import { expect } from 'chai'; +import { + DeployUpgradeFunc, + NamedAddresses, + NamedContracts, + SetupUpgradeFunc, + TeardownUpgradeFunc, + ValidateUpgradeFunc +} from '@custom-types/types'; +import { forceEth } from '@test/integration/setup/utils'; +import { TransactionResponse } from '@ethersproject/providers'; +import { expectApprox, getImpersonatedSigner, overwriteChainlinkAggregator, time } from '@test/helpers'; +import { BigNumber } from 'ethers'; + +const toBN = ethers.BigNumber.from; + +/* + +DAO Proposal #110 + +1. Set ethToDaiLBPSwapper to be guardian Safe addresses +2. Deploy Balancer LBP and initialise auction of ETH for DAI +3. forceSwap() +4. tighten ETH redemption spread +*/ + +// LBP Swapper config +const LBP_FREQUENCY = 86400 * 2; // 2 days in seconds +const MIN_LBP_SIZE = ethers.constants.WeiPerEther.mul(500); // 500 ETH +let poolId; // auction pool id + +const fipNumber = '110'; + +const deploy: DeployUpgradeFunc = async (deployAddress: string, addresses: NamedAddresses, logging: boolean) => { + /////////// 2. Deploy the Balancer LBP swapper + // // Amounts: + // WETH: 37888449801955370645659 (95%), 37k WETH, $3,587,445 + // DAI: 187947000000000000000000 (5%), 187k DAI, $179,372.05, overfunding by ~$9k and transferring $187,947 + const BalancerLBPSwapperFactory = await ethers.getContractFactory('BalancerLBPSwapper'); + + // Oracle reports WETH price in terms of USD, so should not be inverted + // Specifically reports: 101258471470000000000, which is $101. As expected + const ethToDaiSwapper = await BalancerLBPSwapperFactory.deploy( + addresses.core, + { + _oracle: addresses.chainlinkEthUsdOracleWrapper, + _backupOracle: ethers.constants.AddressZero, + _invertOraclePrice: true, + _decimalsNormalizer: 0 + }, + LBP_FREQUENCY, + '50000000000000000', // small weight 5% + '950000000000000000', // large weight 95% + addresses.weth, + addresses.dai, + addresses.compoundDaiPCVDeposit, // send DAI to Compound DAI deposit, where it can then be dripped to PSM + MIN_LBP_SIZE // minimum size of a pool which the swapper is used against + ); + + await ethToDaiSwapper.deployed(); + logging && console.log('WETH to DAI swapper deployed to: ', ethToDaiSwapper.address); + + // 2. Create a liquidity bootstrapping pool between WETH and DAI + const lbpFactory = await ethers.getContractAt( + 'ILiquidityBootstrappingPoolFactory', + addresses.balancerLBPoolFactoryNoFee + ); + + const tx: TransactionResponse = await lbpFactory.create( + 'WETH->DAI Auction Pool', // pool name + 'apWETH-DAI', // lbp token symbol + [addresses.weth, addresses.dai], // pool contains [WETH, DAI] + [ethers.constants.WeiPerEther.mul(95).div(100), ethers.constants.WeiPerEther.mul(5).div(100)], // initial weights 5%/95% + ethers.constants.WeiPerEther.mul(30).div(10_000), // 0.3% swap fees + ethToDaiSwapper.address, // pool owner = fei protocol swapper + true + ); + + const txReceipt = await tx.wait(); + const { logs: rawLogs } = txReceipt; + const noFeeEthDaiLBPAddress = `0x${rawLogs[rawLogs.length - 1].topics[1].slice(-40)}`; + poolId = rawLogs[1].topics[1]; + + logging && console.log('LBP Pool deployed to: ', noFeeEthDaiLBPAddress); + logging && console.log('LBP Pool Id: ', poolId); + + // 3. Initialise the LBP swapper with the pool address + const tx2 = await ethToDaiSwapper.init(noFeeEthDaiLBPAddress); + await tx2.wait(); + + // 4. Deploy a lens to report the swapper value + const BPTLensFactory = await ethers.getContractFactory('BPTLens'); + const ethToDaiLensDai = await BPTLensFactory.deploy( + addresses.dai, // token reported in + noFeeEthDaiLBPAddress, // pool address + addresses.chainlinkDaiUsdOracleWrapper, // reportedOracle - DAI + addresses.chainlinkEthUsdOracleWrapper, // otherOracle - WETH + false, // feiIsReportedIn + false // feiIsOther + ); + await ethToDaiLensDai.deployTransaction.wait(); + + logging && console.log('BPTLens for DAI in swapper pool: ', ethToDaiLensDai.address); + + const ethToDaiLensEth = await BPTLensFactory.deploy( + addresses.weth, // token reported in + noFeeEthDaiLBPAddress, // pool address + addresses.chainlinkEthUsdOracleWrapper, // reportedOracle - WETH + addresses.chainlinkDaiUsdOracleWrapper, // otherOracle - DAI + false, // feiIsReportedIn + false // feiIsOther + ); + await ethToDaiLensEth.deployTransaction.wait(); + + logging && console.log('BPTLens for WETH in swapper pool: ', ethToDaiLensEth.address); + return { + ethToDaiSwapper, + ethToDaiLensDai, + ethToDaiLensEth + }; +}; + +// Do any setup necessary for running the test. +// This could include setting up Hardhat to impersonate accounts, +// ensuring contracts have a specific state, etc. +const setup: SetupUpgradeFunc = async (addresses, oldContracts, contracts, logging) => { + poolId = '0xd10386804959a121a8a487e49f45aa9f5a2eb2a00002000000000000000001f1'; + // overwrite chainlink ETH/USD oracle + const ethToDaiLBPSwapper = contracts.ethToDaiLBPSwapper; + await overwriteChainlinkAggregator(addresses.chainlinkEthUsdOracle, '250000000000', '8'); + + // invariant checks + expect(await ethToDaiLBPSwapper.tokenSpent()).to.be.equal(addresses.weth); + expect(await ethToDaiLBPSwapper.tokenReceived()).to.be.equal(addresses.dai); + expect(await ethToDaiLBPSwapper.tokenReceivingAddress()).to.be.equal(addresses.compoundDaiPCVDeposit); + + const poolTokens = await contracts.balancerVault.getPoolTokens(poolId); + expect(poolTokens.tokens[0]).to.be.equal(addresses.weth); + expect(poolTokens.tokens[1]).to.be.equal(addresses.dai); + + // LBP swapper should be empty + expect(poolTokens.balances[0]).to.be.equal('0'); + expect(poolTokens.balances[1]).to.be.equal('0'); + + // Lenses should report 0 because LBP is empty + expect(await contracts.ethToDaiLensDai.balance()).to.be.equal('0'); + expect(await contracts.ethToDaiLensEth.balance()).to.be.equal('0'); + + // Swapper should hold no tokens + expect(await contracts.weth.balanceOf(ethToDaiLBPSwapper.address)).to.be.equal('0'); + expect(await contracts.dai.balanceOf(ethToDaiLBPSwapper.address)).to.be.equal('0'); + + console.log('Starting DAI PSM dai balance [M]', (await contracts.compoundDaiPCVDeposit.balance()) / 1e24); + + await forceEth(addresses.tribalCouncilTimelock); +}; + +// Tears down any changes made in setup() that need to be +// cleaned up before doing any validation checks. +const teardown: TeardownUpgradeFunc = async (addresses, oldContracts, contracts, logging) => { + console.log(`No actions to complete in teardown for fip${fipNumber}`); +}; + +// Run any validations required on the fip using mocha or console logging +// IE check balances, check state of contracts, etc. +const validate: ValidateUpgradeFunc = async (addresses, oldContracts, contracts, logging) => { + const core = contracts.core; + poolId = '0xd10386804959a121a8a487e49f45aa9f5a2eb2a00002000000000000000001f1'; + console.log('Final DAI PSM dai balance [M]', (await contracts.compoundDaiPCVDeposit.balance()) / 1e24); + + //////////// 1. New Safe adddresses ////////////// + expect(await contracts.pcvGuardianNew.isSafeAddress(addresses.ethToDaiLBPSwapper)).to.be.true; + + ///////////// 2. WETH LBP //////////////// + await validateLBPSetup(contracts, addresses, poolId); + + // Validate SWAP_ADMIN_ROLE is under ROLE_ADMIN and that TribalCouncilTimelock has the role + expect(await core.hasRole(ethers.utils.id('SWAP_ADMIN_ROLE'), addresses.tribalCouncilTimelock)).to.be.true; + expect(await core.getRoleAdmin(ethers.utils.id('SWAP_ADMIN_ROLE'))).to.be.equal(ethers.utils.id('ROLE_ADMIN')); +}; + +const validateLBPSetup = async (contracts: NamedContracts, addresses: NamedAddresses, poolId: string) => { + const ethToDaiLBPSwapper = contracts.ethToDaiLBPSwapper; + const ethToDaiLBPPool = contracts.ethToDaiLBPPool; + + const retrievedPoolId = await ethToDaiLBPPool.getPoolId(); + expect(retrievedPoolId).to.equal(poolId); + + // expect(await ethToDaiLBPSwapper.doInvert()).to.be.equal(true); + expect(await ethToDaiLBPSwapper.isTimeStarted()).to.be.true; + expect(await ethToDaiLBPSwapper.tokenSpent()).to.equal(addresses.weth); + expect(await ethToDaiLBPSwapper.tokenReceived()).to.equal(addresses.dai); + expect(await ethToDaiLBPPool.getSwapEnabled()).to.equal(true); + // tokenSpent = WETH + // tokenReceived = DAI + // On BalancerVault, token[0] = WETH, token[1] = DAI + // Therefore, on LBPSwapper, assets[0] = WETH, assets[1] = DAI + + // 2.1 Check oracle price + const price = (await ethToDaiLBPSwapper.readOracle())[0]; // DAI price in units of WETH + console.log('price: ', price); + expect(price).to.be.bignumber.at.least(ethers.constants.WeiPerEther.mul(90)); // 90e18 + expect(price).to.be.bignumber.at.most(ethers.constants.WeiPerEther.mul(100)); // 100e18 + + // 2.2 Check relative price in pool + // Putting in 100,000 tokens of WETH, getting an amount of DAI back + const response = await ethToDaiLBPSwapper.getTokensIn(100000); // input is spent token balance, 100,000 WETH tokens + const amounts = response[1]; + expect(amounts[0]).to.be.bignumber.equal(ethers.BigNumber.from(100000)); // WETH + + // DAI/WETH price * DAI amount * 5% ~= amount + expectApprox(price.mul(100000).mul(5).div(ethers.constants.WeiPerEther).div(100), amounts[1]); // DAI + expect(amounts[1]).to.be.bignumber.at.least(toBN(1000)); // Make sure orcacle inversion is correct (i.e. not inverted) + + // 2.3 Check pool weights + const weights = await ethToDaiLBPPool.getNormalizedWeights(); + expectApprox(weights[0], ethers.constants.WeiPerEther.mul(5).div(100)); // 5% DAI + expectApprox(weights[1], ethers.constants.WeiPerEther.mul(95).div(100)); // 95% WETH + + // 2.4 Check pool info + const poolTokens = await contracts.balancerVault.getPoolTokens(poolId); + // there should be 188k DAI in the pool + expect(poolTokens.tokens[1]).to.be.equal(contracts.dai.address); // this is DAI + expect(poolTokens.balances[1]).to.be.bignumber.at.least(ethers.constants.WeiPerEther.mul(185_000)); + expect(poolTokens.balances[1]).to.be.bignumber.at.most(ethers.constants.WeiPerEther.mul(200_000)); + // there should be 37k WETH in the pool + expect(poolTokens.tokens[0]).to.be.equal(contracts.weth.address); // this is WETH + expect(poolTokens.balances[0]).to.be.equal('37888449801955370645659'); + + // Pool balances Maths: + // Total value of pool = (188k DAI * $1) + (37k WETH * $93) = $3.63M + // DAI share = 5% + // WETH share = 95% + // Expected DAI amount = $3.63M * 0.05 = ~$181k + // Expected WETH amount = $3.63M * 0.95 = ~$3.5M -> ~ ($3500k / 93) 37k WETH + + // Validate that a swap can occur + const daiWhale = '0x5d3a536e4d6dbd6114cc1ead35777bab948e3643'; + const daiWhaleSigner = await getImpersonatedSigner(daiWhale); + await forceEth(daiWhale); + + const initialUserEthBalance = await contracts.weth.balanceOf(daiWhale); + const initialUserDaiBalance = await contracts.dai.balanceOf(daiWhale); + + const amountIn = ethers.constants.WeiPerEther.mul(10_000); + await contracts.dai.connect(daiWhaleSigner).approve(addresses.balancerVault, amountIn); + await contracts.balancerVault.connect(daiWhaleSigner).swap( + { + poolId: poolId, + kind: 0, + assetIn: addresses.dai, + assetOut: addresses.weth, + amount: amountIn, + userData: '0x' + }, + { + sender: daiWhale, + fromInternalBalance: false, + recipient: daiWhale, + toInternalBalance: false + }, + 0, + '10000000000000000000000' + ); + + const postUserEthBalance = await contracts.weth.balanceOf(daiWhale); + const postUserDaiBalance = await contracts.dai.balanceOf(daiWhale); + + const daiSpent = initialUserDaiBalance.sub(postUserDaiBalance); + expect(daiSpent).to.be.bignumber.equal(amountIn); + + const ethGained = postUserEthBalance.sub(initialUserEthBalance); + expect(ethGained).to.be.bignumber.at.least(ethers.constants.WeiPerEther.mul(80)); + expect(ethGained).to.be.bignumber.at.most(ethers.constants.WeiPerEther.mul(120)); + + // Put in 10k DAI, got out 101 WETH + // Implies price of $98.5 per WETH, compared to an oracle price of $95.6 + console.log('DAI spent: ', daiSpent); + console.log('WETH gained: ', ethGained); + + await time.increase(86400 * 7); + // Perform second swap, check price goes down + await contracts.dai.connect(daiWhaleSigner).approve(addresses.balancerVault, amountIn); + await contracts.balancerVault.connect(daiWhaleSigner).swap( + { + poolId: poolId, + kind: 0, + assetIn: addresses.dai, + assetOut: addresses.weth, + amount: amountIn, + userData: '0x' + }, + { + sender: daiWhale, + fromInternalBalance: false, + recipient: daiWhale, + toInternalBalance: false + }, + 0, + '10000000000000000000000' + ); + const secondSwapWETHAmount = (await contracts.weth.balanceOf(daiWhale)).sub(postUserEthBalance); + // If price has dropped, then for the same DAI the user gets more WETH + expect(secondSwapWETHAmount).to.be.bignumber.greaterThan(ethGained); + + // Accelerate time and check ended + await time.increase(LBP_FREQUENCY); + expect(await ethToDaiLBPSwapper.isTimeEnded()).to.be.true; +}; + +export { deploy, setup, teardown, validate }; diff --git a/proposals/description/eth_lbp.ts b/proposals/description/eth_lbp.ts new file mode 100644 index 000000000..6661cbb5b --- /dev/null +++ b/proposals/description/eth_lbp.ts @@ -0,0 +1,78 @@ +import { ProposalDescription } from '@custom-types/types'; + +const eth_lbp: ProposalDescription = { + title: 'FIP-110: Reinforce PCV via ETH LBP and tighter spread', + commands: [ + { + target: 'pcvGuardianNew', + values: '0', + method: 'setSafeAddresses(address[])', + arguments: [['{ethToDaiLBPSwapper}']], + description: 'Set the ethToDai LBP swapper to be guardian Safe addresses' + }, + //////// ETH LBP //////// + { + target: 'aaveEthPCVDeposit', + values: '0', + method: 'withdraw(address,uint256)', + arguments: ['{ethToDaiLBPSwapper}', '20000000000000000000000'], + description: 'Transfer DPI from DAO timelock to the LBP swapper' + }, + { + target: 'compoundDaiPCVDeposit', + values: '0', + method: 'withdraw(address,uint256)', + arguments: ['{ethToDaiLBPSwapper}', '2000000000000000000000000'], + description: 'Withdraw 2M DAI from the CompoundPCVDeposit and transfer to the LBP pool' + }, + // Correcting the oracle needs to happen before forceSwap() + // { + // target: 'ethToDaiLBPSwapper', + // values: '0', + // method: 'setDoInvert(bool)', + // arguments: [false], + // description: 'Set the dpiToDai LBP swapper to not invert' + // }, + { + target: 'ethToDaiLBPSwapper', + values: '0', + method: 'forceSwap()', + arguments: [], + description: 'Start the auction and override the current no-op auction' + }, + { + target: 'collateralizationOracle', + values: '0', + method: 'addDeposit(address)', + arguments: ['{ethToDaiLensDai}'], + description: 'Add DAI swapper lens to the CR oracle' + }, + { + target: 'collateralizationOracle', + values: '0', + method: 'addDeposit(address)', + arguments: ['{ethToDaiLensEth}'], + description: 'Add ETH swapper lens to the CR oracle' + }, + //////// Tighten ETH PSM ////////// + { + target: 'core', + values: '0', + method: 'grantRole(bytes32,address)', + arguments: ['0x1749ca1ca3564d20da6efea465c2a5ae869a9e4b006da7035e688beb14d704e0', '{tribalCouncilTimelock}'], + description: 'Grant TribalCouncilTimelock PSM_ADMIN_ROLE so it can tighten ETH redemption spread' + }, + { + target: 'ethPSM', + values: '0', + method: 'setRedeemFee(uint256)', + arguments: ['60'], + description: 'set PSM spread to 60' + } + ], + description: ` + FIP-110: Reinforce PCV via ETH LBP and tighter spread. + ` +}; + +export default eth_lbp; diff --git a/test/integration/proposals_config.ts b/test/integration/proposals_config.ts index aab450ec0..fa61dff00 100644 --- a/test/integration/proposals_config.ts +++ b/test/integration/proposals_config.ts @@ -2,69 +2,79 @@ import { ProposalCategory, ProposalsConfigMap } from '@custom-types/types'; import repay_fuse_bad_debt from '@proposals/description/repay_fuse_bad_debt'; import register_proposal from '@proposals/description/register_proposal'; +import eth_lbp from '@proposals/description/eth_lbp'; import end_tribe_incentives from '@proposals/description/end_tribe_incentives'; const proposals: ProposalsConfigMap = { - register_proposal: { - deploy: false, // deploy flag for whether to run deploy action during e2e tests or use mainnet state + eth_lbp: { + deploy: true, // deploy flag for whether to run deploy action during e2e tests or use mainnet state totalValue: 0, // amount of ETH to send to DAO execution - proposal: register_proposal, // full proposal file, imported from '@proposals/description/fip_xx.ts' + proposal: eth_lbp, // full proposal file, imported from '@proposals/description/fip_xx.ts' proposalId: '', - affectedContractSignoff: ['core'], + affectedContractSignoff: [], deprecatedContractSignoff: [], category: ProposalCategory.TC - }, - repay_fuse_bad_debt: { - deploy: false, // deploy flag for whether to run deploy action during e2e tests or use mainnet state - totalValue: 0, // amount of ETH to send to DAO execution - proposal: repay_fuse_bad_debt, // full proposal file, imported from '@proposals/description/fip_xx.ts' - proposalId: '', - affectedContractSignoff: ['core', 'fuseFixer', 'pcvGuardianNew'], - deprecatedContractSignoff: [], - category: ProposalCategory.TC - }, - end_tribe_incentives: { - deploy: false, // deploy flag for whether to run deploy action during e2e tests or use mainnet state - totalValue: 0, // amount of ETH to send to DAO execution - proposal: end_tribe_incentives, // full proposal file, imported from '@proposals/description/fip_xx.ts' - proposalId: '', - affectedContractSignoff: [ - 'core', - 'tribalChief', - 'tribalCouncilTimelock', - 'collateralizationOracle', - 'opsOptimisticTimelock' - ], - deprecatedContractSignoff: [ - 'creamDepositWrapper', - 'fei3CrvAutoRewardsDistributor', - 'd3AutoRewardsDistributor', - 'autoRewardsDistributor', - 'feiDaiAutoRewardsDistributor', - 'feiUsdcAutoRewardsDistributor', - 'stakingTokenWrapperRari', - 'stakingTokenWrapperFOXLaaS', - 'stakingTokenWrapperGROLaaS', - 'stakingTokenWrapperKYLINLaaS', - 'stakingTokenWrapperMStableLaaS', - 'stakingTokenWrapperNEARLaaS', - 'stakingTokenWrapperPoolTogetherLaaS', - 'stakingTokenWrapperUMALaaS', - 'stakingTokenWrapperSYNLaaS', - 'rewardsDistributorAdmin', - 'stwBulkHarvest', - 'stakingTokenWrapperBribeD3pool', - 'fei3CrvStakingtokenWrapper', - 'feiDaiStakingTokenWrapper', - 'feiUsdcStakingTokenWrapper', - 'stakingTokenWrapperBribe3Crvpool', - 'tribalChiefSyncV2', - 'tribalChiefSyncExtension', - 'd3StakingTokenWrapper', - 'votiumBriberD3pool' - ], - category: ProposalCategory.TC } + // register_proposal: { + // deploy: false, // deploy flag for whether to run deploy action during e2e tests or use mainnet state + // totalValue: 0, // amount of ETH to send to DAO execution + // proposal: register_proposal, // full proposal file, imported from '@proposals/description/fip_xx.ts' + // proposalId: '', + // affectedContractSignoff: ['core'], + // deprecatedContractSignoff: [], + // category: ProposalCategory.TC + // }, + // repay_fuse_bad_debt: { + // deploy: false, // deploy flag for whether to run deploy action during e2e tests or use mainnet state + // totalValue: 0, // amount of ETH to send to DAO execution + // proposal: repay_fuse_bad_debt, // full proposal file, imported from '@proposals/description/fip_xx.ts' + // proposalId: '', + // affectedContractSignoff: ['core', 'fuseFixer', 'pcvGuardianNew'], + // deprecatedContractSignoff: [], + // category: ProposalCategory.TC + // }, + // end_tribe_incentives: { + // deploy: false, // deploy flag for whether to run deploy action during e2e tests or use mainnet state + // totalValue: 0, // amount of ETH to send to DAO execution + // proposal: end_tribe_incentives, // full proposal file, imported from '@proposals/description/fip_xx.ts' + // proposalId: '', + // affectedContractSignoff: [ + // 'core', + // 'tribalChief', + // 'tribalCouncilTimelock', + // 'collateralizationOracle', + // 'opsOptimisticTimelock' + // ], + // deprecatedContractSignoff: [ + // 'creamDepositWrapper', + // 'fei3CrvAutoRewardsDistributor', + // 'd3AutoRewardsDistributor', + // 'autoRewardsDistributor', + // 'feiDaiAutoRewardsDistributor', + // 'feiUsdcAutoRewardsDistributor', + // 'stakingTokenWrapperRari', + // 'stakingTokenWrapperFOXLaaS', + // 'stakingTokenWrapperGROLaaS', + // 'stakingTokenWrapperKYLINLaaS', + // 'stakingTokenWrapperMStableLaaS', + // 'stakingTokenWrapperNEARLaaS', + // 'stakingTokenWrapperPoolTogetherLaaS', + // 'stakingTokenWrapperUMALaaS', + // 'stakingTokenWrapperSYNLaaS', + // 'rewardsDistributorAdmin', + // 'stwBulkHarvest', + // 'stakingTokenWrapperBribeD3pool', + // 'fei3CrvStakingtokenWrapper', + // 'feiDaiStakingTokenWrapper', + // 'feiUsdcStakingTokenWrapper', + // 'stakingTokenWrapperBribe3Crvpool', + // 'tribalChiefSyncV2', + // 'tribalChiefSyncExtension', + // 'd3StakingTokenWrapper', + // 'votiumBriberD3pool' + // ], + // category: ProposalCategory.TC + // } }; export default proposals; diff --git a/test/integration/tests/backstop.ts b/test/integration/tests/backstop.ts index 9988b00cd..76124a5f5 100644 --- a/test/integration/tests/backstop.ts +++ b/test/integration/tests/backstop.ts @@ -44,7 +44,7 @@ describe('e2e-backstop', function () { doLogging && console.log(`Environment loaded.`); }); - describe('TribeMinter', async function () { + describe.only('TribeMinter', async function () { it('mint TRIBE', async function () { const { tribeMinter, tribe } = contracts; const tribeSupply = await tribe.totalSupply(); From 3e0e22d9f64e5c853adc3757603ed58b47e288af Mon Sep 17 00:00:00 2001 From: Caleb Date: Sun, 5 Jun 2022 01:44:37 -0700 Subject: [PATCH 215/274] nix dependencies things --- protocol-configuration/dependencies.ts | 856 ------------------------- test/integration/tests/dependencies.ts | 186 ------ 2 files changed, 1042 deletions(-) delete mode 100644 protocol-configuration/dependencies.ts delete mode 100644 test/integration/tests/dependencies.ts diff --git a/protocol-configuration/dependencies.ts b/protocol-configuration/dependencies.ts deleted file mode 100644 index 0a4175391..000000000 --- a/protocol-configuration/dependencies.ts +++ /dev/null @@ -1,856 +0,0 @@ -import { DependencyMap } from '../types/types'; - -const dependencies: DependencyMap = { - angleDelegatorPCVDeposit: { - contractDependencies: ['core', 'gaugeLensAgEurUniswapGauge'] - }, - gaugeLensAgEurUniswapGauge: { - contractDependencies: ['angleDelegatorPCVDeposit', 'uniswapLensAgEurUniswapGauge'] - }, - uniswapLensAgEurUniswapGauge: { - contractDependencies: ['core', 'gaugeLensAgEurUniswapGauge', 'chainlinkEurUsdOracleWrapper'] - }, - collateralizationOracleGuardian: { - contractDependencies: ['core', 'guardian', 'collateralizationOracleWrapper'] - }, - restrictedPermissions: { - contractDependencies: ['fei', 'core'] - }, - rariInfraTribeTimelock: { - contractDependencies: ['tribe'] - }, - rariInfraFeiTimelock: { - contractDependencies: ['fei'] - }, - laTribuFeiTimelock: { - contractDependencies: ['fei'] - }, - laTribuTribeTimelock: { - contractDependencies: ['tribe'] - }, - fuseFixer: { - contractDependencies: ['core', 'pcvGuardianNew'] - }, - core: { - contractDependencies: [ - 'fuseFixer', - 'raiPriceBoundPSM', - 'raiPCVDripController', - 'collateralizationOracleGuardian', - 'fei', - 'feiTribeLBPSwapper', - 'dpiToDaiLBPSwapper', - 'optimisticMinter', - 'pcvEquityMinter', - 'pcvGuardianNew', - 'ratioPCVControllerV2', - 'tribe', - 'tribeMinter', - 'feiDAOTimelock', - 'guardian', - 'optimisticTimelock', - 'aaveEthPCVDripController', - 'bammDeposit', - 'daiPCVDripController', - 'ethPSM', - 'lusdPSM', - 'daiFixedPricePSM', - 'lusdPCVDripController', - 'lusdPSMFeiSkimmer', - 'ethPSMFeiSkimmer', - 'tribeReserveStabilizer', - 'aaveEthPCVDeposit', - 'aaveFeiPCVDeposit', - 'agEurAngleUniswapPCVDeposit', - 'agEurUniswapPCVDeposit', - 'balancerDepositBalWeth', - 'compoundDaiPCVDeposit', - 'compoundEthPCVDeposit', - 'd3poolConvexPCVDeposit', - 'd3poolCurvePCVDeposit', - 'ethLidoPCVDeposit', - 'ethTokemakPCVDeposit', - 'feiLusdLBPSwapper', - 'indexCoopFusePoolDpiPCVDeposit', - 'indexCoopFusePoolFeiPCVDeposit', - 'indexDelegator', - 'poolPartyFeiPCVDeposit', - 'rariTimelock', - 'rariPool18FeiPCVDeposit', - 'rariPool19FeiPCVDeposit', - 'rariPool22FeiPCVDeposit', - 'rariPool24FeiPCVDeposit', - 'rariPool26FeiPCVDeposit', - 'rariPool27FeiPCVDeposit', - 'rariPool54FeiPCVDeposit', - 'rariPool6FeiPCVDeposit', - 'rariPool79FeiPCVDeposit', - 'rariPool7FeiPCVDeposit', - 'rariPool7LusdPCVDeposit', - 'rariPool8FeiPCVDeposit', - 'rariPool91FeiPCVDeposit', - 'rariPool9FeiPCVDeposit', - 'reflexerStableAssetFusePoolRaiPCVDeposit', - 'tokeTokemakPCVDeposit', - 'uniswapPCVDeposit', - 'collateralizationOracle', - 'collateralizationOracleWrapper', - 'namedStaticPCVDepositWrapper', - 'balUsdCompositeOracle', - 'chainlinkBALEthOracle', - 'chainlinkCREAMEthOracle', - 'chainlinkDaiUsdOracleWrapper', - 'chainlinkDpiUsdOracleWrapper', - 'chainlinkEthUsdOracleWrapper', - 'chainlinkEurUsdOracleWrapper', - 'chainlinkFeiEthOracleWrapper', - 'chainlinkLUSDOracleWrapper', - 'chainlinkRaiEthOracleWrapper', - 'chainlinkRaiUsdCompositeOracle', - 'chainlinkTribeEthOracleWrapper', - 'compositeOracle', - 'creamUsdCompositeOracle', - 'oneConstantOracle', - 'tribeUsdCompositeOracle', - 'zeroConstantOracle', - 'collateralizationOracleKeeper', - 'erc20Dripper', - 'tribalChief', - 'fuseAdmin', - 'fuseGuardian', - 'restrictedPermissions', - 'balancerDepositFeiWeth', - 'delayedPCVMoverWethUniToBal', - 'angleDelegatorPCVDeposit', - 'uniswapLensAgEurUniswapGauge', - 'veBalDelegatorPCVDeposit', - 'uniswapLensAgEurUniswapGauge', - 'governanceMetadataRegistry', - 'nopeDAO', - 'podAdminGateway', - 'podFactory', - 'roleBastion', - 'daiFixedPricePSMFeiSkimmer', - 'balancerGaugeStaker' - ] - }, - fei: { - contractDependencies: [ - 'raiPriceBoundPSM', - 'raiPCVDripController', - 'core', - 'rariPool8Fei', - 'feiDAOTimelock', - 'collateralizationOracleKeeper', - 'aaveEthPCVDripController', - 'ethPSM', - 'lusdPSM', - 'daiFixedPricePSM', - 'daiPCVDripController', - 'lusdPSMFeiSkimmer', - 'aaveFeiPCVDeposit', - 'agEurAngleUniswapPCVDeposit', - 'indexCoopFusePoolFeiPCVDeposit', - 'poolPartyFeiPCVDeposit', - 'rariPool18FeiPCVDeposit', - 'rariPool19FeiPCVDeposit', - 'rariPool22FeiPCVDeposit', - 'rariPool24FeiPCVDeposit', - 'rariPool26FeiPCVDeposit', - 'rariPool27FeiPCVDeposit', - 'rariPool54FeiPCVDeposit', - 'rariPool6FeiPCVDeposit', - 'rariPool79FeiPCVDeposit', - 'rariPool7FeiPCVDeposit', - 'rariPool8FeiPCVDeposit', - 'rariPool91FeiPCVDeposit', - 'rariPool9FeiPCVDeposit', - 'restrictedPermissions', - 'ethPSMFeiSkimmer', - 'rariInfraFeiTimelock', - 'reptbRedeemer', - 'laTribuFeiTimelock', - 'voltFeiSwapContract' - ] - }, - ethPSMFeiSkimmer: { - contractDependencies: ['fei', 'ethPSM', 'core'] - }, - lusdPSMFeiSkimmer: { - contractDependencies: ['fei', 'lusdPSM', 'core'] - }, - feiTribeLBPSwapper: { - contractDependencies: ['core', 'pcvEquityMinter'] - }, - optimisticMinter: { - contractDependencies: ['core', 'optimisticTimelock'] - }, - pcvEquityMinter: { - contractDependencies: ['core', 'collateralizationOracleWrapper', 'feiTribeLBPSwapper'] - }, - pcvGuardianNew: { - contractDependencies: [ - 'core', - 'guardian', - 'feiDAOTimelock', - 'ethPSM', - 'lusdPSM', - 'daiFixedPricePSM', - 'compoundEthPCVDeposit', - 'aaveEthPCVDeposit', - 'raiPriceBoundPSM', - 'fuseFixer' - ] - }, - raiPriceBoundPSM: { - contractDependencies: ['core', 'fei', 'raiPCVDripController', 'pcvGuardianNew'] - }, - proxyAdmin: { - contractDependencies: [ - 'feiDAOTimelock', - 'aaveTribeIncentivesController', - 'tribalChief', - 'collateralizationOracleWrapper' - ] - }, - ratioPCVControllerV2: { - contractDependencies: ['core', 'delayedPCVMoverWethUniToBal'] - }, - tribe: { - contractDependencies: [ - 'core', - 'rariPool8Tribe', - 'feiDAO', - 'tribeRariDAO', - 'erc20Dripper', - 'aaveTribeIncentivesController', - 'tribeMinter', - 'tribeReserveStabilizer', - 'rariPool8Fei3Crv', - 'rariPool8d3', - 'rariInfraTribeTimelock', - 'pegExchanger', - 'laTribuTribeTimelock', - 'nopeDAO' - ] - }, - tribeMinter: { - contractDependencies: ['core', 'tribeReserveStabilizer', 'tribe', 'erc20Dripper', 'feiDAOTimelock' /* Owner */] - }, - feiDAO: { - contractDependencies: ['feiDAOTimelock', 'tribe'] - }, - feiDAOTimelock: { - contractDependencies: [ - 'core', - 'feiDAO', - 'fei', - 'proxyAdmin', - 'wethDepositWrapper', - 'agEurDepositWrapper', - 'aaveTribeIncentivesController', - 'tribeMinter', - 'timelock', - 'pcvGuardianNew', - 'pegExchanger', - 'voltFeiSwapContract', - 'voltDepositWrapper' - ] - }, - guardian: { - contractDependencies: ['core', 'collateralizationOracleGuardian', 'pcvGuardianNew', 'fuseGuardian', 'fuseAdmin'] - }, - optimisticMultisig: { - contractDependencies: ['optimisticTimelock'] - }, - opsOptimisticTimelock: { - contractDependencies: ['votiumBriber3Crvpool'] - }, - optimisticTimelock: { - contractDependencies: [ - 'core', - 'rariPool8Comptroller', - 'optimisticMultisig', - 'optimisticMinter', - 'tribalChief', - 'collateralizationOracle', - 'collateralizationOracleWrapper', - 'namedStaticPCVDepositWrapper', - 'rariPool8MasterOracle' - ] - }, - rariTimelock: { - contractDependencies: ['tribeRariDAO', 'core'] - }, - tribeRariDAO: { - contractDependencies: ['rariTimelock', 'tribe'] - }, - aaveEthPCVDripController: { - contractDependencies: ['core', 'fei', 'aaveEthPCVDeposit', 'ethPSM'] - }, - daiPCVDripController: { - contractDependencies: ['core', 'fei', 'daiFixedPricePSM', 'compoundDaiPCVDeposit'] - }, - raiPCVDripController: { - contractDependencies: ['core', 'fei', 'raiPriceBoundPSM'] - }, - daiFixedPricePSM: { - contractDependencies: [ - 'core', - 'fei', - 'compoundDaiPCVDeposit', - 'daiPCVDripController', - 'chainlinkDaiUsdOracleWrapper', - 'pcvGuardianNew' - ] - }, - lusdPSM: { - contractDependencies: [ - 'core', - 'fei', - 'bammDeposit', - 'chainlinkLUSDOracleWrapper', - 'pcvGuardianNew', - 'lusdPCVDripController', - 'lusdPSMFeiSkimmer' - ] - }, - lusdPCVDripController: { - contractDependencies: ['lusdPSM', 'core', 'bammDeposit'] - }, - bammDeposit: { - contractDependencies: ['lusdPSM', 'core', 'lusdPCVDripController'] - }, - ethPSM: { - contractDependencies: [ - 'core', - 'fei', - 'aaveEthPCVDeposit', - 'chainlinkEthUsdOracleWrapper', - 'pcvGuardianNew', - 'aaveEthPCVDripController', - 'ethPSMRouter', - 'ethPSMFeiSkimmer' - ] - }, - ethPSMRouter: { - contractDependencies: ['ethPSM'] - }, - tribeReserveStabilizer: { - contractDependencies: ['core', 'tribeUsdCompositeOracle', 'tribeMinter', 'collateralizationOracleWrapper', 'tribe'] - }, - aaveEthPCVDeposit: { - contractDependencies: ['core', 'aaveEthPCVDripController', 'pcvGuardianNew', 'ethPSM'] - }, - aaveFeiPCVDeposit: { - contractDependencies: ['core', 'fei'] - }, - agEurAngleUniswapPCVDeposit: { - contractDependencies: ['core', 'fei', 'chainlinkEurUsdOracleWrapper'] - }, - agEurUniswapPCVDeposit: { - contractDependencies: ['core', 'chainlinkEurUsdOracleWrapper'] - }, - balancerDepositBalWeth: { - contractDependencies: ['core', 'balUsdCompositeOracle', 'chainlinkEthUsdOracleWrapper'] - }, - compoundDaiPCVDeposit: { - contractDependencies: ['core', 'daiPCVDripController', 'daiFixedPricePSM'] - }, - compoundEthPCVDeposit: { - contractDependencies: ['core', 'pcvGuardianNew'] - }, - d3poolConvexPCVDeposit: { - contractDependencies: ['core'] - }, - d3poolCurvePCVDeposit: { - contractDependencies: ['core'] - }, - ethLidoPCVDeposit: { - contractDependencies: ['core'] - }, - ethTokemakPCVDeposit: { - contractDependencies: ['core'] - }, - feiLusdLBPSwapper: { - contractDependencies: ['core', 'chainlinkLUSDOracleWrapper'] - }, - indexCoopFusePoolDpiPCVDeposit: { - contractDependencies: ['core'] - }, - indexCoopFusePoolFeiPCVDeposit: { - contractDependencies: ['core', 'fei'] - }, - indexDelegator: { - contractDependencies: ['core'] - }, - poolPartyFeiPCVDeposit: { - contractDependencies: ['core', 'fei'] - }, - rariPool146Comptroller: { - contractDependencies: ['rariPool146FuseAdmin', 'rariPool146Eth'] - }, - rariPool146FuseAdmin: { - contractDependencies: ['rariPool146Comptroller'] - }, - rariPool146Eth: { - contractDependencies: ['rariPool146Comptroller'] - }, - rariPool18FeiPCVDeposit: { - contractDependencies: ['core', 'fei'] - }, - rariPool19FeiPCVDeposit: { - contractDependencies: ['core', 'fei'] - }, - rariPool22FeiPCVDeposit: { - contractDependencies: ['core', 'fei', 'rariPool22FeiPCVDepositWrapper'] - }, - rariPool24FeiPCVDeposit: { - contractDependencies: ['core', 'fei'] - }, - rariPool26FeiPCVDeposit: { - contractDependencies: ['core', 'fei'] - }, - rariPool27FeiPCVDeposit: { - contractDependencies: ['core', 'fei'] - }, - rariPool54FeiPCVDeposit: { - contractDependencies: ['core', 'fei'] - }, - rariPool6FeiPCVDeposit: { - contractDependencies: ['core', 'fei'] - }, - rariPool79FeiPCVDeposit: { - contractDependencies: ['core', 'fei', 'rariPool79FeiPCVDepositWrapper'] - }, - rariPool7FeiPCVDeposit: { - contractDependencies: ['core', 'fei'] - }, - rariPool7LusdPCVDeposit: { - contractDependencies: ['core'] - }, - rariPool8FeiPCVDeposit: { - contractDependencies: ['core', 'rariPool8Fei', 'fei'] - }, - rariPool91FeiPCVDeposit: { - contractDependencies: ['core', 'fei'] - }, - rariPool9FeiPCVDeposit: { - contractDependencies: ['core', 'fei'] - }, - reflexerStableAssetFusePoolRaiPCVDeposit: { - contractDependencies: ['core'] - }, - tokeTokemakPCVDeposit: { - contractDependencies: ['core'] - }, - uniswapPCVDeposit: { - contractDependencies: ['core', 'chainlinkEthUsdOracleWrapper'] - }, - aaveEthPCVDepositWrapper: { - contractDependencies: ['collateralizationOracle'] - }, - aaveFeiPCVDepositWrapper: { - contractDependencies: ['collateralizationOracle'] - }, - collateralizationOracle: { - contractDependencies: [ - 'core', - 'optimisticTimelock', - 'balUsdCompositeOracle', - 'chainlinkDaiUsdOracleWrapper', - 'chainlinkDpiUsdOracleWrapper', - 'chainlinkEthUsdOracleWrapper', - 'chainlinkEurUsdOracleWrapper', - 'chainlinkLUSDOracleWrapper', - 'chainlinkRaiUsdCompositeOracle', - 'creamUsdCompositeOracle', - 'oneConstantOracle', - 'zeroConstantOracle', - 'aaveEthPCVDepositWrapper', - 'aaveFeiPCVDepositWrapper', - 'compoundDaiPCVDepositWrapper', - 'compoundEthPCVDepositWrapper', - 'wethDepositWrapper', - 'agEurDepositWrapper', - 'ethLidoPCVDepositWrapper', - 'feiBuybackLens', - 'feiLusdLens', - 'feiOATimelockWrapper', - 'rariPool19FeiPCVDepositWrapper', - 'rariPool24FeiPCVDepositWrapper', - 'rariPool6FeiPCVDepositWrapper', - 'rariPool79FeiPCVDepositWrapper', - 'rariPool128FeiPCVDepositWrapper', - 'rariPool22FeiPCVDepositWrapper', - 'voltFusePCVDeposit', - 'voltOracle', - 'turboFusePCVDeposit', - 'voltDepositWrapper' - ] - }, - collateralizationOracleWrapper: { - contractDependencies: [ - 'core', - 'optimisticTimelock', - 'collateralizationOracleKeeper', - 'collateralizationOracleGuardian', - 'collateralizationOracleWrapperImpl', - 'tribeReserveStabilizer', - 'pcvEquityMinter', - 'proxyAdmin' - ] - }, - collateralizationOracleWrapperImpl: { - contractDependencies: ['collateralizationOracleWrapper'] - }, - compoundDaiPCVDepositWrapper: { - contractDependencies: ['collateralizationOracle'] - }, - compoundEthPCVDepositWrapper: { - contractDependencies: ['collateralizationOracle'] - }, - wethDepositWrapper: { - contractDependencies: ['feiDAOTimelock', 'collateralizationOracle'] - }, - agEurDepositWrapper: { - contractDependencies: ['feiDAOTimelock', 'collateralizationOracle'] - }, - ethLidoPCVDepositWrapper: { - contractDependencies: ['collateralizationOracle'] - }, - feiBuybackLens: { - contractDependencies: ['collateralizationOracle'] - }, - feiLusdLens: { - contractDependencies: ['collateralizationOracle'] - }, - feiOATimelockWrapper: { - contractDependencies: ['collateralizationOracle'] - }, - rariPool19FeiPCVDepositWrapper: { - contractDependencies: ['collateralizationOracle'] - }, - rariPool24FeiPCVDepositWrapper: { - contractDependencies: ['collateralizationOracle'] - }, - rariPool6FeiPCVDepositWrapper: { - contractDependencies: ['collateralizationOracle'] - }, - rariPool79FeiPCVDepositWrapper: { - contractDependencies: ['collateralizationOracle', 'rariPool79FeiPCVDeposit'] - }, - rariPool128FeiPCVDeposit: { - contractDependencies: ['rariPool128FeiPCVDepositWrapper'] - }, - rariPool128FeiPCVDepositWrapper: { - contractDependencies: ['collateralizationOracle', 'rariPool128FeiPCVDeposit'] - }, - rariPool22FeiPCVDepositWrapper: { - contractDependencies: ['collateralizationOracle', 'rariPool22FeiPCVDeposit'] - }, - namedStaticPCVDepositWrapper: { - contractDependencies: ['core', 'optimisticTimelock'] - }, - balUsdCompositeOracle: { - contractDependencies: [ - 'core', - 'chainlinkBALEthOracle', - 'chainlinkEthUsdOracleWrapper', - 'collateralizationOracle', - 'balancerDepositBalWeth', - 'balancerLensVeBalBal', - 'balancerLensVeBalWeth' - ] - }, - balancerLensVeBalBal: { - contractDependencies: ['balUsdCompositeOracle', 'chainlinkEthUsdOracleWrapper'] - }, - chainlinkBALEthOracle: { - contractDependencies: ['core', 'balUsdCompositeOracle'] - }, - chainlinkCREAMEthOracle: { - contractDependencies: ['core', 'creamUsdCompositeOracle'] - }, - chainlinkDaiUsdOracleWrapper: { - contractDependencies: ['core', 'collateralizationOracle', 'daiFixedPricePSM'] - }, - chainlinkDpiUsdOracleWrapper: { - contractDependencies: ['core', 'collateralizationOracle'] - }, - chainlinkEthUsdOracleWrapper: { - contractDependencies: [ - 'core', - 'ethPSM', - 'compositeOracle', - 'tribeUsdCompositeOracle', - 'chainlinkRaiUsdCompositeOracle', - 'creamUsdCompositeOracle', - 'balUsdCompositeOracle', - 'collateralizationOracle', - 'uniswapPCVDeposit', - 'balancerDepositBalWeth', - 'balancerDepositFeiWeth', - 'balancerLensBpt30Fei70Weth', - 'balancerLensVeBalBal', - 'balancerLensVeBalWeth' - ] - }, - chainlinkEurUsdOracleWrapper: { - contractDependencies: [ - 'core', - 'collateralizationOracle', - 'agEurAngleUniswapPCVDeposit', - 'agEurUniswapPCVDeposit', - 'uniswapLensAgEurUniswapGauge' - ] - }, - chainlinkFeiEthOracleWrapper: { - contractDependencies: ['core'] - }, - chainlinkLUSDOracleWrapper: { - contractDependencies: ['core', 'collateralizationOracle', 'feiLusdLBPSwapper', 'lusdPSM'] - }, - chainlinkRaiEthOracleWrapper: { - contractDependencies: ['core', 'chainlinkRaiUsdCompositeOracle'] - }, - chainlinkRaiUsdCompositeOracle: { - contractDependencies: [ - 'core', - 'chainlinkEthUsdOracleWrapper', - 'chainlinkRaiEthOracleWrapper', - 'collateralizationOracle' - ] - }, - chainlinkTribeEthOracleWrapper: { - contractDependencies: ['core', 'tribeUsdCompositeOracle', 'compositeOracle'] - }, - compositeOracle: { - contractDependencies: ['core', 'chainlinkEthUsdOracleWrapper', 'chainlinkTribeEthOracleWrapper'] - }, - creamUsdCompositeOracle: { - contractDependencies: ['core', 'chainlinkEthUsdOracleWrapper', 'chainlinkCREAMEthOracle', 'collateralizationOracle'] - }, - oneConstantOracle: { - contractDependencies: ['core', 'collateralizationOracle', 'balancerDepositFeiWeth', 'balancerLensBpt30Fei70Weth'] - }, - tribeUsdCompositeOracle: { - contractDependencies: [ - 'core', - 'chainlinkTribeEthOracleWrapper', - 'chainlinkEthUsdOracleWrapper', - 'tribeReserveStabilizer' - ] - }, - zeroConstantOracle: { - contractDependencies: ['core', 'collateralizationOracle'] - }, - collateralizationOracleKeeper: { - contractDependencies: ['core', 'collateralizationOracleWrapper', 'fei'] - }, - aaveTribeIncentivesController: { - contractDependencies: ['aaveTribeIncentivesControllerImpl', 'tribe', 'feiDAOTimelock', 'proxyAdmin'] // NOTE uses old timelock - }, - aaveTribeIncentivesControllerImpl: { - contractDependencies: ['aaveTribeIncentivesController'] - }, - erc20Dripper: { - contractDependencies: ['core', 'tribe', 'tribalChief', 'tribeMinter'] - }, - balancerGaugeStaker: { - contractDependencies: ['core'] - }, - rariRewardsDistributorDelegate: { - contractDependencies: [ - 'rariRewardsDistributorDelegator' // proxy - ] - }, - rariRewardsDistributorDelegator: { - contractDependencies: [ - 'rariPool8Tribe', - 'rariRewardsDistributorDelegate', // impl - 'rariPool8Comptroller', - 'rariPool8Fei3Crv', - 'rariPool8d3' - ] - }, - tribalChief: { - contractDependencies: ['core', 'optimisticTimelock', 'erc20Dripper', 'tribalChiefImpl', 'proxyAdmin'] - }, - tribalChiefImpl: { - contractDependencies: ['tribalChief'] - }, - votiumBriber3Crvpool: { - contractDependencies: ['opsOptimisticTimelock'] - }, - rariPool8Comptroller: { - contractDependencies: [ - 'rariPool8Dai', - 'rariPool8Eth', - 'rariPool8Fei', - 'rariPool8Tribe', - 'rariPool8Lusd', - 'rariRewardsDistributorDelegator', // registered rewards distributor - 'optimisticTimelock', // admin - 'rariPool8MasterOracle', - 'fuseGuardian', - 'fuseAdmin', - 'rariPool8Fei3Crv', - 'rariPool8d3' - ] - }, - fuseAdmin: { - contractDependencies: ['core', 'rariPool8Comptroller', 'guardian'] - }, - fuseGuardian: { - contractDependencies: ['core', 'rariPool8Comptroller', 'guardian'] - }, - rariPool8MasterOracle: { - contractDependencies: ['gUniFuseOracle', 'optimisticTimelock', 'rariPool8Comptroller', 'curveLPTokenOracle'] - }, - gUniFuseOracle: { - contractDependencies: ['rariPool8MasterOracle'] - }, - curveLPTokenOracle: { - contractDependencies: ['rariPool8MasterOracle'] - }, - rariPool8Dai: { - contractDependencies: ['rariPool8Comptroller', 'rariPool8DaiIrm'] - }, - rariPool8DaiIrm: { - contractDependencies: ['rariPool8Dai'] - }, - rariPool8Eth: { - contractDependencies: ['rariPool8Comptroller', 'rariPool8EthIrm'] - }, - rariPool8EthIrm: { - contractDependencies: ['rariPool8Eth'] - }, - rariPool8Fei: { - contractDependencies: ['fei', 'rariPool8Comptroller', 'rariPool8FeiIrm', 'rariPool8FeiPCVDeposit'] - }, - rariPool8FeiIrm: { - contractDependencies: ['rariPool8Fei'] - }, - rariPool8CTokenImpl: { - contractDependencies: ['rariPool8Fei3Crv', 'rariPool8d3'] - }, - rariPool8Fei3Crv: { - contractDependencies: ['rariPool8CTokenImpl', 'tribe', 'rariPool8Comptroller', 'rariRewardsDistributorDelegator'] - }, - rariPool8d3: { - contractDependencies: ['rariPool8CTokenImpl', 'tribe', 'rariPool8Comptroller', 'rariRewardsDistributorDelegator'] - }, - rariPool8Tribe: { - contractDependencies: [ - 'tribe', - 'rariPool8Comptroller', - 'rariPool8TribeIrm', - 'rariRewardsDistributorDelegator' // Drips TRIBE rewards - ] - }, - rariPool8TribeIrm: { - contractDependencies: ['rariPool8Tribe'] - }, - reptbRedeemer: { - contractDependencies: ['fei'] - }, - pegExchanger: { - contractDependencies: ['tribe', 'feiDAOTimelock'] - }, - bbRedeemer: { - contractDependencies: [] - }, - idleRedeemer: { - contractDependencies: [] - }, - idleTranchesRedeemer: { - contractDependencies: [] - }, - kashiRedeemer: { - contractDependencies: [] - }, - weightedBalancerPoolManagerBase: { - contractDependencies: [] - }, - rariChainlinkPriceOracleV3: { - contractDependencies: [] - }, - balancerDepositFeiWeth: { - contractDependencies: ['core', 'oneConstantOracle', 'chainlinkEthUsdOracleWrapper'] - }, - delayedPCVMoverWethUniToBal: { - contractDependencies: ['core', 'ratioPCVControllerV2'] - }, - rariPool8Lusd: { - contractDependencies: ['rariPool8Comptroller'] - }, - timelock: { - contractDependencies: ['feiDAOTimelock'] - }, - roleBastion: { - contractDependencies: ['core'] - }, - podFactory: { - contractDependencies: ['core', 'podExecutor', 'podAdminGateway'] - }, - podAdminGateway: { - contractDependencies: ['core', 'podFactory', 'tribalCouncilTimelock'] - }, - podExecutor: { - contractDependencies: ['podFactory', 'tribalCouncilTimelock'] - }, - nopeDAO: { - contractDependencies: ['core', 'tribe'] - }, - governanceMetadataRegistry: { - contractDependencies: ['core'] - }, - turboFusePCVDeposit: { - contractDependencies: ['collateralizationOracle'] - }, - voltFeiSwapContract: { - contractDependencies: ['fei', 'feiDAOTimelock'] - }, - voltDepositWrapper: { - contractDependencies: ['volt', 'feiDAOTimelock', 'collateralizationOracle', 'voltOracle'] - }, - volt: { - contractDependencies: ['voltDepositWrapper', 'voltOracle'] - }, - voltFusePCVDeposit: { - contractDependencies: ['collateralizationOracle'] - }, - voltOracle: { - contractDependencies: ['volt', 'voltDepositWrapper', 'collateralizationOracle'] - }, - tribalCouncilTimelock: { - contractDependencies: ['podExecutor', 'tribalCouncilSafe', 'podAdminGateway'] - }, - tribalCouncilSafe: { - contractDependencies: ['tribalCouncilTimelock'] - }, - veBalDelegatorPCVDeposit: { - contractDependencies: ['core'] - }, - balancerLensVeBalWeth: { - contractDependencies: ['balUsdCompositeOracle', 'chainlinkEthUsdOracleWrapper'] - }, - balancerLensBpt30Fei70Weth: { - contractDependencies: ['oneConstantOracle', 'chainlinkEthUsdOracleWrapper'] - }, - daiFixedPricePSMFeiSkimmer: { - contractDependencies: ['core'] - }, - dpiToDaiLBPSwapper: { - contractDependencies: ['core'] - }, - dpiToDaiLensDai: { - contractDependencies: [] - }, - dpiToDaiLensDpi: { - contractDependencies: [] - } -}; - -export default dependencies; diff --git a/test/integration/tests/dependencies.ts b/test/integration/tests/dependencies.ts deleted file mode 100644 index ce25a9cd3..000000000 --- a/test/integration/tests/dependencies.ts +++ /dev/null @@ -1,186 +0,0 @@ -import { expect } from 'chai'; -import { ProposalCategory, ProposalDescription } from '@custom-types/types'; -import proposals from '@test/integration/proposals_config'; -import dependencies from '@protocol/dependencies'; -import addresses from '@protocol/mainnetAddresses'; -import collateralizationAddresses from '@protocol/collateralizationOracle'; -import { AddressCategory } from '@custom-types/types'; // imported without custom path to allow docs to autogen without ts errors - -describe('e2e-dependencies', function () { - const doLogging = Boolean(process.env.LOGGING); - let proposalNames: string[]; - - before(function () { - proposalNames = Object.keys(proposals); - }); - - describe('Check Dependencies', function () { - it('are all signed off', async function () { - for (let i = 0; i < proposalNames.length; i++) { - const proposalName = proposalNames[i]; - if (proposals[proposalName].category === ProposalCategory.None || proposals[proposalName].deploy) { - // Skip if not a DAO/OA proposal or not yet deployed - doLogging && console.log(`Skipping: ${proposalName}`); - continue; - } - - const contracts = getProposalContracts(proposals[proposalName].proposal); - doLogging && console.log(`Checking proposal: ${proposalName}`); - doLogging && console.log(`Proposal affects contracts: ${contracts}`); - - for (let j = 0; j < contracts.length; j++) { - const contract = contracts[j]; - doLogging && console.log(`Contract: ${contract}`); - const category = addresses[contract].category; - if (category === AddressCategory.External) { - continue; - } - - if (category === AddressCategory.Deprecated) { - doLogging && console.log(`Checking deprecated contract: ${contract}`); - - expect(dependencies).to.not.haveOwnProperty(contract); - - // Make sure proposal config has this deprecated contract signed off - expect(proposals[proposalName].deprecatedContractSignoff).to.contain(contract); - continue; - } - - doLogging && console.log(`Checking contract: ${contract}`); - - expect(dependencies).to.haveOwnProperty(contract); - - // Make sure proposal config has this fip signed off - expect(proposals[proposalName].affectedContractSignoff).to.contain(contract); - } - } - }); - - it('all have contract category correct', async function () { - for (let i = 0; i < proposalNames.length; i++) { - const proposalName = proposalNames[i]; - const contracts = proposals[proposalName].affectedContractSignoff; - const deprecated = proposals[proposalName].deprecatedContractSignoff; - - if (proposals[proposalName].deploy) { - // Skip these checks if not mainnet deployed - doLogging && console.log(`Skipping: ${proposalName}`); - continue; - } - doLogging && console.log(`Checking proposal: ${proposalName}`); - doLogging && console.log(`Proposal affects contracts: ${contracts}`); - - for (let j = 0; j < contracts.length; j++) { - const contract = contracts[j]; - const category = addresses[contract].category; - expect(category).to.not.be.equal( - AddressCategory.External, - 'contract ' + contract + ' expected not to be External' - ); - expect(category).to.not.be.equal( - AddressCategory.Deprecated, - 'contract ' + contract + ' expected not to be Deprecated' - ); - - expect(deprecated).to.not.contain(contract); - } - - for (let j = 0; j < deprecated.length; j++) { - const contract = deprecated[j]; - const category = addresses[contract].category; - expect(category).to.be.equal(AddressCategory.Deprecated); - - expect(contracts).to.not.contain(contract); - } - } - }); - - it('collateralization oracle deposits category correct', async function () { - const tokenAddresses = Object.keys(collateralizationAddresses); - const crDeposits = []; - for (let i = 0; i < tokenAddresses.length; i++) { - const element = tokenAddresses[i]; - - const deposits = collateralizationAddresses[element]; - - for (let i = 0; i < deposits.length; i++) { - const deposit = deposits[i]; - crDeposits.push(deposit); - - doLogging && console.log(`${element} contract address: ${deposit}`); - if (addresses[deposit]) { - // addresses[deposit] may be undefined if a deposit is added to the - // dependencies and permissions/collateralizationOracle files, but - // is not yet deployed on the mainnet (i.e. in mainnetAddresses.ts). - expect(addresses[deposit].category).to.not.be.equal( - 'Deprecated', - 'Deposit [' + deposit + '] is in collateralizationoracle.ts and has AddressCategory.Deprecated' - ); - } - } - } - - const mainnetAddresses = Object.keys(addresses); - - for (let i = 0; i < mainnetAddresses.length; i++) { - const element = mainnetAddresses[i]; - - const category = addresses[element].category; - - if (category === 'PCV') { - expect(crDeposits).to.contain(element, 'expected in crDeposits'); - } - } - }); - - it('are listed bidirectionally', async function () { - const contractNames = Object.keys(dependencies); - for (let i = 0; i < contractNames.length; i++) { - const contract = contractNames[i]; - doLogging && console.log(`Checking contract: ${contract}`); - const contractDependencies = dependencies[contract].contractDependencies; - for (let j = 0; j < contractDependencies.length; j++) { - const dependency = contractDependencies[j]; - doLogging && console.log(`Checking contract dependency: ${dependency}`); - expect(dependencies).to.haveOwnProperty(dependency); - expect(dependencies[dependency].contractDependencies).to.contain(contract, 'dependencies of ' + dependency); - } - } - }); - }); -}); - -function getProposalContracts(proposal: ProposalDescription): string[] { - let contracts = []; - - for (let i = 0; i < proposal.commands.length; i++) { - const command = proposal.commands[i]; - contracts.push(command.target); - contracts = contracts.concat(getContractsFromArgs(command.arguments)); - } - - // dedup - return [...new Set(contracts)]; -} - -function getContractsFromArgs(args: any[]): string[] { - let result: string[] = []; - for (let i = 0; i < args.length; i++) { - const element = args[i]; - if (typeof element === typeof '') { - // find all contracts - let formatted: string[] = element.match(/\{\w+\}/g); - formatted = formatted || []; - - // Remove braces - formatted = formatted.map((item) => item.replace('{', '').replace('}', '')); - - result = result.concat(formatted); - } else if (typeof element === typeof []) { - // recurse through levels of array - const moreContracts: string[] = getContractsFromArgs(element); - result = result.concat(moreContracts); - } - } - return result; -} From cab0481cbcbc94e4a6939a8df98d08148d2c513a Mon Sep 17 00:00:00 2001 From: Caleb Date: Sun, 5 Jun 2022 01:54:30 -0700 Subject: [PATCH 216/274] Move proposalsConfig to protocol-configuration folder --- CODEOWNERS => .github/CODEOWNERS | 0 proposals/README.md | 6 +- .../proposalsConfig.ts | 0 scripts/utils/checkProposal.ts | 2 +- scripts/utils/constructProposalCalldata.ts | 2 +- tc.json | 1119 ----------------- test/integration/tests/backstop.ts | 2 +- .../tests/balancer-weightedpool.ts | 2 +- test/integration/tests/buybacks.ts | 2 +- .../tests/collateralizationOracle.ts | 2 +- test/integration/tests/daiFixedPricePSM.ts | 2 +- test/integration/tests/dao.ts | 2 +- test/integration/tests/dependencies.ts | 2 +- test/integration/tests/ethPSM.ts | 2 +- test/integration/tests/fei.ts | 2 +- test/integration/tests/fip-38-tokemak.ts | 2 +- test/integration/tests/fuse.ts | 2 +- test/integration/tests/lusdPSM.ts | 2 +- test/integration/tests/merger.ts.disabled | 2 +- .../tests/metagov/BalancerGaugeStaker.ts | 2 +- .../tests/metagov/GovernorVoter.ts | 2 +- .../tests/metagov/LiquidityGaugeManager.ts | 2 +- .../tests/metagov/VoteEscrowTokenManager.ts | 2 +- test/integration/tests/pcv.ts | 2 +- test/integration/tests/podOperation.ts | 2 +- test/integration/tests/psm.ts | 2 +- test/integration/tests/staking.ts | 2 +- test/integration/tests/tribalCouncil.ts | 2 +- test/integration/tests/tribalchief.ts | 2 +- test/integration/tests/tribeIncentivesEnd.ts | 2 +- test/integration/tests/turboPCVDeposit.ts | 2 +- test/integration/tests/votium-bribe.ts | 2 +- tsconfig.json | 4 +- 33 files changed, 33 insertions(+), 1152 deletions(-) rename CODEOWNERS => .github/CODEOWNERS (100%) rename test/integration/proposals_config.ts => protocol-configuration/proposalsConfig.ts (100%) delete mode 100644 tc.json diff --git a/CODEOWNERS b/.github/CODEOWNERS similarity index 100% rename from CODEOWNERS rename to .github/CODEOWNERS diff --git a/proposals/README.md b/proposals/README.md index 3cf176541..105b152bb 100644 --- a/proposals/README.md +++ b/proposals/README.md @@ -23,7 +23,7 @@ These permissiones are validated against on-chain state in the last e2e test ## Step 3: Proposal Mocking and Integration Test Write a script following the template of `proposals/dao/fip_x.js`. See below for descriptions of each of the `deploy`, `setup`,`teardown`, and `validate` functions. Only `validate` is required. -Add an object with the key `fip_x` to `end-to-end/proposals_config.ts`, +Add an object with the key `fip_x` to `end-to-end/proposalsConfig.ts`, Your proposal will be run before any integration tests via `npm run test:e2e`. Fill in the following parameters: * deploy - set to true only if you added a deploy script for your proposal in the optional step, otherwise false. This will run your deploy script before the integration tests and add the contract objects as keys in `contracts` parameter of each of the hooks. @@ -32,7 +32,7 @@ Your proposal will be run before any integration tests via `npm run test:e2e`. F ### Step 3a (Optional): deploy() - Contract Deployments: Whether a deployment of a new instance of a pre-exisiting or new contract, if your proposal requires a new contract deployment you'll need to write a deploy script. -The deploy script is automatically run before any e2e tests if the deploy flag is set to true in the `end-to-end/proposals_config.ts`. The contract objects will be present in the setup, run, teardown and validate hooks as keys in the `contracts` parameter. +The deploy script is automatically run before any e2e tests if the deploy flag is set to true in the `end-to-end/proposalsConfig.ts`. The contract objects will be present in the setup, run, teardown and validate hooks as keys in the `contracts` parameter. This is useful for fully testing the deploy script against a mainnet fork before deploying to mainnet. @@ -65,7 +65,7 @@ Run `DEPLOY_FILE=fip_x npm run deploy:fip` Run your deploy script if you had one from step 2. Update `/protocol-configuration/mainnetAddresses.ts` with the new contract addresses. -Update the fork block inside the hardhat config and set the deploy flag to false in the config entry for `fip_x` in `end-to-end/proposals_config.ts` +Update the fork block inside the hardhat config and set the deploy flag to false in the config entry for `fip_x` in `end-to-end/proposalsConfig.ts` Finally rerun `npm run test:e2e` and make sure everything passes as expected. diff --git a/test/integration/proposals_config.ts b/protocol-configuration/proposalsConfig.ts similarity index 100% rename from test/integration/proposals_config.ts rename to protocol-configuration/proposalsConfig.ts diff --git a/scripts/utils/checkProposal.ts b/scripts/utils/checkProposal.ts index 750296c59..0a2a3638c 100644 --- a/scripts/utils/checkProposal.ts +++ b/scripts/utils/checkProposal.ts @@ -1,6 +1,6 @@ import { getAllContracts, getAllContractAddresses } from '@test/integration/setup/loadContracts'; import { NamedContracts, UpgradeFuncs } from '@custom-types/types'; -import proposals from '@test/integration/proposals_config'; +import proposals from '@test/integration/proposalsConfig'; import * as dotenv from 'dotenv'; import { execProposal } from './exec'; diff --git a/scripts/utils/constructProposalCalldata.ts b/scripts/utils/constructProposalCalldata.ts index b60a26263..9cb63aac7 100644 --- a/scripts/utils/constructProposalCalldata.ts +++ b/scripts/utils/constructProposalCalldata.ts @@ -5,7 +5,7 @@ import { Interface } from '@ethersproject/abi'; import { utils } from 'ethers'; import { getAllContractAddresses, getAllContracts } from '@test/integration/setup/loadContracts'; import { ProposalCategory, ProposalDescription } from '@custom-types/types'; -import proposals from '@test/integration/proposals_config'; +import proposals from '@test/integration/proposalsConfig'; type ExtendedAlphaProposal = { targets: string[]; diff --git a/tc.json b/tc.json deleted file mode 100644 index 00047af89..000000000 --- a/tc.json +++ /dev/null @@ -1,1119 +0,0 @@ -[ - { - "inputs": [ - { - "internalType": "address", - "name": "coreAddress", - "type": "address" - } - ], - "stateMutability": "nonpayable", - "type": "constructor" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "bytes32", - "name": "oldContractAdminRole", - "type": "bytes32" - }, - { - "indexed": true, - "internalType": "bytes32", - "name": "newContractAdminRole", - "type": "bytes32" - } - ], - "name": "ContractAdminRoleUpdate", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "oldCore", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "newCore", - "type": "address" - } - ], - "name": "CoreUpdate", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "user", - "type": "address" - }, - { - "indexed": true, - "internalType": "uint256", - "name": "pid", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "amount", - "type": "uint256" - }, - { - "indexed": true, - "internalType": "uint256", - "name": "depositID", - "type": "uint256" - } - ], - "name": "Deposit", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "user", - "type": "address" - }, - { - "indexed": true, - "internalType": "uint256", - "name": "pid", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "amount", - "type": "uint256" - }, - { - "indexed": true, - "internalType": "address", - "name": "to", - "type": "address" - } - ], - "name": "EmergencyWithdraw", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "user", - "type": "address" - }, - { - "indexed": true, - "internalType": "uint256", - "name": "pid", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "name": "Harvest", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "uint256", - "name": "pid", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "allocPoint", - "type": "uint256" - }, - { - "indexed": true, - "internalType": "contract IERC20", - "name": "stakedToken", - "type": "address" - }, - { - "indexed": true, - "internalType": "contract IRewarder", - "name": "rewarder", - "type": "address" - } - ], - "name": "LogPoolAddition", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "uint256", - "name": "pid", - "type": "uint256" - }, - { - "indexed": true, - "internalType": "uint128", - "name": "lockLength", - "type": "uint128" - }, - { - "indexed": true, - "internalType": "uint256", - "name": "multiplier", - "type": "uint256" - } - ], - "name": "LogPoolMultiplier", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "uint256", - "name": "pid", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "allocPoint", - "type": "uint256" - }, - { - "indexed": true, - "internalType": "contract IRewarder", - "name": "rewarder", - "type": "address" - }, - { - "indexed": false, - "internalType": "bool", - "name": "overwrite", - "type": "bool" - } - ], - "name": "LogSetPool", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "uint256", - "name": "pid", - "type": "uint256" - }, - { - "indexed": true, - "internalType": "uint128", - "name": "lastRewardBlock", - "type": "uint128" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "lpSupply", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "accTribePerShare", - "type": "uint256" - } - ], - "name": "LogUpdatePool", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "name": "NewTribePerBlock", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "address", - "name": "account", - "type": "address" - } - ], - "name": "Paused", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "bool", - "name": "locked", - "type": "bool" - }, - { - "indexed": true, - "internalType": "uint256", - "name": "pid", - "type": "uint256" - } - ], - "name": "PoolLocked", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "name": "TribeWithdraw", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "address", - "name": "account", - "type": "address" - } - ], - "name": "Unpaused", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "user", - "type": "address" - }, - { - "indexed": true, - "internalType": "uint256", - "name": "pid", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "amount", - "type": "uint256" - }, - { - "indexed": true, - "internalType": "address", - "name": "to", - "type": "address" - } - ], - "name": "Withdraw", - "type": "event" - }, - { - "inputs": [], - "name": "CONTRACT_ADMIN_ROLE", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "SCALE_FACTOR", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "TRIBE", - "outputs": [ - { - "internalType": "contract IERC20", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint120", - "name": "allocPoint", - "type": "uint120" - }, - { - "internalType": "contract IERC20", - "name": "_stakedToken", - "type": "address" - }, - { - "internalType": "contract IRewarder", - "name": "_rewarder", - "type": "address" - }, - { - "components": [ - { - "internalType": "uint128", - "name": "lockLength", - "type": "uint128" - }, - { - "internalType": "uint128", - "name": "rewardMultiplier", - "type": "uint128" - } - ], - "internalType": "struct TribalChief.RewardData[]", - "name": "rewardData", - "type": "tuple[]" - } - ], - "name": "add", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "core", - "outputs": [ - { - "internalType": "contract ICore", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "pid", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "amount", - "type": "uint256" - }, - { - "internalType": "uint64", - "name": "lockLength", - "type": "uint64" - } - ], - "name": "deposit", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - }, - { - "internalType": "address", - "name": "", - "type": "address" - }, - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "name": "depositInfo", - "outputs": [ - { - "internalType": "uint256", - "name": "amount", - "type": "uint256" - }, - { - "internalType": "uint128", - "name": "unlockBlock", - "type": "uint128" - }, - { - "internalType": "uint128", - "name": "multiplier", - "type": "uint128" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "pid", - "type": "uint256" - }, - { - "internalType": "address", - "name": "to", - "type": "address" - } - ], - "name": "emergencyWithdraw", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "fei", - "outputs": [ - { - "internalType": "contract IFei", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "feiBalance", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "pid", - "type": "uint256" - }, - { - "internalType": "address", - "name": "user", - "type": "address" - } - ], - "name": "getTotalStakedInPool", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "_pid", - "type": "uint256" - }, - { - "internalType": "uint64", - "name": "lockLength", - "type": "uint64" - }, - { - "internalType": "uint64", - "name": "newRewardsMultiplier", - "type": "uint64" - } - ], - "name": "governorAddPoolMultiplier", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "name": "governorWithdrawTribe", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "pid", - "type": "uint256" - }, - { - "internalType": "address", - "name": "to", - "type": "address" - } - ], - "name": "harvest", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_core", - "type": "address" - }, - { - "internalType": "contract IERC20", - "name": "_tribe", - "type": "address" - } - ], - "name": "initialize", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_admin", - "type": "address" - } - ], - "name": "isContractAdmin", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "_pid", - "type": "uint256" - } - ], - "name": "lockPool", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256[]", - "name": "pids", - "type": "uint256[]" - } - ], - "name": "massUpdatePools", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "numPools", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "pid", - "type": "uint256" - }, - { - "internalType": "address", - "name": "user", - "type": "address" - } - ], - "name": "openUserDeposits", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "pause", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "paused", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "_pid", - "type": "uint256" - }, - { - "internalType": "address", - "name": "_user", - "type": "address" - } - ], - "name": "pendingRewards", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "name": "poolInfo", - "outputs": [ - { - "internalType": "uint256", - "name": "virtualTotalSupply", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "accTribePerShare", - "type": "uint256" - }, - { - "internalType": "uint128", - "name": "lastRewardBlock", - "type": "uint128" - }, - { - "internalType": "uint120", - "name": "allocPoint", - "type": "uint120" - }, - { - "internalType": "bool", - "name": "unlocked", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "_pid", - "type": "uint256" - } - ], - "name": "resetRewards", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - }, - { - "internalType": "uint128", - "name": "", - "type": "uint128" - } - ], - "name": "rewardMultipliers", - "outputs": [ - { - "internalType": "uint128", - "name": "", - "type": "uint128" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "name": "rewarder", - "outputs": [ - { - "internalType": "contract IRewarder", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "_pid", - "type": "uint256" - }, - { - "internalType": "uint120", - "name": "_allocPoint", - "type": "uint120" - }, - { - "internalType": "contract IRewarder", - "name": "_rewarder", - "type": "address" - }, - { - "internalType": "bool", - "name": "overwrite", - "type": "bool" - } - ], - "name": "set", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "newContractAdminRole", - "type": "bytes32" - } - ], - "name": "setContractAdminRole", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "newCore", - "type": "address" - } - ], - "name": "setCore", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "name": "stakedToken", - "outputs": [ - { - "internalType": "contract IERC20", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "totalAllocPoint", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "tribe", - "outputs": [ - { - "internalType": "contract IERC20", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "tribeBalance", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "tribePerBlock", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "_pid", - "type": "uint256" - } - ], - "name": "unlockPool", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "unpause", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "newBlockReward", - "type": "uint256" - } - ], - "name": "updateBlockReward", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "pid", - "type": "uint256" - } - ], - "name": "updatePool", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - }, - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "name": "userInfo", - "outputs": [ - { - "internalType": "int256", - "name": "rewardDebt", - "type": "int256" - }, - { - "internalType": "uint256", - "name": "virtualAmount", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "pid", - "type": "uint256" - }, - { - "internalType": "address", - "name": "to", - "type": "address" - } - ], - "name": "withdrawAllAndHarvest", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "pid", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "amount", - "type": "uint256" - }, - { - "internalType": "address", - "name": "to", - "type": "address" - }, - { - "internalType": "uint256", - "name": "index", - "type": "uint256" - } - ], - "name": "withdrawFromDeposit", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - } - ] \ No newline at end of file diff --git a/test/integration/tests/backstop.ts b/test/integration/tests/backstop.ts index 9988b00cd..f180e8b8a 100644 --- a/test/integration/tests/backstop.ts +++ b/test/integration/tests/backstop.ts @@ -4,7 +4,7 @@ import { solidity } from 'ethereum-waffle'; import { ethers } from 'hardhat'; import { NamedAddresses, NamedContracts } from '@custom-types/types'; import { resetFork, time, overwriteChainlinkAggregator } from '@test/helpers'; -import proposals from '@test/integration/proposals_config'; +import proposals from '@test/integration/proposalsConfig'; import { TestEndtoEndCoordinator } from '@test/integration/setup'; const toBN = ethers.BigNumber.from; diff --git a/test/integration/tests/balancer-weightedpool.ts b/test/integration/tests/balancer-weightedpool.ts index 8c10e6fd7..572fb4206 100644 --- a/test/integration/tests/balancer-weightedpool.ts +++ b/test/integration/tests/balancer-weightedpool.ts @@ -4,7 +4,7 @@ import { solidity } from 'ethereum-waffle'; import { ethers } from 'hardhat'; import { NamedContracts } from '@custom-types/types'; import { getImpersonatedSigner, expectRevert, expectApproxAbs, balance, resetFork } from '@test/helpers'; -import proposals from '@test/integration/proposals_config'; +import proposals from '@test/integration/proposalsConfig'; import { TestEndtoEndCoordinator } from '@test/integration/setup'; import { forceEth } from '@test/integration/setup/utils'; const toBN = ethers.BigNumber.from; diff --git a/test/integration/tests/buybacks.ts b/test/integration/tests/buybacks.ts index 974ffac88..42e77a295 100644 --- a/test/integration/tests/buybacks.ts +++ b/test/integration/tests/buybacks.ts @@ -11,7 +11,7 @@ import { resetFork, overwriteChainlinkAggregator } from '@test/helpers'; -import proposals from '@test/integration/proposals_config'; +import proposals from '@test/integration/proposalsConfig'; import { TestEndtoEndCoordinator } from '@test/integration/setup'; import { CollateralizationOracle } from '@custom-types/contracts'; const toBN = ethers.BigNumber.from; diff --git a/test/integration/tests/collateralizationOracle.ts b/test/integration/tests/collateralizationOracle.ts index 1ddfe467a..0e16ca639 100644 --- a/test/integration/tests/collateralizationOracle.ts +++ b/test/integration/tests/collateralizationOracle.ts @@ -4,7 +4,7 @@ import { solidity } from 'ethereum-waffle'; import { ethers } from 'hardhat'; import { NamedAddresses, NamedContracts } from '@custom-types/types'; import { expectApprox, overwriteChainlinkAggregator } from '@test/helpers'; -import proposals from '@test/integration/proposals_config'; +import proposals from '@test/integration/proposalsConfig'; import collateralizationAddresses from '@protocol/collateralizationOracle'; import { TestEndtoEndCoordinator } from '@test/integration/setup'; import { diff --git a/test/integration/tests/daiFixedPricePSM.ts b/test/integration/tests/daiFixedPricePSM.ts index 93ab14c8b..64a0e51a5 100644 --- a/test/integration/tests/daiFixedPricePSM.ts +++ b/test/integration/tests/daiFixedPricePSM.ts @@ -5,7 +5,7 @@ import { ethers } from 'hardhat'; import { NamedContracts } from '@custom-types/types'; import { expectRevert, getAddresses, getImpersonatedSigner, resetFork, time } from '@test/helpers'; import { TestEndtoEndCoordinator } from '@test/integration/setup'; -import proposals from '@test/integration/proposals_config'; +import proposals from '@test/integration/proposalsConfig'; import { forceEth } from '@test/integration/setup/utils'; import { Contract, Signer } from 'ethers'; import { expectApprox } from '@test/helpers'; diff --git a/test/integration/tests/dao.ts b/test/integration/tests/dao.ts index 2257af38f..e9809bf92 100644 --- a/test/integration/tests/dao.ts +++ b/test/integration/tests/dao.ts @@ -4,7 +4,7 @@ import { solidity } from 'ethereum-waffle'; import hre, { ethers } from 'hardhat'; import { NamedAddresses, NamedContracts } from '@custom-types/types'; import { getImpersonatedSigner, increaseTime, latestTime, resetFork, time } from '@test/helpers'; -import proposals from '@test/integration/proposals_config'; +import proposals from '@test/integration/proposalsConfig'; import { TestEndtoEndCoordinator } from '@test/integration/setup'; import { forceEth } from '@test/integration/setup/utils'; import { Core } from '@custom-types/contracts'; diff --git a/test/integration/tests/dependencies.ts b/test/integration/tests/dependencies.ts index ce25a9cd3..7c71b6642 100644 --- a/test/integration/tests/dependencies.ts +++ b/test/integration/tests/dependencies.ts @@ -1,6 +1,6 @@ import { expect } from 'chai'; import { ProposalCategory, ProposalDescription } from '@custom-types/types'; -import proposals from '@test/integration/proposals_config'; +import proposals from '@test/integration/proposalsConfig'; import dependencies from '@protocol/dependencies'; import addresses from '@protocol/mainnetAddresses'; import collateralizationAddresses from '@protocol/collateralizationOracle'; diff --git a/test/integration/tests/ethPSM.ts b/test/integration/tests/ethPSM.ts index a2713519f..9aa427a70 100644 --- a/test/integration/tests/ethPSM.ts +++ b/test/integration/tests/ethPSM.ts @@ -15,7 +15,7 @@ import { BigNumber } from 'ethers'; import hre, { ethers } from 'hardhat'; import { NamedAddresses, NamedContracts } from '@custom-types/types'; import { expectApprox, expectRevert, getImpersonatedSigner, increaseTime, resetFork } from '@test/helpers'; -import proposals from '@test/integration/proposals_config'; +import proposals from '@test/integration/proposalsConfig'; import { TestEndtoEndCoordinator } from '../setup'; import { forceEth } from '../setup/utils'; import { time } from '@test/helpers'; diff --git a/test/integration/tests/fei.ts b/test/integration/tests/fei.ts index 5a8687511..cff299277 100644 --- a/test/integration/tests/fei.ts +++ b/test/integration/tests/fei.ts @@ -4,7 +4,7 @@ import { solidity } from 'ethereum-waffle'; import { ethers } from 'hardhat'; import { NamedAddresses, NamedContracts } from '@custom-types/types'; import { getAddresses, getImpersonatedSigner, resetFork, ZERO_ADDRESS } from '@test/helpers'; -import proposals from '@test/integration/proposals_config'; +import proposals from '@test/integration/proposalsConfig'; import { TestEndtoEndCoordinator } from '@test/integration/setup'; import { Fei } from '@custom-types/contracts'; import { Signer } from '@ethersproject/abstract-signer'; diff --git a/test/integration/tests/fip-38-tokemak.ts b/test/integration/tests/fip-38-tokemak.ts index 1f24bd066..2f30c432b 100644 --- a/test/integration/tests/fip-38-tokemak.ts +++ b/test/integration/tests/fip-38-tokemak.ts @@ -4,7 +4,7 @@ import { solidity } from 'ethereum-waffle'; import { ethers } from 'hardhat'; import { NamedContracts } from '@custom-types/types'; import { getImpersonatedSigner, time, resetFork } from '@test/helpers'; -import proposals from '@test/integration/proposals_config'; +import proposals from '@test/integration/proposalsConfig'; import { TestEndtoEndCoordinator } from '@test/integration/setup'; import { forceEth } from '@test/integration/setup/utils'; const toBN = ethers.BigNumber.from; diff --git a/test/integration/tests/fuse.ts b/test/integration/tests/fuse.ts index 99a298480..441eb894e 100644 --- a/test/integration/tests/fuse.ts +++ b/test/integration/tests/fuse.ts @@ -4,7 +4,7 @@ import { solidity } from 'ethereum-waffle'; import { ethers } from 'hardhat'; import { NamedAddresses, NamedContracts } from '@custom-types/types'; import { getImpersonatedSigner, resetFork, time } from '@test/helpers'; -import proposals from '@test/integration/proposals_config'; +import proposals from '@test/integration/proposalsConfig'; import { TestEndtoEndCoordinator } from '../setup'; import { forceEth } from '../setup/utils'; diff --git a/test/integration/tests/lusdPSM.ts b/test/integration/tests/lusdPSM.ts index bf7ed53ba..c31dfafa0 100644 --- a/test/integration/tests/lusdPSM.ts +++ b/test/integration/tests/lusdPSM.ts @@ -13,7 +13,7 @@ import { overwriteChainlinkAggregator, resetFork } from '@test/helpers'; -import proposals from '@test/integration/proposals_config'; +import proposals from '@test/integration/proposalsConfig'; import { TestEndtoEndCoordinator } from '../setup'; import { forceEth } from '../setup/utils'; diff --git a/test/integration/tests/merger.ts.disabled b/test/integration/tests/merger.ts.disabled index 561000e02..58a509947 100644 --- a/test/integration/tests/merger.ts.disabled +++ b/test/integration/tests/merger.ts.disabled @@ -5,7 +5,7 @@ import { ethers } from 'hardhat'; import { NamedAddresses, NamedContracts } from '@custom-types/types'; import { getImpersonatedSigner, resetFork, time } from '@test/helpers'; import { TestEndtoEndCoordinator } from '@test/integration/setup'; -import proposals from '@test/integration/proposals_config'; +import proposals from '@test/integration/proposalsConfig'; import { PegExchanger, PegExchangerDripper } from '@custom-types/contracts'; import { expectApprox, expectRevert } from '@test/helpers'; import { forceEth } from '../setup/utils'; diff --git a/test/integration/tests/metagov/BalancerGaugeStaker.ts b/test/integration/tests/metagov/BalancerGaugeStaker.ts index 0a1d90730..27d4cc957 100644 --- a/test/integration/tests/metagov/BalancerGaugeStaker.ts +++ b/test/integration/tests/metagov/BalancerGaugeStaker.ts @@ -3,7 +3,7 @@ import CBN from 'chai-bn'; import { solidity } from 'ethereum-waffle'; import { ethers } from 'hardhat'; import { NamedContracts } from '@custom-types/types'; -import proposals from '@test/integration/proposals_config'; +import proposals from '@test/integration/proposalsConfig'; import { TestEndtoEndCoordinator } from '@test/integration/setup'; import { getImpersonatedSigner, expectRevert, expectEvent } from '@test/helpers'; import { forceEth } from '@test/integration/setup/utils'; diff --git a/test/integration/tests/metagov/GovernorVoter.ts b/test/integration/tests/metagov/GovernorVoter.ts index 7d7d3a313..03b2896ed 100644 --- a/test/integration/tests/metagov/GovernorVoter.ts +++ b/test/integration/tests/metagov/GovernorVoter.ts @@ -3,7 +3,7 @@ import CBN from 'chai-bn'; import { solidity } from 'ethereum-waffle'; import { ethers } from 'hardhat'; import { NamedContracts } from '@custom-types/types'; -import proposals from '@test/integration/proposals_config'; +import proposals from '@test/integration/proposalsConfig'; import { TestEndtoEndCoordinator } from '@test/integration/setup'; import { getImpersonatedSigner, expectRevert, time } from '@test/helpers'; import { forceEth } from '@test/integration/setup/utils'; diff --git a/test/integration/tests/metagov/LiquidityGaugeManager.ts b/test/integration/tests/metagov/LiquidityGaugeManager.ts index 199fc873a..16dc56692 100644 --- a/test/integration/tests/metagov/LiquidityGaugeManager.ts +++ b/test/integration/tests/metagov/LiquidityGaugeManager.ts @@ -3,7 +3,7 @@ import CBN from 'chai-bn'; import { solidity } from 'ethereum-waffle'; import { ethers } from 'hardhat'; import { NamedContracts } from '@custom-types/types'; -import proposals from '@test/integration/proposals_config'; +import proposals from '@test/integration/proposalsConfig'; import { TestEndtoEndCoordinator } from '@test/integration/setup'; import { getImpersonatedSigner, expectRevert } from '@test/helpers'; import { forceEth } from '@test/integration/setup/utils'; diff --git a/test/integration/tests/metagov/VoteEscrowTokenManager.ts b/test/integration/tests/metagov/VoteEscrowTokenManager.ts index 0b891614b..00c8e65a6 100644 --- a/test/integration/tests/metagov/VoteEscrowTokenManager.ts +++ b/test/integration/tests/metagov/VoteEscrowTokenManager.ts @@ -3,7 +3,7 @@ import CBN from 'chai-bn'; import { solidity } from 'ethereum-waffle'; import { ethers } from 'hardhat'; import { NamedContracts } from '@custom-types/types'; -import proposals from '@test/integration/proposals_config'; +import proposals from '@test/integration/proposalsConfig'; import { TestEndtoEndCoordinator } from '@test/integration/setup'; import { getImpersonatedSigner, expectRevert, time } from '@test/helpers'; import { forceEth } from '@test/integration/setup/utils'; diff --git a/test/integration/tests/pcv.ts b/test/integration/tests/pcv.ts index 0e0ff263a..b7e423d71 100644 --- a/test/integration/tests/pcv.ts +++ b/test/integration/tests/pcv.ts @@ -5,7 +5,7 @@ import { Contract } from 'ethers'; import hre, { ethers } from 'hardhat'; import { NamedAddresses, NamedContracts } from '@custom-types/types'; import { expectApprox, getImpersonatedSigner, overwriteChainlinkAggregator, resetFork, time } from '@test/helpers'; -import proposals from '@test/integration/proposals_config'; +import proposals from '@test/integration/proposalsConfig'; import { TestEndtoEndCoordinator } from '../setup'; import { forceEth } from '@test/integration/setup/utils'; diff --git a/test/integration/tests/podOperation.ts b/test/integration/tests/podOperation.ts index 3afc3862e..6f5955c1d 100644 --- a/test/integration/tests/podOperation.ts +++ b/test/integration/tests/podOperation.ts @@ -6,7 +6,7 @@ import { solidity } from 'ethereum-waffle'; import { ethers } from 'hardhat'; import { NamedAddresses, NamedContracts } from '@custom-types/types'; import { getImpersonatedSigner, time, initialiseGnosisSDK } from '@test/helpers'; -import proposals from '@test/integration/proposals_config'; +import proposals from '@test/integration/proposalsConfig'; import { forceEth } from '@test/integration/setup/utils'; import { TestEndtoEndCoordinator } from '../setup'; import { BigNumberish, Contract } from 'ethers'; diff --git a/test/integration/tests/psm.ts b/test/integration/tests/psm.ts index dcd06e3fc..9e75c9b6c 100644 --- a/test/integration/tests/psm.ts +++ b/test/integration/tests/psm.ts @@ -5,7 +5,7 @@ import { ethers } from 'hardhat'; import { NamedContracts } from '@custom-types/types'; import { expectRevert, getAddresses, getImpersonatedSigner, resetFork, time } from '@test/helpers'; import { TestEndtoEndCoordinator } from '@test/integration/setup'; -import proposals from '@test/integration/proposals_config'; +import proposals from '@test/integration/proposalsConfig'; import { forceEth } from '@test/integration/setup/utils'; import { Contract, Signer } from 'ethers'; import { expectApprox } from '@test/helpers'; diff --git a/test/integration/tests/staking.ts b/test/integration/tests/staking.ts index 7f4ef5d99..2595f8ed4 100644 --- a/test/integration/tests/staking.ts +++ b/test/integration/tests/staking.ts @@ -17,7 +17,7 @@ import { BigNumber, Contract } from 'ethers'; import hre, { ethers } from 'hardhat'; import { NamedAddresses, NamedContracts } from '@custom-types/types'; import { expectApprox, getImpersonatedSigner, time } from '@test/helpers'; -import proposals from '@test/integration/proposals_config'; +import proposals from '@test/integration/proposalsConfig'; import { TestEndtoEndCoordinator } from '../setup'; import { forceEth } from '@test/integration/setup/utils'; diff --git a/test/integration/tests/tribalCouncil.ts b/test/integration/tests/tribalCouncil.ts index f21126f64..58061a27e 100644 --- a/test/integration/tests/tribalCouncil.ts +++ b/test/integration/tests/tribalCouncil.ts @@ -6,7 +6,7 @@ import { solidity } from 'ethereum-waffle'; import { ethers } from 'hardhat'; import { NamedAddresses, NamedContracts } from '@custom-types/types'; import { getImpersonatedSigner, resetFork } from '@test/helpers'; -import proposals from '@test/integration/proposals_config'; +import proposals from '@test/integration/proposalsConfig'; import { forceEth } from '@test/integration/setup/utils'; import { TestEndtoEndCoordinator } from '../setup'; import { BigNumber } from 'ethers'; diff --git a/test/integration/tests/tribalchief.ts b/test/integration/tests/tribalchief.ts index 664938e2f..f7b642496 100644 --- a/test/integration/tests/tribalchief.ts +++ b/test/integration/tests/tribalchief.ts @@ -4,7 +4,7 @@ import { solidity } from 'ethereum-waffle'; import { ethers } from 'hardhat'; import { NamedContracts } from '@custom-types/types'; import { TestEndtoEndCoordinator } from '@test/integration/setup'; -import proposals from '@test/integration/proposals_config'; +import proposals from '@test/integration/proposalsConfig'; import mainnetAddresses from '@protocol/mainnetAddresses'; import tribalchief from '@protocol/tribalchief'; diff --git a/test/integration/tests/tribeIncentivesEnd.ts b/test/integration/tests/tribeIncentivesEnd.ts index 0bc8167fa..0eee0bff1 100644 --- a/test/integration/tests/tribeIncentivesEnd.ts +++ b/test/integration/tests/tribeIncentivesEnd.ts @@ -4,7 +4,7 @@ import { solidity } from 'ethereum-waffle'; import { ethers } from 'hardhat'; import { NamedAddresses, NamedContracts } from '@custom-types/types'; import { getImpersonatedSigner, resetFork, time } from '@test/helpers'; -import proposals from '@test/integration/proposals_config'; +import proposals from '@test/integration/proposalsConfig'; import { TestEndtoEndCoordinator } from '../setup'; import { forceEth } from '@test/integration/setup/utils'; import { TribalChief, Tribe } from '@custom-types/contracts'; diff --git a/test/integration/tests/turboPCVDeposit.ts b/test/integration/tests/turboPCVDeposit.ts index b2b8b429e..4084cd682 100644 --- a/test/integration/tests/turboPCVDeposit.ts +++ b/test/integration/tests/turboPCVDeposit.ts @@ -3,7 +3,7 @@ import CBN from 'chai-bn'; import { solidity } from 'ethereum-waffle'; import { ethers } from 'hardhat'; import { NamedAddresses, NamedContracts } from '@custom-types/types'; -import proposals from '@test/integration/proposals_config'; +import proposals from '@test/integration/proposalsConfig'; import { TestEndtoEndCoordinator } from '../setup'; import { expectApprox, getImpersonatedSigner, resetFork } from '@test/helpers'; import { abi as PCVDepositAbi } from '../../../artifacts/contracts/pcv/compound/ERC20CompoundPCVDeposit.sol/ERC20CompoundPCVDeposit.json'; diff --git a/test/integration/tests/votium-bribe.ts b/test/integration/tests/votium-bribe.ts index 4bba674b5..e20fa44f9 100644 --- a/test/integration/tests/votium-bribe.ts +++ b/test/integration/tests/votium-bribe.ts @@ -3,7 +3,7 @@ import { ethers } from 'hardhat'; import { NamedContracts } from '@custom-types/types'; import { getImpersonatedSigner, time } from '@test/helpers'; import { TestEndtoEndCoordinator } from '@test/integration/setup'; -import proposals from '@test/integration/proposals_config'; +import proposals from '@test/integration/proposalsConfig'; import { expectRevert } from '@test/helpers'; import { forceEth } from '../setup/utils'; diff --git a/tsconfig.json b/tsconfig.json index e00fa2541..2ff0428b0 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -24,11 +24,11 @@ "test/*", "test/**/*", "scripts/*", "scripts/**/*", "proposals/*", "proposals/**/*", - "./types/contracts/*", "./types/contracts/**/*", + "./types/contracts/*", "./types/contracts/**/*", "protocol-configuration/proposalsConfig.ts", ], "exclude": [ "scripts/deploy/old/*", "proposals/dao/old/*" ], "files": ["./hardhat.config.ts"], -} +} \ No newline at end of file From e0d0488939291348a98de83fd3cb32da9eee5125 Mon Sep 17 00:00:00 2001 From: Caleb Date: Sun, 5 Jun 2022 01:58:10 -0700 Subject: [PATCH 217/274] Update tsconfig --- tsconfig.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tsconfig.json b/tsconfig.json index 2ff0428b0..2d399b0a8 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -24,7 +24,8 @@ "test/*", "test/**/*", "scripts/*", "scripts/**/*", "proposals/*", "proposals/**/*", - "./types/contracts/*", "./types/contracts/**/*", "protocol-configuration/proposalsConfig.ts", + "protocol-configuration/*", "protocol-configuration/**/*", + "types/*", "types/**/*", ], "exclude": [ "scripts/deploy/old/*", From bc7683247e06638e11077a41266895d0d5ec4826 Mon Sep 17 00:00:00 2001 From: Caleb Date: Sun, 5 Jun 2022 01:59:13 -0700 Subject: [PATCH 218/274] Fix bad filepath --- test/integration/tests/tribeIncentivesEnd.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/integration/tests/tribeIncentivesEnd.ts b/test/integration/tests/tribeIncentivesEnd.ts index 0eee0bff1..6bcb2bcc1 100644 --- a/test/integration/tests/tribeIncentivesEnd.ts +++ b/test/integration/tests/tribeIncentivesEnd.ts @@ -4,7 +4,7 @@ import { solidity } from 'ethereum-waffle'; import { ethers } from 'hardhat'; import { NamedAddresses, NamedContracts } from '@custom-types/types'; import { getImpersonatedSigner, resetFork, time } from '@test/helpers'; -import proposals from '@test/integration/proposalsConfig'; +import proposals from '@protocol/proposalsConfig'; import { TestEndtoEndCoordinator } from '../setup'; import { forceEth } from '@test/integration/setup/utils'; import { TribalChief, Tribe } from '@custom-types/contracts'; From e0eb2ce7007633df741ef6d83a7541c01a090c98 Mon Sep 17 00:00:00 2001 From: Caleb Date: Sun, 5 Jun 2022 02:05:21 -0700 Subject: [PATCH 219/274] Delete dependencies --- test/integration/tests/dependencies.ts | 186 ------------------ .../tests/{ => old}/merger.ts.disabled | 0 2 files changed, 186 deletions(-) delete mode 100644 test/integration/tests/dependencies.ts rename test/integration/tests/{ => old}/merger.ts.disabled (100%) diff --git a/test/integration/tests/dependencies.ts b/test/integration/tests/dependencies.ts deleted file mode 100644 index 7c71b6642..000000000 --- a/test/integration/tests/dependencies.ts +++ /dev/null @@ -1,186 +0,0 @@ -import { expect } from 'chai'; -import { ProposalCategory, ProposalDescription } from '@custom-types/types'; -import proposals from '@test/integration/proposalsConfig'; -import dependencies from '@protocol/dependencies'; -import addresses from '@protocol/mainnetAddresses'; -import collateralizationAddresses from '@protocol/collateralizationOracle'; -import { AddressCategory } from '@custom-types/types'; // imported without custom path to allow docs to autogen without ts errors - -describe('e2e-dependencies', function () { - const doLogging = Boolean(process.env.LOGGING); - let proposalNames: string[]; - - before(function () { - proposalNames = Object.keys(proposals); - }); - - describe('Check Dependencies', function () { - it('are all signed off', async function () { - for (let i = 0; i < proposalNames.length; i++) { - const proposalName = proposalNames[i]; - if (proposals[proposalName].category === ProposalCategory.None || proposals[proposalName].deploy) { - // Skip if not a DAO/OA proposal or not yet deployed - doLogging && console.log(`Skipping: ${proposalName}`); - continue; - } - - const contracts = getProposalContracts(proposals[proposalName].proposal); - doLogging && console.log(`Checking proposal: ${proposalName}`); - doLogging && console.log(`Proposal affects contracts: ${contracts}`); - - for (let j = 0; j < contracts.length; j++) { - const contract = contracts[j]; - doLogging && console.log(`Contract: ${contract}`); - const category = addresses[contract].category; - if (category === AddressCategory.External) { - continue; - } - - if (category === AddressCategory.Deprecated) { - doLogging && console.log(`Checking deprecated contract: ${contract}`); - - expect(dependencies).to.not.haveOwnProperty(contract); - - // Make sure proposal config has this deprecated contract signed off - expect(proposals[proposalName].deprecatedContractSignoff).to.contain(contract); - continue; - } - - doLogging && console.log(`Checking contract: ${contract}`); - - expect(dependencies).to.haveOwnProperty(contract); - - // Make sure proposal config has this fip signed off - expect(proposals[proposalName].affectedContractSignoff).to.contain(contract); - } - } - }); - - it('all have contract category correct', async function () { - for (let i = 0; i < proposalNames.length; i++) { - const proposalName = proposalNames[i]; - const contracts = proposals[proposalName].affectedContractSignoff; - const deprecated = proposals[proposalName].deprecatedContractSignoff; - - if (proposals[proposalName].deploy) { - // Skip these checks if not mainnet deployed - doLogging && console.log(`Skipping: ${proposalName}`); - continue; - } - doLogging && console.log(`Checking proposal: ${proposalName}`); - doLogging && console.log(`Proposal affects contracts: ${contracts}`); - - for (let j = 0; j < contracts.length; j++) { - const contract = contracts[j]; - const category = addresses[contract].category; - expect(category).to.not.be.equal( - AddressCategory.External, - 'contract ' + contract + ' expected not to be External' - ); - expect(category).to.not.be.equal( - AddressCategory.Deprecated, - 'contract ' + contract + ' expected not to be Deprecated' - ); - - expect(deprecated).to.not.contain(contract); - } - - for (let j = 0; j < deprecated.length; j++) { - const contract = deprecated[j]; - const category = addresses[contract].category; - expect(category).to.be.equal(AddressCategory.Deprecated); - - expect(contracts).to.not.contain(contract); - } - } - }); - - it('collateralization oracle deposits category correct', async function () { - const tokenAddresses = Object.keys(collateralizationAddresses); - const crDeposits = []; - for (let i = 0; i < tokenAddresses.length; i++) { - const element = tokenAddresses[i]; - - const deposits = collateralizationAddresses[element]; - - for (let i = 0; i < deposits.length; i++) { - const deposit = deposits[i]; - crDeposits.push(deposit); - - doLogging && console.log(`${element} contract address: ${deposit}`); - if (addresses[deposit]) { - // addresses[deposit] may be undefined if a deposit is added to the - // dependencies and permissions/collateralizationOracle files, but - // is not yet deployed on the mainnet (i.e. in mainnetAddresses.ts). - expect(addresses[deposit].category).to.not.be.equal( - 'Deprecated', - 'Deposit [' + deposit + '] is in collateralizationoracle.ts and has AddressCategory.Deprecated' - ); - } - } - } - - const mainnetAddresses = Object.keys(addresses); - - for (let i = 0; i < mainnetAddresses.length; i++) { - const element = mainnetAddresses[i]; - - const category = addresses[element].category; - - if (category === 'PCV') { - expect(crDeposits).to.contain(element, 'expected in crDeposits'); - } - } - }); - - it('are listed bidirectionally', async function () { - const contractNames = Object.keys(dependencies); - for (let i = 0; i < contractNames.length; i++) { - const contract = contractNames[i]; - doLogging && console.log(`Checking contract: ${contract}`); - const contractDependencies = dependencies[contract].contractDependencies; - for (let j = 0; j < contractDependencies.length; j++) { - const dependency = contractDependencies[j]; - doLogging && console.log(`Checking contract dependency: ${dependency}`); - expect(dependencies).to.haveOwnProperty(dependency); - expect(dependencies[dependency].contractDependencies).to.contain(contract, 'dependencies of ' + dependency); - } - } - }); - }); -}); - -function getProposalContracts(proposal: ProposalDescription): string[] { - let contracts = []; - - for (let i = 0; i < proposal.commands.length; i++) { - const command = proposal.commands[i]; - contracts.push(command.target); - contracts = contracts.concat(getContractsFromArgs(command.arguments)); - } - - // dedup - return [...new Set(contracts)]; -} - -function getContractsFromArgs(args: any[]): string[] { - let result: string[] = []; - for (let i = 0; i < args.length; i++) { - const element = args[i]; - if (typeof element === typeof '') { - // find all contracts - let formatted: string[] = element.match(/\{\w+\}/g); - formatted = formatted || []; - - // Remove braces - formatted = formatted.map((item) => item.replace('{', '').replace('}', '')); - - result = result.concat(formatted); - } else if (typeof element === typeof []) { - // recurse through levels of array - const moreContracts: string[] = getContractsFromArgs(element); - result = result.concat(moreContracts); - } - } - return result; -} diff --git a/test/integration/tests/merger.ts.disabled b/test/integration/tests/old/merger.ts.disabled similarity index 100% rename from test/integration/tests/merger.ts.disabled rename to test/integration/tests/old/merger.ts.disabled From a87fa896be804a014b941f3b63ef6785fa0cca9f Mon Sep 17 00:00:00 2001 From: Caleb Date: Sun, 5 Jun 2022 02:20:31 -0700 Subject: [PATCH 220/274] Clear out proposalsConfig & update block to current --- block.txt | 2 +- protocol-configuration/proposalsConfig.ts | 67 +------------------ test/integration/tests/backstop.ts | 2 +- .../tests/balancer-weightedpool.ts | 2 +- test/integration/tests/buybacks.ts | 2 +- .../tests/collateralizationOracle.ts | 2 +- test/integration/tests/daiFixedPricePSM.ts | 2 +- test/integration/tests/dao.ts | 2 +- test/integration/tests/ethPSM.ts | 2 +- test/integration/tests/fei.ts | 2 +- test/integration/tests/fip-38-tokemak.ts | 2 +- test/integration/tests/fuse.ts | 2 +- test/integration/tests/lusdPSM.ts | 2 +- .../tests/metagov/BalancerGaugeStaker.ts | 2 +- .../tests/metagov/GovernorVoter.ts | 2 +- .../tests/metagov/LiquidityGaugeManager.ts | 2 +- .../tests/metagov/VoteEscrowTokenManager.ts | 2 +- test/integration/tests/old/merger.ts.disabled | 2 +- test/integration/tests/pcv.ts | 2 +- test/integration/tests/podOperation.ts | 2 +- test/integration/tests/psm.ts | 2 +- test/integration/tests/staking.ts | 2 +- test/integration/tests/tribalCouncil.ts | 2 +- test/integration/tests/tribalchief.ts | 2 +- test/integration/tests/turboPCVDeposit.ts | 2 +- test/integration/tests/votium-bribe.ts | 2 +- 26 files changed, 26 insertions(+), 91 deletions(-) diff --git a/block.txt b/block.txt index 4245c0f7a..5abc08db3 100644 --- a/block.txt +++ b/block.txt @@ -1 +1 @@ -14885000 +14908000 \ No newline at end of file diff --git a/protocol-configuration/proposalsConfig.ts b/protocol-configuration/proposalsConfig.ts index aab450ec0..98ab69fc6 100644 --- a/protocol-configuration/proposalsConfig.ts +++ b/protocol-configuration/proposalsConfig.ts @@ -1,70 +1,5 @@ import { ProposalCategory, ProposalsConfigMap } from '@custom-types/types'; -import repay_fuse_bad_debt from '@proposals/description/repay_fuse_bad_debt'; -import register_proposal from '@proposals/description/register_proposal'; -import end_tribe_incentives from '@proposals/description/end_tribe_incentives'; - -const proposals: ProposalsConfigMap = { - register_proposal: { - deploy: false, // deploy flag for whether to run deploy action during e2e tests or use mainnet state - totalValue: 0, // amount of ETH to send to DAO execution - proposal: register_proposal, // full proposal file, imported from '@proposals/description/fip_xx.ts' - proposalId: '', - affectedContractSignoff: ['core'], - deprecatedContractSignoff: [], - category: ProposalCategory.TC - }, - repay_fuse_bad_debt: { - deploy: false, // deploy flag for whether to run deploy action during e2e tests or use mainnet state - totalValue: 0, // amount of ETH to send to DAO execution - proposal: repay_fuse_bad_debt, // full proposal file, imported from '@proposals/description/fip_xx.ts' - proposalId: '', - affectedContractSignoff: ['core', 'fuseFixer', 'pcvGuardianNew'], - deprecatedContractSignoff: [], - category: ProposalCategory.TC - }, - end_tribe_incentives: { - deploy: false, // deploy flag for whether to run deploy action during e2e tests or use mainnet state - totalValue: 0, // amount of ETH to send to DAO execution - proposal: end_tribe_incentives, // full proposal file, imported from '@proposals/description/fip_xx.ts' - proposalId: '', - affectedContractSignoff: [ - 'core', - 'tribalChief', - 'tribalCouncilTimelock', - 'collateralizationOracle', - 'opsOptimisticTimelock' - ], - deprecatedContractSignoff: [ - 'creamDepositWrapper', - 'fei3CrvAutoRewardsDistributor', - 'd3AutoRewardsDistributor', - 'autoRewardsDistributor', - 'feiDaiAutoRewardsDistributor', - 'feiUsdcAutoRewardsDistributor', - 'stakingTokenWrapperRari', - 'stakingTokenWrapperFOXLaaS', - 'stakingTokenWrapperGROLaaS', - 'stakingTokenWrapperKYLINLaaS', - 'stakingTokenWrapperMStableLaaS', - 'stakingTokenWrapperNEARLaaS', - 'stakingTokenWrapperPoolTogetherLaaS', - 'stakingTokenWrapperUMALaaS', - 'stakingTokenWrapperSYNLaaS', - 'rewardsDistributorAdmin', - 'stwBulkHarvest', - 'stakingTokenWrapperBribeD3pool', - 'fei3CrvStakingtokenWrapper', - 'feiDaiStakingTokenWrapper', - 'feiUsdcStakingTokenWrapper', - 'stakingTokenWrapperBribe3Crvpool', - 'tribalChiefSyncV2', - 'tribalChiefSyncExtension', - 'd3StakingTokenWrapper', - 'votiumBriberD3pool' - ], - category: ProposalCategory.TC - } -}; +const proposals: ProposalsConfigMap = {}; export default proposals; diff --git a/test/integration/tests/backstop.ts b/test/integration/tests/backstop.ts index f180e8b8a..84deb5eed 100644 --- a/test/integration/tests/backstop.ts +++ b/test/integration/tests/backstop.ts @@ -4,7 +4,7 @@ import { solidity } from 'ethereum-waffle'; import { ethers } from 'hardhat'; import { NamedAddresses, NamedContracts } from '@custom-types/types'; import { resetFork, time, overwriteChainlinkAggregator } from '@test/helpers'; -import proposals from '@test/integration/proposalsConfig'; +import proposals from '@protocol/proposalsConfig'; import { TestEndtoEndCoordinator } from '@test/integration/setup'; const toBN = ethers.BigNumber.from; diff --git a/test/integration/tests/balancer-weightedpool.ts b/test/integration/tests/balancer-weightedpool.ts index 572fb4206..0186a2d5c 100644 --- a/test/integration/tests/balancer-weightedpool.ts +++ b/test/integration/tests/balancer-weightedpool.ts @@ -4,7 +4,7 @@ import { solidity } from 'ethereum-waffle'; import { ethers } from 'hardhat'; import { NamedContracts } from '@custom-types/types'; import { getImpersonatedSigner, expectRevert, expectApproxAbs, balance, resetFork } from '@test/helpers'; -import proposals from '@test/integration/proposalsConfig'; +import proposals from '@protocol/proposalsConfig'; import { TestEndtoEndCoordinator } from '@test/integration/setup'; import { forceEth } from '@test/integration/setup/utils'; const toBN = ethers.BigNumber.from; diff --git a/test/integration/tests/buybacks.ts b/test/integration/tests/buybacks.ts index 42e77a295..eef5b3078 100644 --- a/test/integration/tests/buybacks.ts +++ b/test/integration/tests/buybacks.ts @@ -11,7 +11,7 @@ import { resetFork, overwriteChainlinkAggregator } from '@test/helpers'; -import proposals from '@test/integration/proposalsConfig'; +import proposals from '@protocol/proposalsConfig'; import { TestEndtoEndCoordinator } from '@test/integration/setup'; import { CollateralizationOracle } from '@custom-types/contracts'; const toBN = ethers.BigNumber.from; diff --git a/test/integration/tests/collateralizationOracle.ts b/test/integration/tests/collateralizationOracle.ts index 0e16ca639..56446812f 100644 --- a/test/integration/tests/collateralizationOracle.ts +++ b/test/integration/tests/collateralizationOracle.ts @@ -4,7 +4,7 @@ import { solidity } from 'ethereum-waffle'; import { ethers } from 'hardhat'; import { NamedAddresses, NamedContracts } from '@custom-types/types'; import { expectApprox, overwriteChainlinkAggregator } from '@test/helpers'; -import proposals from '@test/integration/proposalsConfig'; +import proposals from '@protocol/proposalsConfig'; import collateralizationAddresses from '@protocol/collateralizationOracle'; import { TestEndtoEndCoordinator } from '@test/integration/setup'; import { diff --git a/test/integration/tests/daiFixedPricePSM.ts b/test/integration/tests/daiFixedPricePSM.ts index 64a0e51a5..7a3544ad3 100644 --- a/test/integration/tests/daiFixedPricePSM.ts +++ b/test/integration/tests/daiFixedPricePSM.ts @@ -5,7 +5,7 @@ import { ethers } from 'hardhat'; import { NamedContracts } from '@custom-types/types'; import { expectRevert, getAddresses, getImpersonatedSigner, resetFork, time } from '@test/helpers'; import { TestEndtoEndCoordinator } from '@test/integration/setup'; -import proposals from '@test/integration/proposalsConfig'; +import proposals from '@protocol/proposalsConfig'; import { forceEth } from '@test/integration/setup/utils'; import { Contract, Signer } from 'ethers'; import { expectApprox } from '@test/helpers'; diff --git a/test/integration/tests/dao.ts b/test/integration/tests/dao.ts index e9809bf92..004a71a83 100644 --- a/test/integration/tests/dao.ts +++ b/test/integration/tests/dao.ts @@ -4,7 +4,7 @@ import { solidity } from 'ethereum-waffle'; import hre, { ethers } from 'hardhat'; import { NamedAddresses, NamedContracts } from '@custom-types/types'; import { getImpersonatedSigner, increaseTime, latestTime, resetFork, time } from '@test/helpers'; -import proposals from '@test/integration/proposalsConfig'; +import proposals from '@protocol/proposalsConfig'; import { TestEndtoEndCoordinator } from '@test/integration/setup'; import { forceEth } from '@test/integration/setup/utils'; import { Core } from '@custom-types/contracts'; diff --git a/test/integration/tests/ethPSM.ts b/test/integration/tests/ethPSM.ts index 9aa427a70..c1c0f29e3 100644 --- a/test/integration/tests/ethPSM.ts +++ b/test/integration/tests/ethPSM.ts @@ -15,7 +15,7 @@ import { BigNumber } from 'ethers'; import hre, { ethers } from 'hardhat'; import { NamedAddresses, NamedContracts } from '@custom-types/types'; import { expectApprox, expectRevert, getImpersonatedSigner, increaseTime, resetFork } from '@test/helpers'; -import proposals from '@test/integration/proposalsConfig'; +import proposals from '@protocol/proposalsConfig'; import { TestEndtoEndCoordinator } from '../setup'; import { forceEth } from '../setup/utils'; import { time } from '@test/helpers'; diff --git a/test/integration/tests/fei.ts b/test/integration/tests/fei.ts index cff299277..60bfb25ba 100644 --- a/test/integration/tests/fei.ts +++ b/test/integration/tests/fei.ts @@ -4,7 +4,7 @@ import { solidity } from 'ethereum-waffle'; import { ethers } from 'hardhat'; import { NamedAddresses, NamedContracts } from '@custom-types/types'; import { getAddresses, getImpersonatedSigner, resetFork, ZERO_ADDRESS } from '@test/helpers'; -import proposals from '@test/integration/proposalsConfig'; +import proposals from '@protocol/proposalsConfig'; import { TestEndtoEndCoordinator } from '@test/integration/setup'; import { Fei } from '@custom-types/contracts'; import { Signer } from '@ethersproject/abstract-signer'; diff --git a/test/integration/tests/fip-38-tokemak.ts b/test/integration/tests/fip-38-tokemak.ts index 2f30c432b..6d4a3d4ff 100644 --- a/test/integration/tests/fip-38-tokemak.ts +++ b/test/integration/tests/fip-38-tokemak.ts @@ -4,7 +4,7 @@ import { solidity } from 'ethereum-waffle'; import { ethers } from 'hardhat'; import { NamedContracts } from '@custom-types/types'; import { getImpersonatedSigner, time, resetFork } from '@test/helpers'; -import proposals from '@test/integration/proposalsConfig'; +import proposals from '@protocol/proposalsConfig'; import { TestEndtoEndCoordinator } from '@test/integration/setup'; import { forceEth } from '@test/integration/setup/utils'; const toBN = ethers.BigNumber.from; diff --git a/test/integration/tests/fuse.ts b/test/integration/tests/fuse.ts index 441eb894e..e28298613 100644 --- a/test/integration/tests/fuse.ts +++ b/test/integration/tests/fuse.ts @@ -4,7 +4,7 @@ import { solidity } from 'ethereum-waffle'; import { ethers } from 'hardhat'; import { NamedAddresses, NamedContracts } from '@custom-types/types'; import { getImpersonatedSigner, resetFork, time } from '@test/helpers'; -import proposals from '@test/integration/proposalsConfig'; +import proposals from '@protocol/proposalsConfig'; import { TestEndtoEndCoordinator } from '../setup'; import { forceEth } from '../setup/utils'; diff --git a/test/integration/tests/lusdPSM.ts b/test/integration/tests/lusdPSM.ts index c31dfafa0..5fde0e5ff 100644 --- a/test/integration/tests/lusdPSM.ts +++ b/test/integration/tests/lusdPSM.ts @@ -13,7 +13,7 @@ import { overwriteChainlinkAggregator, resetFork } from '@test/helpers'; -import proposals from '@test/integration/proposalsConfig'; +import proposals from '@protocol/proposalsConfig'; import { TestEndtoEndCoordinator } from '../setup'; import { forceEth } from '../setup/utils'; diff --git a/test/integration/tests/metagov/BalancerGaugeStaker.ts b/test/integration/tests/metagov/BalancerGaugeStaker.ts index 27d4cc957..644636419 100644 --- a/test/integration/tests/metagov/BalancerGaugeStaker.ts +++ b/test/integration/tests/metagov/BalancerGaugeStaker.ts @@ -3,7 +3,7 @@ import CBN from 'chai-bn'; import { solidity } from 'ethereum-waffle'; import { ethers } from 'hardhat'; import { NamedContracts } from '@custom-types/types'; -import proposals from '@test/integration/proposalsConfig'; +import proposals from '@protocol/proposalsConfig'; import { TestEndtoEndCoordinator } from '@test/integration/setup'; import { getImpersonatedSigner, expectRevert, expectEvent } from '@test/helpers'; import { forceEth } from '@test/integration/setup/utils'; diff --git a/test/integration/tests/metagov/GovernorVoter.ts b/test/integration/tests/metagov/GovernorVoter.ts index 03b2896ed..b01d869a7 100644 --- a/test/integration/tests/metagov/GovernorVoter.ts +++ b/test/integration/tests/metagov/GovernorVoter.ts @@ -3,7 +3,7 @@ import CBN from 'chai-bn'; import { solidity } from 'ethereum-waffle'; import { ethers } from 'hardhat'; import { NamedContracts } from '@custom-types/types'; -import proposals from '@test/integration/proposalsConfig'; +import proposals from '@protocol/proposalsConfig'; import { TestEndtoEndCoordinator } from '@test/integration/setup'; import { getImpersonatedSigner, expectRevert, time } from '@test/helpers'; import { forceEth } from '@test/integration/setup/utils'; diff --git a/test/integration/tests/metagov/LiquidityGaugeManager.ts b/test/integration/tests/metagov/LiquidityGaugeManager.ts index 16dc56692..357ae2e39 100644 --- a/test/integration/tests/metagov/LiquidityGaugeManager.ts +++ b/test/integration/tests/metagov/LiquidityGaugeManager.ts @@ -3,7 +3,7 @@ import CBN from 'chai-bn'; import { solidity } from 'ethereum-waffle'; import { ethers } from 'hardhat'; import { NamedContracts } from '@custom-types/types'; -import proposals from '@test/integration/proposalsConfig'; +import proposals from '@protocol/proposalsConfig'; import { TestEndtoEndCoordinator } from '@test/integration/setup'; import { getImpersonatedSigner, expectRevert } from '@test/helpers'; import { forceEth } from '@test/integration/setup/utils'; diff --git a/test/integration/tests/metagov/VoteEscrowTokenManager.ts b/test/integration/tests/metagov/VoteEscrowTokenManager.ts index 00c8e65a6..c648f4e52 100644 --- a/test/integration/tests/metagov/VoteEscrowTokenManager.ts +++ b/test/integration/tests/metagov/VoteEscrowTokenManager.ts @@ -3,7 +3,7 @@ import CBN from 'chai-bn'; import { solidity } from 'ethereum-waffle'; import { ethers } from 'hardhat'; import { NamedContracts } from '@custom-types/types'; -import proposals from '@test/integration/proposalsConfig'; +import proposals from '@protocol/proposalsConfig'; import { TestEndtoEndCoordinator } from '@test/integration/setup'; import { getImpersonatedSigner, expectRevert, time } from '@test/helpers'; import { forceEth } from '@test/integration/setup/utils'; diff --git a/test/integration/tests/old/merger.ts.disabled b/test/integration/tests/old/merger.ts.disabled index 58a509947..a4fca4255 100644 --- a/test/integration/tests/old/merger.ts.disabled +++ b/test/integration/tests/old/merger.ts.disabled @@ -5,7 +5,7 @@ import { ethers } from 'hardhat'; import { NamedAddresses, NamedContracts } from '@custom-types/types'; import { getImpersonatedSigner, resetFork, time } from '@test/helpers'; import { TestEndtoEndCoordinator } from '@test/integration/setup'; -import proposals from '@test/integration/proposalsConfig'; +import proposals from '@protocol/proposalsConfig'; import { PegExchanger, PegExchangerDripper } from '@custom-types/contracts'; import { expectApprox, expectRevert } from '@test/helpers'; import { forceEth } from '../setup/utils'; diff --git a/test/integration/tests/pcv.ts b/test/integration/tests/pcv.ts index b7e423d71..93edd99db 100644 --- a/test/integration/tests/pcv.ts +++ b/test/integration/tests/pcv.ts @@ -5,7 +5,7 @@ import { Contract } from 'ethers'; import hre, { ethers } from 'hardhat'; import { NamedAddresses, NamedContracts } from '@custom-types/types'; import { expectApprox, getImpersonatedSigner, overwriteChainlinkAggregator, resetFork, time } from '@test/helpers'; -import proposals from '@test/integration/proposalsConfig'; +import proposals from '@protocol/proposalsConfig'; import { TestEndtoEndCoordinator } from '../setup'; import { forceEth } from '@test/integration/setup/utils'; diff --git a/test/integration/tests/podOperation.ts b/test/integration/tests/podOperation.ts index 6f5955c1d..26efbe593 100644 --- a/test/integration/tests/podOperation.ts +++ b/test/integration/tests/podOperation.ts @@ -6,7 +6,7 @@ import { solidity } from 'ethereum-waffle'; import { ethers } from 'hardhat'; import { NamedAddresses, NamedContracts } from '@custom-types/types'; import { getImpersonatedSigner, time, initialiseGnosisSDK } from '@test/helpers'; -import proposals from '@test/integration/proposalsConfig'; +import proposals from '@protocol/proposalsConfig'; import { forceEth } from '@test/integration/setup/utils'; import { TestEndtoEndCoordinator } from '../setup'; import { BigNumberish, Contract } from 'ethers'; diff --git a/test/integration/tests/psm.ts b/test/integration/tests/psm.ts index 9e75c9b6c..5355d8bef 100644 --- a/test/integration/tests/psm.ts +++ b/test/integration/tests/psm.ts @@ -5,7 +5,7 @@ import { ethers } from 'hardhat'; import { NamedContracts } from '@custom-types/types'; import { expectRevert, getAddresses, getImpersonatedSigner, resetFork, time } from '@test/helpers'; import { TestEndtoEndCoordinator } from '@test/integration/setup'; -import proposals from '@test/integration/proposalsConfig'; +import proposals from '@protocol/proposalsConfig'; import { forceEth } from '@test/integration/setup/utils'; import { Contract, Signer } from 'ethers'; import { expectApprox } from '@test/helpers'; diff --git a/test/integration/tests/staking.ts b/test/integration/tests/staking.ts index 2595f8ed4..5d7f378b6 100644 --- a/test/integration/tests/staking.ts +++ b/test/integration/tests/staking.ts @@ -17,7 +17,7 @@ import { BigNumber, Contract } from 'ethers'; import hre, { ethers } from 'hardhat'; import { NamedAddresses, NamedContracts } from '@custom-types/types'; import { expectApprox, getImpersonatedSigner, time } from '@test/helpers'; -import proposals from '@test/integration/proposalsConfig'; +import proposals from '@protocol/proposalsConfig'; import { TestEndtoEndCoordinator } from '../setup'; import { forceEth } from '@test/integration/setup/utils'; diff --git a/test/integration/tests/tribalCouncil.ts b/test/integration/tests/tribalCouncil.ts index 58061a27e..c1cdf0da4 100644 --- a/test/integration/tests/tribalCouncil.ts +++ b/test/integration/tests/tribalCouncil.ts @@ -6,7 +6,7 @@ import { solidity } from 'ethereum-waffle'; import { ethers } from 'hardhat'; import { NamedAddresses, NamedContracts } from '@custom-types/types'; import { getImpersonatedSigner, resetFork } from '@test/helpers'; -import proposals from '@test/integration/proposalsConfig'; +import proposals from '@protocol/proposalsConfig'; import { forceEth } from '@test/integration/setup/utils'; import { TestEndtoEndCoordinator } from '../setup'; import { BigNumber } from 'ethers'; diff --git a/test/integration/tests/tribalchief.ts b/test/integration/tests/tribalchief.ts index f7b642496..6d197010c 100644 --- a/test/integration/tests/tribalchief.ts +++ b/test/integration/tests/tribalchief.ts @@ -4,7 +4,7 @@ import { solidity } from 'ethereum-waffle'; import { ethers } from 'hardhat'; import { NamedContracts } from '@custom-types/types'; import { TestEndtoEndCoordinator } from '@test/integration/setup'; -import proposals from '@test/integration/proposalsConfig'; +import proposals from '@protocol/proposalsConfig'; import mainnetAddresses from '@protocol/mainnetAddresses'; import tribalchief from '@protocol/tribalchief'; diff --git a/test/integration/tests/turboPCVDeposit.ts b/test/integration/tests/turboPCVDeposit.ts index 4084cd682..aa3394802 100644 --- a/test/integration/tests/turboPCVDeposit.ts +++ b/test/integration/tests/turboPCVDeposit.ts @@ -3,7 +3,7 @@ import CBN from 'chai-bn'; import { solidity } from 'ethereum-waffle'; import { ethers } from 'hardhat'; import { NamedAddresses, NamedContracts } from '@custom-types/types'; -import proposals from '@test/integration/proposalsConfig'; +import proposals from '@protocol/proposalsConfig'; import { TestEndtoEndCoordinator } from '../setup'; import { expectApprox, getImpersonatedSigner, resetFork } from '@test/helpers'; import { abi as PCVDepositAbi } from '../../../artifacts/contracts/pcv/compound/ERC20CompoundPCVDeposit.sol/ERC20CompoundPCVDeposit.json'; diff --git a/test/integration/tests/votium-bribe.ts b/test/integration/tests/votium-bribe.ts index e20fa44f9..6f43ee51d 100644 --- a/test/integration/tests/votium-bribe.ts +++ b/test/integration/tests/votium-bribe.ts @@ -3,7 +3,7 @@ import { ethers } from 'hardhat'; import { NamedContracts } from '@custom-types/types'; import { getImpersonatedSigner, time } from '@test/helpers'; import { TestEndtoEndCoordinator } from '@test/integration/setup'; -import proposals from '@test/integration/proposalsConfig'; +import proposals from '@protocol/proposalsConfig'; import { expectRevert } from '@test/helpers'; import { forceEth } from '../setup/utils'; From abc23986ebb2f5f3cf9531c77c10d64931ff7a41 Mon Sep 17 00:00:00 2001 From: Caleb Date: Sun, 5 Jun 2022 04:20:42 -0700 Subject: [PATCH 221/274] Move proposals to old --- contracts/.prettierrc | 15 --------------- proposals/dao/{ => old}/balancer_gauge_fix.ts | 0 proposals/dao/{ => old}/end_tribe_incentives.ts | 0 proposals/dao/{ => old}/fip_104.ts | 0 proposals/dao/{ => old}/oa_cr_fix.ts | 0 proposals/dao/{ => old}/register_proposal.ts | 0 proposals/dao/{ => old}/repay_fuse_bad_debt.ts | 0 proposals/dao/{ => old}/withdraw_d3_pool.ts | 0 proposals/data/{ => old}/ragequit_data.json | 0 .../description/{ => old}/balancer_gauge_fix.ts | 0 .../description/{ => old}/end_tribe_incentives.ts | 0 proposals/description/{ => old}/fip_104.ts | 0 proposals/description/{ => old}/oa_cr_fix.ts | 0 .../description/{ => old}/register_proposal.ts | 0 .../description/{ => old}/repay_fuse_bad_debt.ts | 0 .../description/{ => old}/withdraw_d3_pool.ts | 0 protocol-configuration/mainnetAddresses.ts | 6 +++--- test/integration/setup/loadContracts.ts | 15 +++------------ types/types.ts | 6 +++--- 19 files changed, 9 insertions(+), 33 deletions(-) delete mode 100644 contracts/.prettierrc rename proposals/dao/{ => old}/balancer_gauge_fix.ts (100%) rename proposals/dao/{ => old}/end_tribe_incentives.ts (100%) rename proposals/dao/{ => old}/fip_104.ts (100%) rename proposals/dao/{ => old}/oa_cr_fix.ts (100%) rename proposals/dao/{ => old}/register_proposal.ts (100%) rename proposals/dao/{ => old}/repay_fuse_bad_debt.ts (100%) rename proposals/dao/{ => old}/withdraw_d3_pool.ts (100%) rename proposals/data/{ => old}/ragequit_data.json (100%) rename proposals/description/{ => old}/balancer_gauge_fix.ts (100%) rename proposals/description/{ => old}/end_tribe_incentives.ts (100%) rename proposals/description/{ => old}/fip_104.ts (100%) rename proposals/description/{ => old}/oa_cr_fix.ts (100%) rename proposals/description/{ => old}/register_proposal.ts (100%) rename proposals/description/{ => old}/repay_fuse_bad_debt.ts (100%) rename proposals/description/{ => old}/withdraw_d3_pool.ts (100%) diff --git a/contracts/.prettierrc b/contracts/.prettierrc deleted file mode 100644 index 6b8854087..000000000 --- a/contracts/.prettierrc +++ /dev/null @@ -1,15 +0,0 @@ -{ - "overrides": [ - { - "files": "*.sol", - "options": { - "printWidth": 120, - "tabWidth": 4, - "useTabs": false, - "singleQuote": false, - "bracketSpacing": false, - "explicitTypes": "always" - } - } - ] - } \ No newline at end of file diff --git a/proposals/dao/balancer_gauge_fix.ts b/proposals/dao/old/balancer_gauge_fix.ts similarity index 100% rename from proposals/dao/balancer_gauge_fix.ts rename to proposals/dao/old/balancer_gauge_fix.ts diff --git a/proposals/dao/end_tribe_incentives.ts b/proposals/dao/old/end_tribe_incentives.ts similarity index 100% rename from proposals/dao/end_tribe_incentives.ts rename to proposals/dao/old/end_tribe_incentives.ts diff --git a/proposals/dao/fip_104.ts b/proposals/dao/old/fip_104.ts similarity index 100% rename from proposals/dao/fip_104.ts rename to proposals/dao/old/fip_104.ts diff --git a/proposals/dao/oa_cr_fix.ts b/proposals/dao/old/oa_cr_fix.ts similarity index 100% rename from proposals/dao/oa_cr_fix.ts rename to proposals/dao/old/oa_cr_fix.ts diff --git a/proposals/dao/register_proposal.ts b/proposals/dao/old/register_proposal.ts similarity index 100% rename from proposals/dao/register_proposal.ts rename to proposals/dao/old/register_proposal.ts diff --git a/proposals/dao/repay_fuse_bad_debt.ts b/proposals/dao/old/repay_fuse_bad_debt.ts similarity index 100% rename from proposals/dao/repay_fuse_bad_debt.ts rename to proposals/dao/old/repay_fuse_bad_debt.ts diff --git a/proposals/dao/withdraw_d3_pool.ts b/proposals/dao/old/withdraw_d3_pool.ts similarity index 100% rename from proposals/dao/withdraw_d3_pool.ts rename to proposals/dao/old/withdraw_d3_pool.ts diff --git a/proposals/data/ragequit_data.json b/proposals/data/old/ragequit_data.json similarity index 100% rename from proposals/data/ragequit_data.json rename to proposals/data/old/ragequit_data.json diff --git a/proposals/description/balancer_gauge_fix.ts b/proposals/description/old/balancer_gauge_fix.ts similarity index 100% rename from proposals/description/balancer_gauge_fix.ts rename to proposals/description/old/balancer_gauge_fix.ts diff --git a/proposals/description/end_tribe_incentives.ts b/proposals/description/old/end_tribe_incentives.ts similarity index 100% rename from proposals/description/end_tribe_incentives.ts rename to proposals/description/old/end_tribe_incentives.ts diff --git a/proposals/description/fip_104.ts b/proposals/description/old/fip_104.ts similarity index 100% rename from proposals/description/fip_104.ts rename to proposals/description/old/fip_104.ts diff --git a/proposals/description/oa_cr_fix.ts b/proposals/description/old/oa_cr_fix.ts similarity index 100% rename from proposals/description/oa_cr_fix.ts rename to proposals/description/old/oa_cr_fix.ts diff --git a/proposals/description/register_proposal.ts b/proposals/description/old/register_proposal.ts similarity index 100% rename from proposals/description/register_proposal.ts rename to proposals/description/old/register_proposal.ts diff --git a/proposals/description/repay_fuse_bad_debt.ts b/proposals/description/old/repay_fuse_bad_debt.ts similarity index 100% rename from proposals/description/repay_fuse_bad_debt.ts rename to proposals/description/old/repay_fuse_bad_debt.ts diff --git a/proposals/description/withdraw_d3_pool.ts b/proposals/description/old/withdraw_d3_pool.ts similarity index 100% rename from proposals/description/withdraw_d3_pool.ts rename to proposals/description/old/withdraw_d3_pool.ts diff --git a/protocol-configuration/mainnetAddresses.ts b/protocol-configuration/mainnetAddresses.ts index be2665256..20b1ac925 100644 --- a/protocol-configuration/mainnetAddresses.ts +++ b/protocol-configuration/mainnetAddresses.ts @@ -1,6 +1,6 @@ -import { MainnetAddresses, AddressCategory } from '../types/types'; // imported without custom path to allow docs to autogen without ts errors +import { MainnetContractsConfig, AddressCategory } from '../types/types'; // imported without custom path to allow docs to autogen without ts errors -const MainnetAddresses: MainnetAddresses = { +const MainnetContractsConfig: MainnetContractsConfig = { core: { artifactName: AddressCategory.Core, address: '0x8d5ED43dCa8C2F7dFB20CF7b53CC7E593635d7b9', @@ -2145,4 +2145,4 @@ const MainnetAddresses: MainnetAddresses = { } }; -export default MainnetAddresses; +export default MainnetContractsConfig; diff --git a/test/integration/setup/loadContracts.ts b/test/integration/setup/loadContracts.ts index c2dae32dc..cc9c0e1dc 100644 --- a/test/integration/setup/loadContracts.ts +++ b/test/integration/setup/loadContracts.ts @@ -1,18 +1,9 @@ import mainnetAddresses from '@protocol/mainnetAddresses'; import { artifacts, ethers } from 'hardhat'; -import { MainnetContracts, NamedAddresses } from '@custom-types/types'; - -interface MainnetContractJSONEntry { - artifactName: string; - address: string; -} - -interface MainnetContractsJSON { - [key: string]: MainnetContractJSONEntry; -} +import { MainnetContracts, MainnetContractsConfig, NamedAddresses } from '@custom-types/types'; export async function getAllContracts(): Promise { - const addresses = mainnetAddresses as MainnetContractsJSON; + const addresses = mainnetAddresses as MainnetContractsConfig; const contractsAsArrayEntries = await Promise.all( Object.entries(addresses) .filter((entry) => entry[1].artifactName != 'unknown') @@ -26,7 +17,7 @@ export async function getAllContracts(): Promise { export function getAllContractAddresses(): NamedAddresses { const contracts: NamedAddresses = {}; - const addresses = mainnetAddresses as MainnetContractsJSON; + const addresses = mainnetAddresses as MainnetContractsConfig; for (const mainnetAddressEntryName in addresses) { const mainnetAddressEntry = addresses[mainnetAddressEntryName]; diff --git a/types/types.ts b/types/types.ts index 18fb658c4..734576961 100644 --- a/types/types.ts +++ b/types/types.ts @@ -98,8 +98,8 @@ export type ProposalCommand = { description: string; }; -export interface MainnetAddresses { - [key: string]: AddressConfig; +export interface MainnetContractsConfig { + [key: string]: ContractConfig; } export type TribalChiefPoolConfig = { @@ -111,7 +111,7 @@ export interface TribalChiefConfig { [key: string]: TribalChiefPoolConfig; } -export interface AddressConfig { +export interface ContractConfig { artifactName: string; address: string; category: AddressCategory; From ac26efb0e1c92b7bd19574a380b6166b50aaa6fe Mon Sep 17 00:00:00 2001 From: Joey Santoro Date: Sun, 5 Jun 2022 10:31:23 -0700 Subject: [PATCH 222/274] proposal cleanup --- proposals/dao/eth_lbp.ts | 126 ++++++++++++++----------------- proposals/description/eth_lbp.ts | 36 +++------ 2 files changed, 66 insertions(+), 96 deletions(-) diff --git a/proposals/dao/eth_lbp.ts b/proposals/dao/eth_lbp.ts index efd8a955e..0b407d9ff 100644 --- a/proposals/dao/eth_lbp.ts +++ b/proposals/dao/eth_lbp.ts @@ -41,12 +41,12 @@ const deploy: DeployUpgradeFunc = async (deployAddress: string, addresses: Named // Oracle reports WETH price in terms of USD, so should not be inverted // Specifically reports: 101258471470000000000, which is $101. As expected - const ethToDaiSwapper = await BalancerLBPSwapperFactory.deploy( + const ethToDaiLBPSwapper = await BalancerLBPSwapperFactory.deploy( addresses.core, { _oracle: addresses.chainlinkEthUsdOracleWrapper, _backupOracle: ethers.constants.AddressZero, - _invertOraclePrice: true, + _invertOraclePrice: false, _decimalsNormalizer: 0 }, LBP_FREQUENCY, @@ -58,8 +58,8 @@ const deploy: DeployUpgradeFunc = async (deployAddress: string, addresses: Named MIN_LBP_SIZE // minimum size of a pool which the swapper is used against ); - await ethToDaiSwapper.deployed(); - logging && console.log('WETH to DAI swapper deployed to: ', ethToDaiSwapper.address); + await ethToDaiLBPSwapper.deployed(); + logging && console.log('WETH to DAI swapper deployed to: ', ethToDaiLBPSwapper.address); // 2. Create a liquidity bootstrapping pool between WETH and DAI const lbpFactory = await ethers.getContractAt( @@ -70,10 +70,10 @@ const deploy: DeployUpgradeFunc = async (deployAddress: string, addresses: Named const tx: TransactionResponse = await lbpFactory.create( 'WETH->DAI Auction Pool', // pool name 'apWETH-DAI', // lbp token symbol - [addresses.weth, addresses.dai], // pool contains [WETH, DAI] - [ethers.constants.WeiPerEther.mul(95).div(100), ethers.constants.WeiPerEther.mul(5).div(100)], // initial weights 5%/95% + [addresses.dai, addresses.weth], // pool contains [DAI, WETH] + [ethers.constants.WeiPerEther.mul(5).div(100), ethers.constants.WeiPerEther.mul(95).div(100)], // initial weights 5%/95% ethers.constants.WeiPerEther.mul(30).div(10_000), // 0.3% swap fees - ethToDaiSwapper.address, // pool owner = fei protocol swapper + ethToDaiLBPSwapper.address, // pool owner = fei protocol swapper true ); @@ -86,7 +86,7 @@ const deploy: DeployUpgradeFunc = async (deployAddress: string, addresses: Named logging && console.log('LBP Pool Id: ', poolId); // 3. Initialise the LBP swapper with the pool address - const tx2 = await ethToDaiSwapper.init(noFeeEthDaiLBPAddress); + const tx2 = await ethToDaiLBPSwapper.init(noFeeEthDaiLBPAddress); await tx2.wait(); // 4. Deploy a lens to report the swapper value @@ -115,7 +115,7 @@ const deploy: DeployUpgradeFunc = async (deployAddress: string, addresses: Named logging && console.log('BPTLens for WETH in swapper pool: ', ethToDaiLensEth.address); return { - ethToDaiSwapper, + ethToDaiLBPSwapper, ethToDaiLensDai, ethToDaiLensEth }; @@ -125,10 +125,15 @@ const deploy: DeployUpgradeFunc = async (deployAddress: string, addresses: Named // This could include setting up Hardhat to impersonate accounts, // ensuring contracts have a specific state, etc. const setup: SetupUpgradeFunc = async (addresses, oldContracts, contracts, logging) => { - poolId = '0xd10386804959a121a8a487e49f45aa9f5a2eb2a00002000000000000000001f1'; + // check PSM redeem fee + const psm = contracts.ethPSM; + expect(await psm.redeemFeeBasisPoints()).to.be.equal('75'); + // overwrite chainlink ETH/USD oracle const ethToDaiLBPSwapper = contracts.ethToDaiLBPSwapper; - await overwriteChainlinkAggregator(addresses.chainlinkEthUsdOracle, '250000000000', '8'); + poolId = await ethToDaiLBPSwapper.pid(); + + await overwriteChainlinkAggregator(addresses.chainlinkEthUsdOracle, '200000000000', '8'); // $2000 ETH // invariant checks expect(await ethToDaiLBPSwapper.tokenSpent()).to.be.equal(addresses.weth); @@ -136,8 +141,8 @@ const setup: SetupUpgradeFunc = async (addresses, oldContracts, contracts, loggi expect(await ethToDaiLBPSwapper.tokenReceivingAddress()).to.be.equal(addresses.compoundDaiPCVDeposit); const poolTokens = await contracts.balancerVault.getPoolTokens(poolId); - expect(poolTokens.tokens[0]).to.be.equal(addresses.weth); - expect(poolTokens.tokens[1]).to.be.equal(addresses.dai); + expect(poolTokens.tokens[0]).to.be.equal(addresses.dai); + expect(poolTokens.tokens[1]).to.be.equal(addresses.weth); // LBP swapper should be empty expect(poolTokens.balances[0]).to.be.equal('0'); @@ -153,7 +158,10 @@ const setup: SetupUpgradeFunc = async (addresses, oldContracts, contracts, loggi console.log('Starting DAI PSM dai balance [M]', (await contracts.compoundDaiPCVDeposit.balance()) / 1e24); + console.log('DAI needed', await ethToDaiLBPSwapper.getTokensIn(ethers.constants.WeiPerEther.mul(20_000))); await forceEth(addresses.tribalCouncilTimelock); + + await time.increase(LBP_FREQUENCY); }; // Tears down any changes made in setup() that need to be @@ -166,32 +174,36 @@ const teardown: TeardownUpgradeFunc = async (addresses, oldContracts, contracts, // IE check balances, check state of contracts, etc. const validate: ValidateUpgradeFunc = async (addresses, oldContracts, contracts, logging) => { const core = contracts.core; - poolId = '0xd10386804959a121a8a487e49f45aa9f5a2eb2a00002000000000000000001f1'; + const ethToDaiLBPSwapper = contracts.ethToDaiLBPSwapper; + poolId = await ethToDaiLBPSwapper.pid(); + console.log('Final DAI PSM dai balance [M]', (await contracts.compoundDaiPCVDeposit.balance()) / 1e24); //////////// 1. New Safe adddresses ////////////// expect(await contracts.pcvGuardianNew.isSafeAddress(addresses.ethToDaiLBPSwapper)).to.be.true; - ///////////// 2. WETH LBP //////////////// + ///////////// 2. WETH LBP //////////////// await validateLBPSetup(contracts, addresses, poolId); - // Validate SWAP_ADMIN_ROLE is under ROLE_ADMIN and that TribalCouncilTimelock has the role - expect(await core.hasRole(ethers.utils.id('SWAP_ADMIN_ROLE'), addresses.tribalCouncilTimelock)).to.be.true; - expect(await core.getRoleAdmin(ethers.utils.id('SWAP_ADMIN_ROLE'))).to.be.equal(ethers.utils.id('ROLE_ADMIN')); + ///////////// 3. PSM Redeem //////////////// + + // check PSM redeem fee + const psm = contracts.ethPSM; + expect(await psm.redeemFeeBasisPoints()).to.be.equal('60'); + + // Validate PSM_ADMIN_ROLE is under ROLE_ADMIN and that TribalCouncilTimelock has the role + expect(await core.hasRole(ethers.utils.id('PSM_ADMIN_ROLE'), addresses.tribalCouncilTimelock)).to.be.true; + expect(await core.getRoleAdmin(ethers.utils.id('PSM_ADMIN_ROLE'))).to.be.equal(ethers.utils.id('ROLE_ADMIN')); }; const validateLBPSetup = async (contracts: NamedContracts, addresses: NamedAddresses, poolId: string) => { const ethToDaiLBPSwapper = contracts.ethToDaiLBPSwapper; - const ethToDaiLBPPool = contracts.ethToDaiLBPPool; - - const retrievedPoolId = await ethToDaiLBPPool.getPoolId(); - expect(retrievedPoolId).to.equal(poolId); // expect(await ethToDaiLBPSwapper.doInvert()).to.be.equal(true); expect(await ethToDaiLBPSwapper.isTimeStarted()).to.be.true; expect(await ethToDaiLBPSwapper.tokenSpent()).to.equal(addresses.weth); expect(await ethToDaiLBPSwapper.tokenReceived()).to.equal(addresses.dai); - expect(await ethToDaiLBPPool.getSwapEnabled()).to.equal(true); + // tokenSpent = WETH // tokenReceived = DAI // On BalancerVault, token[0] = WETH, token[1] = DAI @@ -200,33 +212,30 @@ const validateLBPSetup = async (contracts: NamedContracts, addresses: NamedAddre // 2.1 Check oracle price const price = (await ethToDaiLBPSwapper.readOracle())[0]; // DAI price in units of WETH console.log('price: ', price); - expect(price).to.be.bignumber.at.least(ethers.constants.WeiPerEther.mul(90)); // 90e18 - expect(price).to.be.bignumber.at.most(ethers.constants.WeiPerEther.mul(100)); // 100e18 + expect(price).to.be.bignumber.at.least(ethers.constants.WeiPerEther.mul(1600)); // 1600e18 + expect(price).to.be.bignumber.at.most(ethers.constants.WeiPerEther.mul(2200)); // 2200e18 // 2.2 Check relative price in pool - // Putting in 100,000 tokens of WETH, getting an amount of DAI back - const response = await ethToDaiLBPSwapper.getTokensIn(100000); // input is spent token balance, 100,000 WETH tokens + + // Putting in 20,000 tokens of WETH, getting an amount of DAI back + const response = await ethToDaiLBPSwapper.getTokensIn(20000); // input is spent token balance, 100,000 WETH tokens const amounts = response[1]; - expect(amounts[0]).to.be.bignumber.equal(ethers.BigNumber.from(100000)); // WETH // DAI/WETH price * DAI amount * 5% ~= amount - expectApprox(price.mul(100000).mul(5).div(ethers.constants.WeiPerEther).div(100), amounts[1]); // DAI - expect(amounts[1]).to.be.bignumber.at.least(toBN(1000)); // Make sure orcacle inversion is correct (i.e. not inverted) + expectApprox(price.mul(20000).mul(5).div(ethers.constants.WeiPerEther).div(100), amounts[1]); // DAI + expect(amounts[0]).to.be.bignumber.at.least(toBN(2_000_000)); // Make sure orcacle inversion is correct (i.e. not inverted) - // 2.3 Check pool weights - const weights = await ethToDaiLBPPool.getNormalizedWeights(); - expectApprox(weights[0], ethers.constants.WeiPerEther.mul(5).div(100)); // 5% DAI - expectApprox(weights[1], ethers.constants.WeiPerEther.mul(95).div(100)); // 95% WETH + expect(amounts[1]).to.be.bignumber.equal(ethers.BigNumber.from(20000)); // WETH - // 2.4 Check pool info + // 2.3 Check pool info const poolTokens = await contracts.balancerVault.getPoolTokens(poolId); - // there should be 188k DAI in the pool - expect(poolTokens.tokens[1]).to.be.equal(contracts.dai.address); // this is DAI - expect(poolTokens.balances[1]).to.be.bignumber.at.least(ethers.constants.WeiPerEther.mul(185_000)); - expect(poolTokens.balances[1]).to.be.bignumber.at.most(ethers.constants.WeiPerEther.mul(200_000)); - // there should be 37k WETH in the pool - expect(poolTokens.tokens[0]).to.be.equal(contracts.weth.address); // this is WETH - expect(poolTokens.balances[0]).to.be.equal('37888449801955370645659'); + // there should be 2.1M DAI in the pool + expect(poolTokens.tokens[0]).to.be.equal(contracts.dai.address); // this is DAI + expect(poolTokens.balances[0]).to.be.bignumber.at.least(ethers.constants.WeiPerEther.mul(2_000_000)); + expect(poolTokens.balances[0]).to.be.bignumber.at.most(ethers.constants.WeiPerEther.mul(2_200_000)); + // there should be 20k WETH in the pool + expect(poolTokens.tokens[1]).to.be.equal(contracts.weth.address); // this is WETH + expect(poolTokens.balances[1]).to.be.equal('20000000000000000000000'); // Pool balances Maths: // Total value of pool = (188k DAI * $1) + (37k WETH * $93) = $3.63M @@ -271,39 +280,14 @@ const validateLBPSetup = async (contracts: NamedContracts, addresses: NamedAddre expect(daiSpent).to.be.bignumber.equal(amountIn); const ethGained = postUserEthBalance.sub(initialUserEthBalance); - expect(ethGained).to.be.bignumber.at.least(ethers.constants.WeiPerEther.mul(80)); - expect(ethGained).to.be.bignumber.at.most(ethers.constants.WeiPerEther.mul(120)); + expect(ethGained).to.be.bignumber.at.least(ethers.constants.WeiPerEther.mul(4)); + expect(ethGained).to.be.bignumber.at.most(ethers.constants.WeiPerEther.mul(6)); - // Put in 10k DAI, got out 101 WETH - // Implies price of $98.5 per WETH, compared to an oracle price of $95.6 + // Put in 10k DAI, got out ~5 WETH + // Implies price of $2000 per WETH console.log('DAI spent: ', daiSpent); console.log('WETH gained: ', ethGained); - await time.increase(86400 * 7); - // Perform second swap, check price goes down - await contracts.dai.connect(daiWhaleSigner).approve(addresses.balancerVault, amountIn); - await contracts.balancerVault.connect(daiWhaleSigner).swap( - { - poolId: poolId, - kind: 0, - assetIn: addresses.dai, - assetOut: addresses.weth, - amount: amountIn, - userData: '0x' - }, - { - sender: daiWhale, - fromInternalBalance: false, - recipient: daiWhale, - toInternalBalance: false - }, - 0, - '10000000000000000000000' - ); - const secondSwapWETHAmount = (await contracts.weth.balanceOf(daiWhale)).sub(postUserEthBalance); - // If price has dropped, then for the same DAI the user gets more WETH - expect(secondSwapWETHAmount).to.be.bignumber.greaterThan(ethGained); - // Accelerate time and check ended await time.increase(LBP_FREQUENCY); expect(await ethToDaiLBPSwapper.isTimeEnded()).to.be.true; diff --git a/proposals/description/eth_lbp.ts b/proposals/description/eth_lbp.ts index 6661cbb5b..2390794a7 100644 --- a/proposals/description/eth_lbp.ts +++ b/proposals/description/eth_lbp.ts @@ -12,31 +12,24 @@ const eth_lbp: ProposalDescription = { }, //////// ETH LBP //////// { - target: 'aaveEthPCVDeposit', + target: 'pcvGuardianNew', values: '0', - method: 'withdraw(address,uint256)', - arguments: ['{ethToDaiLBPSwapper}', '20000000000000000000000'], - description: 'Transfer DPI from DAO timelock to the LBP swapper' + method: 'withdrawToSafeAddress(address,address,uint256,bool,bool)', + arguments: ['{aaveEthPCVDeposit}', '{ethToDaiLBPSwapper}', '20000000000000000000000', false, false], + description: 'Transfer WETH from Aave to the LBP swapper' }, { - target: 'compoundDaiPCVDeposit', + target: 'pcvGuardianNew', values: '0', - method: 'withdraw(address,uint256)', - arguments: ['{ethToDaiLBPSwapper}', '2000000000000000000000000'], - description: 'Withdraw 2M DAI from the CompoundPCVDeposit and transfer to the LBP pool' + method: 'withdrawToSafeAddress(address,address,uint256,bool,bool)', + arguments: ['{compoundDaiPCVDeposit}', '{ethToDaiLBPSwapper}', '3000000000000000000000000', false, false], + description: 'Withdraw 3M DAI from the CompoundPCVDeposit and transfer to the LBP pool' }, - // Correcting the oracle needs to happen before forceSwap() - // { - // target: 'ethToDaiLBPSwapper', - // values: '0', - // method: 'setDoInvert(bool)', - // arguments: [false], - // description: 'Set the dpiToDai LBP swapper to not invert' - // }, + // Swap and update CR oracle { target: 'ethToDaiLBPSwapper', values: '0', - method: 'forceSwap()', + method: 'swap()', arguments: [], description: 'Start the auction and override the current no-op auction' }, @@ -54,14 +47,7 @@ const eth_lbp: ProposalDescription = { arguments: ['{ethToDaiLensEth}'], description: 'Add ETH swapper lens to the CR oracle' }, - //////// Tighten ETH PSM ////////// - { - target: 'core', - values: '0', - method: 'grantRole(bytes32,address)', - arguments: ['0x1749ca1ca3564d20da6efea465c2a5ae869a9e4b006da7035e688beb14d704e0', '{tribalCouncilTimelock}'], - description: 'Grant TribalCouncilTimelock PSM_ADMIN_ROLE so it can tighten ETH redemption spread' - }, + ////// Tighten ETH PSM ////////// { target: 'ethPSM', values: '0', From 663d0712876d21e4218f952afbd4be043fd8bf3e Mon Sep 17 00:00:00 2001 From: Joey Santoro Date: Sun, 5 Jun 2022 10:33:59 -0700 Subject: [PATCH 223/274] remove .only --- test/integration/tests/backstop.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/integration/tests/backstop.ts b/test/integration/tests/backstop.ts index 76124a5f5..9988b00cd 100644 --- a/test/integration/tests/backstop.ts +++ b/test/integration/tests/backstop.ts @@ -44,7 +44,7 @@ describe('e2e-backstop', function () { doLogging && console.log(`Environment loaded.`); }); - describe.only('TribeMinter', async function () { + describe('TribeMinter', async function () { it('mint TRIBE', async function () { const { tribeMinter, tribe } = contracts; const tribeSupply = await tribe.totalSupply(); From ed985de04e06896908f913f315cf4b3a5270a76c Mon Sep 17 00:00:00 2001 From: Joey Santoro Date: Sun, 5 Jun 2022 10:38:34 -0700 Subject: [PATCH 224/274] skip dependencies test --- test/integration/proposals_config.ts | 120 ++++++++++++------------- test/integration/tests/dependencies.ts | 2 +- 2 files changed, 61 insertions(+), 61 deletions(-) diff --git a/test/integration/proposals_config.ts b/test/integration/proposals_config.ts index fa61dff00..4b0d168ad 100644 --- a/test/integration/proposals_config.ts +++ b/test/integration/proposals_config.ts @@ -14,67 +14,67 @@ const proposals: ProposalsConfigMap = { affectedContractSignoff: [], deprecatedContractSignoff: [], category: ProposalCategory.TC + }, + register_proposal: { + deploy: false, // deploy flag for whether to run deploy action during e2e tests or use mainnet state + totalValue: 0, // amount of ETH to send to DAO execution + proposal: register_proposal, // full proposal file, imported from '@proposals/description/fip_xx.ts' + proposalId: '', + affectedContractSignoff: ['core'], + deprecatedContractSignoff: [], + category: ProposalCategory.TC + }, + repay_fuse_bad_debt: { + deploy: false, // deploy flag for whether to run deploy action during e2e tests or use mainnet state + totalValue: 0, // amount of ETH to send to DAO execution + proposal: repay_fuse_bad_debt, // full proposal file, imported from '@proposals/description/fip_xx.ts' + proposalId: '', + affectedContractSignoff: ['core', 'fuseFixer', 'pcvGuardianNew'], + deprecatedContractSignoff: [], + category: ProposalCategory.TC + }, + end_tribe_incentives: { + deploy: false, // deploy flag for whether to run deploy action during e2e tests or use mainnet state + totalValue: 0, // amount of ETH to send to DAO execution + proposal: end_tribe_incentives, // full proposal file, imported from '@proposals/description/fip_xx.ts' + proposalId: '', + affectedContractSignoff: [ + 'core', + 'tribalChief', + 'tribalCouncilTimelock', + 'collateralizationOracle', + 'opsOptimisticTimelock' + ], + deprecatedContractSignoff: [ + 'creamDepositWrapper', + 'fei3CrvAutoRewardsDistributor', + 'd3AutoRewardsDistributor', + 'autoRewardsDistributor', + 'feiDaiAutoRewardsDistributor', + 'feiUsdcAutoRewardsDistributor', + 'stakingTokenWrapperRari', + 'stakingTokenWrapperFOXLaaS', + 'stakingTokenWrapperGROLaaS', + 'stakingTokenWrapperKYLINLaaS', + 'stakingTokenWrapperMStableLaaS', + 'stakingTokenWrapperNEARLaaS', + 'stakingTokenWrapperPoolTogetherLaaS', + 'stakingTokenWrapperUMALaaS', + 'stakingTokenWrapperSYNLaaS', + 'rewardsDistributorAdmin', + 'stwBulkHarvest', + 'stakingTokenWrapperBribeD3pool', + 'fei3CrvStakingtokenWrapper', + 'feiDaiStakingTokenWrapper', + 'feiUsdcStakingTokenWrapper', + 'stakingTokenWrapperBribe3Crvpool', + 'tribalChiefSyncV2', + 'tribalChiefSyncExtension', + 'd3StakingTokenWrapper', + 'votiumBriberD3pool' + ], + category: ProposalCategory.TC } - // register_proposal: { - // deploy: false, // deploy flag for whether to run deploy action during e2e tests or use mainnet state - // totalValue: 0, // amount of ETH to send to DAO execution - // proposal: register_proposal, // full proposal file, imported from '@proposals/description/fip_xx.ts' - // proposalId: '', - // affectedContractSignoff: ['core'], - // deprecatedContractSignoff: [], - // category: ProposalCategory.TC - // }, - // repay_fuse_bad_debt: { - // deploy: false, // deploy flag for whether to run deploy action during e2e tests or use mainnet state - // totalValue: 0, // amount of ETH to send to DAO execution - // proposal: repay_fuse_bad_debt, // full proposal file, imported from '@proposals/description/fip_xx.ts' - // proposalId: '', - // affectedContractSignoff: ['core', 'fuseFixer', 'pcvGuardianNew'], - // deprecatedContractSignoff: [], - // category: ProposalCategory.TC - // }, - // end_tribe_incentives: { - // deploy: false, // deploy flag for whether to run deploy action during e2e tests or use mainnet state - // totalValue: 0, // amount of ETH to send to DAO execution - // proposal: end_tribe_incentives, // full proposal file, imported from '@proposals/description/fip_xx.ts' - // proposalId: '', - // affectedContractSignoff: [ - // 'core', - // 'tribalChief', - // 'tribalCouncilTimelock', - // 'collateralizationOracle', - // 'opsOptimisticTimelock' - // ], - // deprecatedContractSignoff: [ - // 'creamDepositWrapper', - // 'fei3CrvAutoRewardsDistributor', - // 'd3AutoRewardsDistributor', - // 'autoRewardsDistributor', - // 'feiDaiAutoRewardsDistributor', - // 'feiUsdcAutoRewardsDistributor', - // 'stakingTokenWrapperRari', - // 'stakingTokenWrapperFOXLaaS', - // 'stakingTokenWrapperGROLaaS', - // 'stakingTokenWrapperKYLINLaaS', - // 'stakingTokenWrapperMStableLaaS', - // 'stakingTokenWrapperNEARLaaS', - // 'stakingTokenWrapperPoolTogetherLaaS', - // 'stakingTokenWrapperUMALaaS', - // 'stakingTokenWrapperSYNLaaS', - // 'rewardsDistributorAdmin', - // 'stwBulkHarvest', - // 'stakingTokenWrapperBribeD3pool', - // 'fei3CrvStakingtokenWrapper', - // 'feiDaiStakingTokenWrapper', - // 'feiUsdcStakingTokenWrapper', - // 'stakingTokenWrapperBribe3Crvpool', - // 'tribalChiefSyncV2', - // 'tribalChiefSyncExtension', - // 'd3StakingTokenWrapper', - // 'votiumBriberD3pool' - // ], - // category: ProposalCategory.TC - // } }; export default proposals; diff --git a/test/integration/tests/dependencies.ts b/test/integration/tests/dependencies.ts index ce25a9cd3..747303c4e 100644 --- a/test/integration/tests/dependencies.ts +++ b/test/integration/tests/dependencies.ts @@ -6,7 +6,7 @@ import addresses from '@protocol/mainnetAddresses'; import collateralizationAddresses from '@protocol/collateralizationOracle'; import { AddressCategory } from '@custom-types/types'; // imported without custom path to allow docs to autogen without ts errors -describe('e2e-dependencies', function () { +describe.skip('e2e-dependencies', function () { const doLogging = Boolean(process.env.LOGGING); let proposalNames: string[]; From 933b6f5a1653d602717f2cacab127457c084ee37 Mon Sep 17 00:00:00 2001 From: Joey Santoro Date: Sun, 5 Jun 2022 10:43:59 -0700 Subject: [PATCH 225/274] Revert "skip dependencies test" This reverts commit ed985de04e06896908f913f315cf4b3a5270a76c. --- test/integration/proposals_config.ts | 120 ++++++++++++------------- test/integration/tests/dependencies.ts | 2 +- 2 files changed, 61 insertions(+), 61 deletions(-) diff --git a/test/integration/proposals_config.ts b/test/integration/proposals_config.ts index 4b0d168ad..fa61dff00 100644 --- a/test/integration/proposals_config.ts +++ b/test/integration/proposals_config.ts @@ -14,67 +14,67 @@ const proposals: ProposalsConfigMap = { affectedContractSignoff: [], deprecatedContractSignoff: [], category: ProposalCategory.TC - }, - register_proposal: { - deploy: false, // deploy flag for whether to run deploy action during e2e tests or use mainnet state - totalValue: 0, // amount of ETH to send to DAO execution - proposal: register_proposal, // full proposal file, imported from '@proposals/description/fip_xx.ts' - proposalId: '', - affectedContractSignoff: ['core'], - deprecatedContractSignoff: [], - category: ProposalCategory.TC - }, - repay_fuse_bad_debt: { - deploy: false, // deploy flag for whether to run deploy action during e2e tests or use mainnet state - totalValue: 0, // amount of ETH to send to DAO execution - proposal: repay_fuse_bad_debt, // full proposal file, imported from '@proposals/description/fip_xx.ts' - proposalId: '', - affectedContractSignoff: ['core', 'fuseFixer', 'pcvGuardianNew'], - deprecatedContractSignoff: [], - category: ProposalCategory.TC - }, - end_tribe_incentives: { - deploy: false, // deploy flag for whether to run deploy action during e2e tests or use mainnet state - totalValue: 0, // amount of ETH to send to DAO execution - proposal: end_tribe_incentives, // full proposal file, imported from '@proposals/description/fip_xx.ts' - proposalId: '', - affectedContractSignoff: [ - 'core', - 'tribalChief', - 'tribalCouncilTimelock', - 'collateralizationOracle', - 'opsOptimisticTimelock' - ], - deprecatedContractSignoff: [ - 'creamDepositWrapper', - 'fei3CrvAutoRewardsDistributor', - 'd3AutoRewardsDistributor', - 'autoRewardsDistributor', - 'feiDaiAutoRewardsDistributor', - 'feiUsdcAutoRewardsDistributor', - 'stakingTokenWrapperRari', - 'stakingTokenWrapperFOXLaaS', - 'stakingTokenWrapperGROLaaS', - 'stakingTokenWrapperKYLINLaaS', - 'stakingTokenWrapperMStableLaaS', - 'stakingTokenWrapperNEARLaaS', - 'stakingTokenWrapperPoolTogetherLaaS', - 'stakingTokenWrapperUMALaaS', - 'stakingTokenWrapperSYNLaaS', - 'rewardsDistributorAdmin', - 'stwBulkHarvest', - 'stakingTokenWrapperBribeD3pool', - 'fei3CrvStakingtokenWrapper', - 'feiDaiStakingTokenWrapper', - 'feiUsdcStakingTokenWrapper', - 'stakingTokenWrapperBribe3Crvpool', - 'tribalChiefSyncV2', - 'tribalChiefSyncExtension', - 'd3StakingTokenWrapper', - 'votiumBriberD3pool' - ], - category: ProposalCategory.TC } + // register_proposal: { + // deploy: false, // deploy flag for whether to run deploy action during e2e tests or use mainnet state + // totalValue: 0, // amount of ETH to send to DAO execution + // proposal: register_proposal, // full proposal file, imported from '@proposals/description/fip_xx.ts' + // proposalId: '', + // affectedContractSignoff: ['core'], + // deprecatedContractSignoff: [], + // category: ProposalCategory.TC + // }, + // repay_fuse_bad_debt: { + // deploy: false, // deploy flag for whether to run deploy action during e2e tests or use mainnet state + // totalValue: 0, // amount of ETH to send to DAO execution + // proposal: repay_fuse_bad_debt, // full proposal file, imported from '@proposals/description/fip_xx.ts' + // proposalId: '', + // affectedContractSignoff: ['core', 'fuseFixer', 'pcvGuardianNew'], + // deprecatedContractSignoff: [], + // category: ProposalCategory.TC + // }, + // end_tribe_incentives: { + // deploy: false, // deploy flag for whether to run deploy action during e2e tests or use mainnet state + // totalValue: 0, // amount of ETH to send to DAO execution + // proposal: end_tribe_incentives, // full proposal file, imported from '@proposals/description/fip_xx.ts' + // proposalId: '', + // affectedContractSignoff: [ + // 'core', + // 'tribalChief', + // 'tribalCouncilTimelock', + // 'collateralizationOracle', + // 'opsOptimisticTimelock' + // ], + // deprecatedContractSignoff: [ + // 'creamDepositWrapper', + // 'fei3CrvAutoRewardsDistributor', + // 'd3AutoRewardsDistributor', + // 'autoRewardsDistributor', + // 'feiDaiAutoRewardsDistributor', + // 'feiUsdcAutoRewardsDistributor', + // 'stakingTokenWrapperRari', + // 'stakingTokenWrapperFOXLaaS', + // 'stakingTokenWrapperGROLaaS', + // 'stakingTokenWrapperKYLINLaaS', + // 'stakingTokenWrapperMStableLaaS', + // 'stakingTokenWrapperNEARLaaS', + // 'stakingTokenWrapperPoolTogetherLaaS', + // 'stakingTokenWrapperUMALaaS', + // 'stakingTokenWrapperSYNLaaS', + // 'rewardsDistributorAdmin', + // 'stwBulkHarvest', + // 'stakingTokenWrapperBribeD3pool', + // 'fei3CrvStakingtokenWrapper', + // 'feiDaiStakingTokenWrapper', + // 'feiUsdcStakingTokenWrapper', + // 'stakingTokenWrapperBribe3Crvpool', + // 'tribalChiefSyncV2', + // 'tribalChiefSyncExtension', + // 'd3StakingTokenWrapper', + // 'votiumBriberD3pool' + // ], + // category: ProposalCategory.TC + // } }; export default proposals; diff --git a/test/integration/tests/dependencies.ts b/test/integration/tests/dependencies.ts index 747303c4e..ce25a9cd3 100644 --- a/test/integration/tests/dependencies.ts +++ b/test/integration/tests/dependencies.ts @@ -6,7 +6,7 @@ import addresses from '@protocol/mainnetAddresses'; import collateralizationAddresses from '@protocol/collateralizationOracle'; import { AddressCategory } from '@custom-types/types'; // imported without custom path to allow docs to autogen without ts errors -describe.skip('e2e-dependencies', function () { +describe('e2e-dependencies', function () { const doLogging = Boolean(process.env.LOGGING); let proposalNames: string[]; From 78b51aa361ed20c78677db70634be73dc662b59c Mon Sep 17 00:00:00 2001 From: Joey Santoro Date: Sun, 5 Jun 2022 10:52:00 -0700 Subject: [PATCH 226/274] proposals config --- test/integration/proposals_config.ts | 120 +++++++++++++-------------- 1 file changed, 60 insertions(+), 60 deletions(-) diff --git a/test/integration/proposals_config.ts b/test/integration/proposals_config.ts index fa61dff00..4b0d168ad 100644 --- a/test/integration/proposals_config.ts +++ b/test/integration/proposals_config.ts @@ -14,67 +14,67 @@ const proposals: ProposalsConfigMap = { affectedContractSignoff: [], deprecatedContractSignoff: [], category: ProposalCategory.TC + }, + register_proposal: { + deploy: false, // deploy flag for whether to run deploy action during e2e tests or use mainnet state + totalValue: 0, // amount of ETH to send to DAO execution + proposal: register_proposal, // full proposal file, imported from '@proposals/description/fip_xx.ts' + proposalId: '', + affectedContractSignoff: ['core'], + deprecatedContractSignoff: [], + category: ProposalCategory.TC + }, + repay_fuse_bad_debt: { + deploy: false, // deploy flag for whether to run deploy action during e2e tests or use mainnet state + totalValue: 0, // amount of ETH to send to DAO execution + proposal: repay_fuse_bad_debt, // full proposal file, imported from '@proposals/description/fip_xx.ts' + proposalId: '', + affectedContractSignoff: ['core', 'fuseFixer', 'pcvGuardianNew'], + deprecatedContractSignoff: [], + category: ProposalCategory.TC + }, + end_tribe_incentives: { + deploy: false, // deploy flag for whether to run deploy action during e2e tests or use mainnet state + totalValue: 0, // amount of ETH to send to DAO execution + proposal: end_tribe_incentives, // full proposal file, imported from '@proposals/description/fip_xx.ts' + proposalId: '', + affectedContractSignoff: [ + 'core', + 'tribalChief', + 'tribalCouncilTimelock', + 'collateralizationOracle', + 'opsOptimisticTimelock' + ], + deprecatedContractSignoff: [ + 'creamDepositWrapper', + 'fei3CrvAutoRewardsDistributor', + 'd3AutoRewardsDistributor', + 'autoRewardsDistributor', + 'feiDaiAutoRewardsDistributor', + 'feiUsdcAutoRewardsDistributor', + 'stakingTokenWrapperRari', + 'stakingTokenWrapperFOXLaaS', + 'stakingTokenWrapperGROLaaS', + 'stakingTokenWrapperKYLINLaaS', + 'stakingTokenWrapperMStableLaaS', + 'stakingTokenWrapperNEARLaaS', + 'stakingTokenWrapperPoolTogetherLaaS', + 'stakingTokenWrapperUMALaaS', + 'stakingTokenWrapperSYNLaaS', + 'rewardsDistributorAdmin', + 'stwBulkHarvest', + 'stakingTokenWrapperBribeD3pool', + 'fei3CrvStakingtokenWrapper', + 'feiDaiStakingTokenWrapper', + 'feiUsdcStakingTokenWrapper', + 'stakingTokenWrapperBribe3Crvpool', + 'tribalChiefSyncV2', + 'tribalChiefSyncExtension', + 'd3StakingTokenWrapper', + 'votiumBriberD3pool' + ], + category: ProposalCategory.TC } - // register_proposal: { - // deploy: false, // deploy flag for whether to run deploy action during e2e tests or use mainnet state - // totalValue: 0, // amount of ETH to send to DAO execution - // proposal: register_proposal, // full proposal file, imported from '@proposals/description/fip_xx.ts' - // proposalId: '', - // affectedContractSignoff: ['core'], - // deprecatedContractSignoff: [], - // category: ProposalCategory.TC - // }, - // repay_fuse_bad_debt: { - // deploy: false, // deploy flag for whether to run deploy action during e2e tests or use mainnet state - // totalValue: 0, // amount of ETH to send to DAO execution - // proposal: repay_fuse_bad_debt, // full proposal file, imported from '@proposals/description/fip_xx.ts' - // proposalId: '', - // affectedContractSignoff: ['core', 'fuseFixer', 'pcvGuardianNew'], - // deprecatedContractSignoff: [], - // category: ProposalCategory.TC - // }, - // end_tribe_incentives: { - // deploy: false, // deploy flag for whether to run deploy action during e2e tests or use mainnet state - // totalValue: 0, // amount of ETH to send to DAO execution - // proposal: end_tribe_incentives, // full proposal file, imported from '@proposals/description/fip_xx.ts' - // proposalId: '', - // affectedContractSignoff: [ - // 'core', - // 'tribalChief', - // 'tribalCouncilTimelock', - // 'collateralizationOracle', - // 'opsOptimisticTimelock' - // ], - // deprecatedContractSignoff: [ - // 'creamDepositWrapper', - // 'fei3CrvAutoRewardsDistributor', - // 'd3AutoRewardsDistributor', - // 'autoRewardsDistributor', - // 'feiDaiAutoRewardsDistributor', - // 'feiUsdcAutoRewardsDistributor', - // 'stakingTokenWrapperRari', - // 'stakingTokenWrapperFOXLaaS', - // 'stakingTokenWrapperGROLaaS', - // 'stakingTokenWrapperKYLINLaaS', - // 'stakingTokenWrapperMStableLaaS', - // 'stakingTokenWrapperNEARLaaS', - // 'stakingTokenWrapperPoolTogetherLaaS', - // 'stakingTokenWrapperUMALaaS', - // 'stakingTokenWrapperSYNLaaS', - // 'rewardsDistributorAdmin', - // 'stwBulkHarvest', - // 'stakingTokenWrapperBribeD3pool', - // 'fei3CrvStakingtokenWrapper', - // 'feiDaiStakingTokenWrapper', - // 'feiUsdcStakingTokenWrapper', - // 'stakingTokenWrapperBribe3Crvpool', - // 'tribalChiefSyncV2', - // 'tribalChiefSyncExtension', - // 'd3StakingTokenWrapper', - // 'votiumBriberD3pool' - // ], - // category: ProposalCategory.TC - // } }; export default proposals; From 19c08dd8e4aa4cd4574eb4e57f3ce9c4444817f6 Mon Sep 17 00:00:00 2001 From: Joey Santoro Date: Sun, 5 Jun 2022 11:02:17 -0700 Subject: [PATCH 227/274] CR Oracle --- protocol-configuration/collateralizationOracle.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/protocol-configuration/collateralizationOracle.ts b/protocol-configuration/collateralizationOracle.ts index 6ed1e8c77..3c6035557 100644 --- a/protocol-configuration/collateralizationOracle.ts +++ b/protocol-configuration/collateralizationOracle.ts @@ -13,7 +13,7 @@ const collateralizationAddresses = { 'turboFusePCVDeposit' ], lusd: ['rariPool7LusdPCVDeposit', 'bammDeposit', 'lusdPSM'], - dai: ['compoundDaiPCVDepositWrapper', 'daiFixedPricePSM', 'dpiToDaiLensDai'], + dai: ['compoundDaiPCVDepositWrapper', 'daiFixedPricePSM', 'dpiToDaiLensDai', 'ethToDaiLensDai'], usd: ['namedStaticPCVDepositWrapper', 'd3poolCurvePCVDeposit', 'd3poolConvexPCVDeposit'], bal: ['balancerDepositBalWeth', 'balancerLensVeBalBal', 'balancerGaugeStaker'], weth: [ @@ -26,7 +26,8 @@ const collateralizationAddresses = { 'wethDepositWrapper', 'balancerDepositFeiWeth', 'balancerLensBpt30Fei70Weth', - 'balancerLensVeBalWeth' + 'balancerLensVeBalWeth', + 'ethToDaiLensEth' ], dpi: ['dpiToDaiLensDpi'], rai: ['raiPriceBoundPSM'], From 4909d5fb0e2edfafdfd125c4ebee592948b0ce3f Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 6 Jun 2022 07:26:12 +0000 Subject: [PATCH 228/274] build(deps-dev): bump @types/node from 17.0.38 to 17.0.40 Bumps [@types/node](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/node) from 17.0.38 to 17.0.40. - [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases) - [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/node) --- updated-dependencies: - dependency-name: "@types/node" dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- package-lock.json | 14 +++++++------- package.json | 2 +- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/package-lock.json b/package-lock.json index 55d76c390..65bba4848 100644 --- a/package-lock.json +++ b/package-lock.json @@ -39,7 +39,7 @@ "@typechain/hardhat": "^2.3.0", "@types/chai": "^4.3.1", "@types/mocha": "^9.1.1", - "@types/node": "^17.0.38", + "@types/node": "^17.0.40", "@typescript-eslint/eslint-plugin": "^4.31.2", "@typescript-eslint/parser": "^4.31.2", "chai-bn": "^0.3.1", @@ -4478,9 +4478,9 @@ "dev": true }, "node_modules/@types/node": { - "version": "17.0.38", - "resolved": "https://registry.npmjs.org/@types/node/-/node-17.0.38.tgz", - "integrity": "sha512-5jY9RhV7c0Z4Jy09G+NIDTsCZ5G0L5n+Z+p+Y7t5VJHM30bgwzSjVtlcBxqAj+6L/swIlvtOSzr8rBk/aNyV2g==" + "version": "17.0.40", + "resolved": "https://registry.npmjs.org/@types/node/-/node-17.0.40.tgz", + "integrity": "sha512-UXdBxNGqTMtm7hCwh9HtncFVLrXoqA3oJW30j6XWp5BH/wu3mVeaxo7cq5benFdBw34HB3XDT2TRPI7rXZ+mDg==" }, "node_modules/@types/node-fetch": { "version": "2.6.1", @@ -32435,9 +32435,9 @@ "dev": true }, "@types/node": { - "version": "17.0.38", - "resolved": "https://registry.npmjs.org/@types/node/-/node-17.0.38.tgz", - "integrity": "sha512-5jY9RhV7c0Z4Jy09G+NIDTsCZ5G0L5n+Z+p+Y7t5VJHM30bgwzSjVtlcBxqAj+6L/swIlvtOSzr8rBk/aNyV2g==" + "version": "17.0.40", + "resolved": "https://registry.npmjs.org/@types/node/-/node-17.0.40.tgz", + "integrity": "sha512-UXdBxNGqTMtm7hCwh9HtncFVLrXoqA3oJW30j6XWp5BH/wu3mVeaxo7cq5benFdBw34HB3XDT2TRPI7rXZ+mDg==" }, "@types/node-fetch": { "version": "2.6.1", diff --git a/package.json b/package.json index eb2b45628..9fcf8f7af 100644 --- a/package.json +++ b/package.json @@ -79,7 +79,7 @@ "@typechain/hardhat": "^2.3.0", "@types/chai": "^4.3.1", "@types/mocha": "^9.1.1", - "@types/node": "^17.0.38", + "@types/node": "^17.0.40", "@typescript-eslint/eslint-plugin": "^4.31.2", "@typescript-eslint/parser": "^4.31.2", "chai-bn": "^0.3.1", From 92cd5f8568f052a07ac77ca520867c6e01e63e14 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 6 Jun 2022 07:26:46 +0000 Subject: [PATCH 229/274] build(deps-dev): bump typescript from 4.7.2 to 4.7.3 Bumps [typescript](https://github.com/Microsoft/TypeScript) from 4.7.2 to 4.7.3. - [Release notes](https://github.com/Microsoft/TypeScript/releases) - [Commits](https://github.com/Microsoft/TypeScript/compare/v4.7.2...v4.7.3) --- updated-dependencies: - dependency-name: typescript dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- package-lock.json | 14 +++++++------- package.json | 2 +- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/package-lock.json b/package-lock.json index 55d76c390..7a9ece71f 100644 --- a/package-lock.json +++ b/package-lock.json @@ -63,7 +63,7 @@ "ts-node": "^10.8.0", "tsconfig-paths": "^4.0.0", "typechain": "^5.2.0", - "typescript": "^4.7.2" + "typescript": "^4.7.3" }, "engines": { "node": ">=16.0.0", @@ -27552,9 +27552,9 @@ } }, "node_modules/typescript": { - "version": "4.7.2", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.7.2.tgz", - "integrity": "sha512-Mamb1iX2FDUpcTRzltPxgWMKy3fhg0TN378ylbktPGPK/99KbDtMQ4W1hwgsbPAsG3a0xKa1vmw4VKZQbkvz5A==", + "version": "4.7.3", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.7.3.tgz", + "integrity": "sha512-WOkT3XYvrpXx4vMMqlD+8R8R37fZkjyLGlxavMc4iB8lrl8L0DeTcHbYgw/v0N/z9wAFsgBhcsF0ruoySS22mA==", "bin": { "tsc": "bin/tsc", "tsserver": "bin/tsserver" @@ -50070,9 +50070,9 @@ } }, "typescript": { - "version": "4.7.2", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.7.2.tgz", - "integrity": "sha512-Mamb1iX2FDUpcTRzltPxgWMKy3fhg0TN378ylbktPGPK/99KbDtMQ4W1hwgsbPAsG3a0xKa1vmw4VKZQbkvz5A==" + "version": "4.7.3", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.7.3.tgz", + "integrity": "sha512-WOkT3XYvrpXx4vMMqlD+8R8R37fZkjyLGlxavMc4iB8lrl8L0DeTcHbYgw/v0N/z9wAFsgBhcsF0ruoySS22mA==" }, "typical": { "version": "2.6.1", diff --git a/package.json b/package.json index eb2b45628..91b31d4a4 100644 --- a/package.json +++ b/package.json @@ -103,7 +103,7 @@ "ts-node": "^10.8.0", "tsconfig-paths": "^4.0.0", "typechain": "^5.2.0", - "typescript": "^4.7.2" + "typescript": "^4.7.3" }, "lint-staged": { "*.{ts,tsx}": [ From 868c52a9e56fb790aaa4a56566d0252c26cc87fd Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 6 Jun 2022 07:28:24 +0000 Subject: [PATCH 230/274] build(deps-dev): bump ts-node from 10.8.0 to 10.8.1 Bumps [ts-node](https://github.com/TypeStrong/ts-node) from 10.8.0 to 10.8.1. - [Release notes](https://github.com/TypeStrong/ts-node/releases) - [Commits](https://github.com/TypeStrong/ts-node/compare/v10.8.0...v10.8.1) --- updated-dependencies: - dependency-name: ts-node dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- package-lock.json | 14 +++++++------- package.json | 2 +- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/package-lock.json b/package-lock.json index 55d76c390..2408057b6 100644 --- a/package-lock.json +++ b/package-lock.json @@ -60,7 +60,7 @@ "solhint": "^3.3.7", "solhint-plugin-prettier": "^0.0.5", "solidity-coverage": "^0.7.21", - "ts-node": "^10.8.0", + "ts-node": "^10.8.1", "tsconfig-paths": "^4.0.0", "typechain": "^5.2.0", "typescript": "^4.7.2" @@ -27295,9 +27295,9 @@ "integrity": "sha512-q3N1xS4vZpRouhYHDPwO0bDW3EZ6SK9CrrDHxi/D6BPReSjpVgWIOpLS2o0gSBZm+7q/wyKp6RVM1AeeW7uyfQ==" }, "node_modules/ts-node": { - "version": "10.8.0", - "resolved": "https://registry.npmjs.org/ts-node/-/ts-node-10.8.0.tgz", - "integrity": "sha512-/fNd5Qh+zTt8Vt1KbYZjRHCE9sI5i7nqfD/dzBBRDeVXZXS6kToW6R7tTU6Nd4XavFs0mAVCg29Q//ML7WsZYA==", + "version": "10.8.1", + "resolved": "https://registry.npmjs.org/ts-node/-/ts-node-10.8.1.tgz", + "integrity": "sha512-Wwsnao4DQoJsN034wePSg5nZiw4YKXf56mPIAeD6wVmiv+RytNSWqc2f3fKvcUoV+Yn2+yocD71VOfQHbmVX4g==", "dev": true, "dependencies": { "@cspotcode/source-map-support": "^0.8.0", @@ -49880,9 +49880,9 @@ } }, "ts-node": { - "version": "10.8.0", - "resolved": "https://registry.npmjs.org/ts-node/-/ts-node-10.8.0.tgz", - "integrity": "sha512-/fNd5Qh+zTt8Vt1KbYZjRHCE9sI5i7nqfD/dzBBRDeVXZXS6kToW6R7tTU6Nd4XavFs0mAVCg29Q//ML7WsZYA==", + "version": "10.8.1", + "resolved": "https://registry.npmjs.org/ts-node/-/ts-node-10.8.1.tgz", + "integrity": "sha512-Wwsnao4DQoJsN034wePSg5nZiw4YKXf56mPIAeD6wVmiv+RytNSWqc2f3fKvcUoV+Yn2+yocD71VOfQHbmVX4g==", "dev": true, "requires": { "@cspotcode/source-map-support": "^0.8.0", diff --git a/package.json b/package.json index eb2b45628..93a827c14 100644 --- a/package.json +++ b/package.json @@ -100,7 +100,7 @@ "solhint": "^3.3.7", "solhint-plugin-prettier": "^0.0.5", "solidity-coverage": "^0.7.21", - "ts-node": "^10.8.0", + "ts-node": "^10.8.1", "tsconfig-paths": "^4.0.0", "typechain": "^5.2.0", "typescript": "^4.7.2" From 8d6656113feb0c504b06bdf2377a4837d8a761e9 Mon Sep 17 00:00:00 2001 From: thomas-waite Date: Mon, 6 Jun 2022 14:21:03 +0100 Subject: [PATCH 231/274] refactor: remove unneeded safe addresses, cleanup --- proposals/dao/fip_104b.ts | 11 +++-------- proposals/description/fip_104b.ts | 15 ++++----------- 2 files changed, 7 insertions(+), 19 deletions(-) diff --git a/proposals/dao/fip_104b.ts b/proposals/dao/fip_104b.ts index db3d3ea34..e9b9df9d8 100644 --- a/proposals/dao/fip_104b.ts +++ b/proposals/dao/fip_104b.ts @@ -51,19 +51,14 @@ const teardown: TeardownUpgradeFunc = async (addresses, oldContracts, contracts, // Run any validations required on the fip using mocha or console logging // IE check balances, check state of contracts, etc. const validate: ValidateUpgradeFunc = async (addresses, oldContracts, contracts, logging) => { - // 1. Validate safe addresses set on PCVGuardian - const pcvGuardian = contracts.pcvGuardianNew; - expect(await pcvGuardian.isSafeAddress(addresses.tribalCouncilTimelock)).to.be.true; - - // 2. Validate withdrawn liquidity destinations - const sanityCheckDAIAmount = ethers.constants.WeiPerEther.mul(100_000); + // 1. Validate withdrawn liquidity destinations + const sanityCheckDAIAmount = ethers.constants.WeiPerEther.mul(3_500_000); const finalDAIDepositBalance = await contracts.compoundDaiPCVDeposit.balance(); expect(finalDAIDepositBalance).to.be.bignumber.at.least(initialDaiPCVBalance.add(sanityCheckDAIAmount)); logging && console.log('Final DAI balance: ', finalDAIDepositBalance.toString()); const dpi = contracts.dpi; - - const sanityCheckDPIAmount = ethers.constants.WeiPerEther.mul(100); + const sanityCheckDPIAmount = ethers.constants.WeiPerEther.mul(1500); const finalTCDpiBalance = await dpi.balanceOf(addresses.tribalCouncilSafe); expect(finalTCDpiBalance).to.be.bignumber.at.least(initialTCDpiBalance.add(sanityCheckDPIAmount)); }; diff --git a/proposals/description/fip_104b.ts b/proposals/description/fip_104b.ts index 41dac963f..c7cd2fccb 100644 --- a/proposals/description/fip_104b.ts +++ b/proposals/description/fip_104b.ts @@ -3,19 +3,12 @@ import { ProposalDescription } from '@custom-types/types'; const fip_104b: ProposalDescription = { title: 'FIP_104b: Withdraw LBP liquidity', commands: [ - { - target: 'pcvGuardianNew', - values: '0', - method: 'setSafeAddress(address)', - arguments: ['{tribalCouncilTimelock}'], - description: 'Set the TribalCouncil multisig and timelock to be safe addresses for PCV withdrawal' - }, { target: 'dpiToDaiLBPSwapper', values: '0', method: 'exitPool(address)', arguments: ['{compoundDaiPCVDeposit}'], - description: 'Withdraw all DAI and DPI from LBP pool to the compoundDAIPCVDeposit' + description: 'Withdraw all DAI and DPI from LBP pool to the compoundDAIPCVDeposit (~$3.8m)' }, { target: 'ratioPCVControllerV2', @@ -27,7 +20,8 @@ const fip_104b: ProposalDescription = { '{tribalCouncilSafe}', // to '10000' // basisPoints, 100% ], - description: 'Withdraw all the DPI from the Compound DAI PCV deposit to the TribalCouncil multisig' + description: + 'Withdraw all DPI from the Compound DAI PCV deposit (~$200k) to the TribalCouncil multisig, where it will be liquidated' }, { target: 'compoundDaiPCVDeposit', @@ -45,9 +39,8 @@ const fip_104b: ProposalDescription = { and discussed here: https://tribe.fei.money/t/fip-104-fei-pcv-reinforcement-proposal/4162 . Specifically it: - - Sets the TribalCouncil timelock to be a safe address for PCV withdrawal - Exits the LBP pool and withdraws all liquidity to the compound DAI deposit - - Withdraws the DPI from the deposit to the TribalCouncil multisig, uisng the ratioPCVController + - Withdraws the DPI from the deposit to the TribalCouncil multisig, using the ratioPCVController - Deposits the DAI on the deposit into Compound ` }; From 44065d89126d8e55bfbd6a4d32f64eca3f1fc8e3 Mon Sep 17 00:00:00 2001 From: thomas-waite Date: Mon, 6 Jun 2022 14:44:34 +0100 Subject: [PATCH 232/274] refactor: update block num, add proposal back in --- block.txt | 2 +- proposals/dao/fip_104b.ts | 7 ++++--- test/integration/proposals_config.ts | 25 +++++++++++++++---------- 3 files changed, 20 insertions(+), 14 deletions(-) diff --git a/block.txt b/block.txt index 4245c0f7a..1b34af9d2 100644 --- a/block.txt +++ b/block.txt @@ -1 +1 @@ -14885000 +14915266 diff --git a/proposals/dao/fip_104b.ts b/proposals/dao/fip_104b.ts index e9b9df9d8..97f3f114a 100644 --- a/proposals/dao/fip_104b.ts +++ b/proposals/dao/fip_104b.ts @@ -54,13 +54,14 @@ const validate: ValidateUpgradeFunc = async (addresses, oldContracts, contracts, // 1. Validate withdrawn liquidity destinations const sanityCheckDAIAmount = ethers.constants.WeiPerEther.mul(3_500_000); const finalDAIDepositBalance = await contracts.compoundDaiPCVDeposit.balance(); - expect(finalDAIDepositBalance).to.be.bignumber.at.least(initialDaiPCVBalance.add(sanityCheckDAIAmount)); - logging && console.log('Final DAI balance: ', finalDAIDepositBalance.toString()); + const daiGained = finalDAIDepositBalance.sub(initialDaiPCVBalance); + expect(daiGained).to.be.bignumber.at.least(sanityCheckDAIAmount); const dpi = contracts.dpi; const sanityCheckDPIAmount = ethers.constants.WeiPerEther.mul(1500); const finalTCDpiBalance = await dpi.balanceOf(addresses.tribalCouncilSafe); - expect(finalTCDpiBalance).to.be.bignumber.at.least(initialTCDpiBalance.add(sanityCheckDPIAmount)); + const dpiGained = finalTCDpiBalance.sub(initialTCDpiBalance); + expect(dpiGained).to.be.bignumber.at.least(sanityCheckDPIAmount); }; export { deploy, setup, teardown, validate }; diff --git a/test/integration/proposals_config.ts b/test/integration/proposals_config.ts index aab450ec0..46e6c360c 100644 --- a/test/integration/proposals_config.ts +++ b/test/integration/proposals_config.ts @@ -1,19 +1,10 @@ import { ProposalCategory, ProposalsConfigMap } from '@custom-types/types'; import repay_fuse_bad_debt from '@proposals/description/repay_fuse_bad_debt'; -import register_proposal from '@proposals/description/register_proposal'; import end_tribe_incentives from '@proposals/description/end_tribe_incentives'; +import fip_104b from '@proposals/description/fip_104b'; const proposals: ProposalsConfigMap = { - register_proposal: { - deploy: false, // deploy flag for whether to run deploy action during e2e tests or use mainnet state - totalValue: 0, // amount of ETH to send to DAO execution - proposal: register_proposal, // full proposal file, imported from '@proposals/description/fip_xx.ts' - proposalId: '', - affectedContractSignoff: ['core'], - deprecatedContractSignoff: [], - category: ProposalCategory.TC - }, repay_fuse_bad_debt: { deploy: false, // deploy flag for whether to run deploy action during e2e tests or use mainnet state totalValue: 0, // amount of ETH to send to DAO execution @@ -64,6 +55,20 @@ const proposals: ProposalsConfigMap = { 'votiumBriberD3pool' ], category: ProposalCategory.TC + }, + fip_104b: { + deploy: false, // deploy flag for whether to run deploy action during e2e tests or use mainnet state + totalValue: 0, // amount of ETH to send to DAO execution + proposal: fip_104b, // full proposal file, imported from '@proposals/description/fip_xx.ts' + proposalId: '', + affectedContractSignoff: [ + 'dpiToDaiLBPSwapper', + 'compoundDaiPCVDeposit', + 'tribalCouncilSafe', + 'ratioPCVControllerV2' + ], + deprecatedContractSignoff: [], + category: ProposalCategory.DAO } }; From 1ab8c54d1482af8a1304330982209beffeb613d0 Mon Sep 17 00:00:00 2001 From: thomas-waite Date: Mon, 6 Jun 2022 15:57:08 +0100 Subject: [PATCH 233/274] test: unpause RAI psm for e2e --- test/integration/tests/psm.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/test/integration/tests/psm.ts b/test/integration/tests/psm.ts index dcd06e3fc..f68e1c8d2 100644 --- a/test/integration/tests/psm.ts +++ b/test/integration/tests/psm.ts @@ -410,6 +410,12 @@ describe('e2e-peg-stability-module', function () { // Set floor to something sufficiently low for tests to pass - RAI price on-chain fluctuates await raiPriceBoundPSM.connect(impersonatedSigners[userAddress]).setOracleFloorBasisPoints(25000); + + // Ensure RAI PSM is not paused + const isPaused = await raiPriceBoundPSM.paused(); + if (isPaused) { + await raiPriceBoundPSM.connect(impersonatedSigners[userAddress]).unpause(); + } }); it('exchanges 1000 FEI for rai', async () => { From 1f77029e07516b367bcd42754faf8a4e56d148a0 Mon Sep 17 00:00:00 2001 From: thomas-waite Date: Mon, 6 Jun 2022 18:46:32 +0100 Subject: [PATCH 234/274] test: setup test fixture for incentives --- proposals/dao/end_tribe_incentives.ts | 20 ++++++++++++++++---- test/integration/tests/tribeIncentivesEnd.ts | 19 ++++++++++--------- 2 files changed, 26 insertions(+), 13 deletions(-) diff --git a/proposals/dao/end_tribe_incentives.ts b/proposals/dao/end_tribe_incentives.ts index 6b8649d42..ff6337b6e 100644 --- a/proposals/dao/end_tribe_incentives.ts +++ b/proposals/dao/end_tribe_incentives.ts @@ -7,11 +7,9 @@ import { TeardownUpgradeFunc, ValidateUpgradeFunc } from '@custom-types/types'; -import { getImpersonatedSigner } from '@test/helpers'; +import { getImpersonatedSigner, time } from '@test/helpers'; import { forceEth } from '@test/integration/setup/utils'; -const toBN = ethers.BigNumber.from; - /* TIP-109: Discontinue Tribe Incentives @@ -42,7 +40,21 @@ const deploy: DeployUpgradeFunc = async (deployAddress: string, addresses: Named // This could include setting up Hardhat to impersonate accounts, // ensuring contracts have a specific state, etc. const setup: SetupUpgradeFunc = async (addresses, oldContracts, contracts, logging) => { - console.log(`No actions to complete in setup for fip${fipNumber}`); + const stakeAmount = ethers.constants.WeiPerEther.mul(40_000); + const curve3Metapool = '0x06cb22615BA53E60D67Bf6C341a0fD5E718E1655'; + const curvePoolId = 1; + const curve3LPWhale = '0xdc69d4cb5b86388fff0b51885677e258883534ae'; + const curveLPStaker = await getImpersonatedSigner(curve3LPWhale); + const curveLPToken = await ethers.getContractAt('ERC20', curve3Metapool); + + await forceEth(curve3LPWhale); + await curveLPToken.connect(curveLPStaker).approve(contracts.tribalChief.address, stakeAmount); + await contracts.tribalChief.connect(curveLPStaker).deposit(curvePoolId, stakeAmount, 0); + + // Set the pool to have a non-zero AP, so can test can claim rewards + const daoSigner = await getImpersonatedSigner(addresses.feiDAOTimelock); + await contracts.tribalChief.connect(daoSigner).set(curvePoolId, 500, ethers.constants.AddressZero, false); + await time.increase(86400 * 7); }; // Tears down any changes made in setup() that need to be diff --git a/test/integration/tests/tribeIncentivesEnd.ts b/test/integration/tests/tribeIncentivesEnd.ts index 0bc8167fa..29b3a31e4 100644 --- a/test/integration/tests/tribeIncentivesEnd.ts +++ b/test/integration/tests/tribeIncentivesEnd.ts @@ -8,6 +8,7 @@ import proposals from '@test/integration/proposals_config'; import { TestEndtoEndCoordinator } from '../setup'; import { forceEth } from '@test/integration/setup/utils'; import { TribalChief, Tribe } from '@custom-types/contracts'; +import { SignerWithAddress } from '@nomiclabs/hardhat-ethers/signers'; const toBN = ethers.BigNumber.from; chai.use(CBN(ethers.BigNumber)); @@ -21,11 +22,12 @@ describe('e2e-end-tribe-incentives', function () { let doLogging: boolean; let tribe: Tribe; let tribalChief: TribalChief; + let curveLPStaker: SignerWithAddress; const receiver = '0xbEA4B2357e8ec53AF60BbcA4bc570332a7C7E232'; const curvePoolId = 1; const curve3Metapool = '0x06cb22615BA53E60D67Bf6C341a0fD5E718E1655'; - const curvePoolStaker = '0x019EdcB493Bd91e2b25b70f26D5d9041Fd7EF946'; + const curve3LPWhale = '0xdc69d4cb5b86388fff0b51885677e258883534ae'; const pool8User = '0x9544A83A8cB74062c836AA11565d4BB4A54fe40D'; beforeEach(async function () { @@ -52,24 +54,24 @@ describe('e2e-end-tribe-incentives', function () { tribe = contracts.tribe as Tribe; tribalChief = contracts.tribalChief as TribalChief; + + curveLPStaker = await getImpersonatedSigner(curve3LPWhale); + await forceEth(curve3LPWhale); }); it('should be able to harvest existing TRIBE rewards and withdraw principle from an LP pool', async () => { const initialBalance = await tribe.balanceOf(receiver); - const stakerInPoolSigner = await getImpersonatedSigner(curvePoolStaker); - await forceEth(curvePoolStaker); - const curveLPToken = await ethers.getContractAt('ERC20', curve3Metapool); // Harvest already earnt TRIBE rewards - await tribalChief.connect(stakerInPoolSigner).harvest(curvePoolId, receiver); + await tribalChief.connect(curveLPStaker).harvest(curvePoolId, receiver); const finalBalance = await tribe.balanceOf(receiver); const harvestedTribe = finalBalance.sub(initialBalance); expect(harvestedTribe).to.be.bignumber.at.least(toBN(1)); // Withdraw principle from staked pool const receiverBalanceBefore = await curveLPToken.balanceOf(receiver); - await tribalChief.connect(stakerInPoolSigner).withdrawAllAndHarvest(curvePoolId, receiver); + await tribalChief.connect(curveLPStaker).withdrawAllAndHarvest(curvePoolId, receiver); const receiverBalanceAfter = await curveLPToken.balanceOf(receiver); const withdrawnPrinciple = receiverBalanceAfter.sub(receiverBalanceBefore); expect(withdrawnPrinciple).to.be.bignumber.at.least(toBN(1)); @@ -78,8 +80,7 @@ describe('e2e-end-tribe-incentives', function () { it('should NOT be able to harvest future TRIBE rewards from an LP pool', async () => { // Harvest, to zero out already earned rewards const firstHarvestInitial = await tribe.balanceOf(receiver); - const stakerInPoolSigner = await getImpersonatedSigner(curvePoolStaker); - await tribalChief.connect(stakerInPoolSigner).harvest(curvePoolId, receiver); + await tribalChief.connect(curveLPStaker).harvest(curvePoolId, receiver); const firstHarvestFinal = await tribe.balanceOf(receiver); expect(firstHarvestFinal.sub(firstHarvestInitial)).to.be.bignumber.greaterThan(toBN(1)); @@ -88,7 +89,7 @@ describe('e2e-end-tribe-incentives', function () { // Attempt to harvest again. As rewards have been stopped, it should not harvest any Tribe const balanceBeforeHarvest = await tribe.balanceOf(receiver); - await tribalChief.connect(stakerInPoolSigner).harvest(curvePoolId, receiver); + await tribalChief.connect(curveLPStaker).harvest(curvePoolId, receiver); const balanceAfterHarvest = await tribe.balanceOf(receiver); const harvestedTribe = balanceAfterHarvest.sub(balanceBeforeHarvest); From 64375c415a9526ee341411d963512eb7095d64e7 Mon Sep 17 00:00:00 2001 From: thomas-waite Date: Mon, 6 Jun 2022 18:58:05 +0100 Subject: [PATCH 235/274] feat: withdraw from tokemak --- proposals/dao/tokemak_withdraw.ts | 47 +++++++++++++++++++++++ proposals/description/tokemak_withdraw.ts | 17 ++++++++ test/integration/proposals_config.ts | 10 +++++ 3 files changed, 74 insertions(+) create mode 100644 proposals/dao/tokemak_withdraw.ts create mode 100644 proposals/description/tokemak_withdraw.ts diff --git a/proposals/dao/tokemak_withdraw.ts b/proposals/dao/tokemak_withdraw.ts new file mode 100644 index 000000000..a957e9cf9 --- /dev/null +++ b/proposals/dao/tokemak_withdraw.ts @@ -0,0 +1,47 @@ +import hre, { ethers, artifacts } from 'hardhat'; +import { expect } from 'chai'; +import { + DeployUpgradeFunc, + NamedAddresses, + SetupUpgradeFunc, + TeardownUpgradeFunc, + ValidateUpgradeFunc +} from '@custom-types/types'; + +/* + +Withdraw from Tokemak + +*/ + +const fipNumber = 'tokemak_withdraw'; + +// Do any deployments +// This should exclusively include new contract deployments +const deploy: DeployUpgradeFunc = async (deployAddress: string, addresses: NamedAddresses, logging: boolean) => { + console.log(`No deploy actions for fip${fipNumber}`); + return { + // put returned contract objects here + }; +}; + +// Do any setup necessary for running the test. +// This could include setting up Hardhat to impersonate accounts, +// ensuring contracts have a specific state, etc. +const setup: SetupUpgradeFunc = async (addresses, oldContracts, contracts, logging) => { + console.log(`No actions to complete in setup for fip${fipNumber}`); +}; + +// Tears down any changes made in setup() that need to be +// cleaned up before doing any validation checks. +const teardown: TeardownUpgradeFunc = async (addresses, oldContracts, contracts, logging) => { + console.log(`No actions to complete in teardown for fip${fipNumber}`); +}; + +// Run any validations required on the fip using mocha or console logging +// IE check balances, check state of contracts, etc. +const validate: ValidateUpgradeFunc = async (addresses, oldContracts, contracts, logging) => { + console.log(`No actions to complete in validate for fip${fipNumber}`); +}; + +export { deploy, setup, teardown, validate }; diff --git a/proposals/description/tokemak_withdraw.ts b/proposals/description/tokemak_withdraw.ts new file mode 100644 index 000000000..1fda45409 --- /dev/null +++ b/proposals/description/tokemak_withdraw.ts @@ -0,0 +1,17 @@ +import { ProposalDescription } from '@custom-types/types'; + +const tokemak_withdraw: ProposalDescription = { + title: 'Withdraw from Tokemak', + commands: [ + { + target: 'ethTokemakPCVDeposit', + values: '0', + method: 'requestWithdrawal()', + arguments: [], + description: 'Request to withdraw tWETH from Tokemak in the next cycle' + } + ], + description: `Request to withdraw ETH from Tokemak in the next cycle` +}; + +export default tokemak_withdraw; diff --git a/test/integration/proposals_config.ts b/test/integration/proposals_config.ts index aab450ec0..1147a8f1a 100644 --- a/test/integration/proposals_config.ts +++ b/test/integration/proposals_config.ts @@ -3,6 +3,7 @@ import { ProposalCategory, ProposalsConfigMap } from '@custom-types/types'; import repay_fuse_bad_debt from '@proposals/description/repay_fuse_bad_debt'; import register_proposal from '@proposals/description/register_proposal'; import end_tribe_incentives from '@proposals/description/end_tribe_incentives'; +import tokemak_withdrawal from '@proposals/description/tokemak_withdraw'; const proposals: ProposalsConfigMap = { register_proposal: { @@ -64,6 +65,15 @@ const proposals: ProposalsConfigMap = { 'votiumBriberD3pool' ], category: ProposalCategory.TC + }, + tokemak_withdrawal: { + deploy: false, // deploy flag for whether to run deploy action during e2e tests or use mainnet state + totalValue: 0, // amount of ETH to send to DAO execution + proposal: tokemak_withdrawal, // full proposal file, imported from '@proposals/description/fip_xx.ts' + proposalId: '', + affectedContractSignoff: ['core'], + deprecatedContractSignoff: [], + category: ProposalCategory.TC } }; From b389402f8a80d57a321f6aa669927e74b1dbb97a Mon Sep 17 00:00:00 2001 From: Joey Santoro Date: Mon, 6 Jun 2022 14:31:08 -0700 Subject: [PATCH 236/274] test oracle inversion --- proposals/dao/eth_lbp.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/proposals/dao/eth_lbp.ts b/proposals/dao/eth_lbp.ts index 0b407d9ff..0936101be 100644 --- a/proposals/dao/eth_lbp.ts +++ b/proposals/dao/eth_lbp.ts @@ -199,7 +199,7 @@ const validate: ValidateUpgradeFunc = async (addresses, oldContracts, contracts, const validateLBPSetup = async (contracts: NamedContracts, addresses: NamedAddresses, poolId: string) => { const ethToDaiLBPSwapper = contracts.ethToDaiLBPSwapper; - // expect(await ethToDaiLBPSwapper.doInvert()).to.be.equal(true); + expect(await ethToDaiLBPSwapper.doInvert()).to.be.equal(false); expect(await ethToDaiLBPSwapper.isTimeStarted()).to.be.true; expect(await ethToDaiLBPSwapper.tokenSpent()).to.equal(addresses.weth); expect(await ethToDaiLBPSwapper.tokenReceived()).to.equal(addresses.dai); From 6c8d94e35e00655caed06e729e6751d00df231b0 Mon Sep 17 00:00:00 2001 From: Joey Santoro Date: Mon, 6 Jun 2022 14:35:54 -0700 Subject: [PATCH 237/274] delete incorrect comments --- proposals/dao/eth_lbp.ts | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) diff --git a/proposals/dao/eth_lbp.ts b/proposals/dao/eth_lbp.ts index 0936101be..80e2d3980 100644 --- a/proposals/dao/eth_lbp.ts +++ b/proposals/dao/eth_lbp.ts @@ -33,14 +33,10 @@ let poolId; // auction pool id const fipNumber = '110'; const deploy: DeployUpgradeFunc = async (deployAddress: string, addresses: NamedAddresses, logging: boolean) => { - /////////// 2. Deploy the Balancer LBP swapper - // // Amounts: - // WETH: 37888449801955370645659 (95%), 37k WETH, $3,587,445 - // DAI: 187947000000000000000000 (5%), 187k DAI, $179,372.05, overfunding by ~$9k and transferring $187,947 + /////////// 1. Deploy the Balancer LBP swapper const BalancerLBPSwapperFactory = await ethers.getContractFactory('BalancerLBPSwapper'); // Oracle reports WETH price in terms of USD, so should not be inverted - // Specifically reports: 101258471470000000000, which is $101. As expected const ethToDaiLBPSwapper = await BalancerLBPSwapperFactory.deploy( addresses.core, { @@ -237,13 +233,6 @@ const validateLBPSetup = async (contracts: NamedContracts, addresses: NamedAddre expect(poolTokens.tokens[1]).to.be.equal(contracts.weth.address); // this is WETH expect(poolTokens.balances[1]).to.be.equal('20000000000000000000000'); - // Pool balances Maths: - // Total value of pool = (188k DAI * $1) + (37k WETH * $93) = $3.63M - // DAI share = 5% - // WETH share = 95% - // Expected DAI amount = $3.63M * 0.05 = ~$181k - // Expected WETH amount = $3.63M * 0.95 = ~$3.5M -> ~ ($3500k / 93) 37k WETH - // Validate that a swap can occur const daiWhale = '0x5d3a536e4d6dbd6114cc1ead35777bab948e3643'; const daiWhaleSigner = await getImpersonatedSigner(daiWhale); From f1cd695e18f9b242fb1f0a7ce3a73ff51c35fd49 Mon Sep 17 00:00:00 2001 From: Joey Santoro Date: Mon, 6 Jun 2022 14:53:35 -0700 Subject: [PATCH 238/274] emergencyExit fn --- contracts/pcv/balancer/BalancerLBPSwapper.sol | 9 +++++++ .../pcv/balancer/BalancerLBPSwapper.test.ts | 24 +++++++++++++++++-- 2 files changed, 31 insertions(+), 2 deletions(-) diff --git a/contracts/pcv/balancer/BalancerLBPSwapper.sol b/contracts/pcv/balancer/BalancerLBPSwapper.sol index f1aa3d62c..0704eccdd 100644 --- a/contracts/pcv/balancer/BalancerLBPSwapper.sol +++ b/contracts/pcv/balancer/BalancerLBPSwapper.sol @@ -5,6 +5,7 @@ import "./manager/WeightedBalancerPoolManager.sol"; import "./IVault.sol"; import "../../utils/Timed.sol"; import "../../refs/OracleRef.sol"; +import "../../core/TribeRoles.sol"; import "../IPCVSwapper.sol"; import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; @@ -199,6 +200,14 @@ contract BalancerLBPSwapper is IPCVSwapper, OracleRef, Timed, WeightedBalancerPo _swap(); } + /// @notice exit LBP with all assets to this contract. The tokens can then be withdrawn via standard PCV deposit methods. + function emergencyExit() + external + hasAnyOfThreeRoles(TribeRoles.GUARDIAN, TribeRoles.PCV_CONTROLLER, TribeRoles.SWAP_ADMIN_ROLE) + { + _exitPool(); + } + /// @notice redeeem all assets from LP pool /// @param to destination for withdrawn tokens function exitPool(address to) external onlyPCVController { diff --git a/test/unit/pcv/balancer/BalancerLBPSwapper.test.ts b/test/unit/pcv/balancer/BalancerLBPSwapper.test.ts index c7990e1a3..a726e6145 100644 --- a/test/unit/pcv/balancer/BalancerLBPSwapper.test.ts +++ b/test/unit/pcv/balancer/BalancerLBPSwapper.test.ts @@ -22,6 +22,7 @@ describe('BalancerLBPSwapper', function () { let pcvControllerAddress: string; let governorAddress: string; let minterAddress: string; + let guardianAddress: string; let core: Core; let fei: Fei; let tribe: Tribe; @@ -39,7 +40,8 @@ describe('BalancerLBPSwapper', function () { addresses.pcvControllerAddress, addresses.governorAddress, addresses.minterAddress, - addresses.burnerAddress + addresses.burnerAddress, + addresses.guardianAddress ]; for (const address of impersonatedAddresses) { @@ -48,7 +50,8 @@ describe('BalancerLBPSwapper', function () { }); beforeEach(async function () { - ({ userAddress, pcvControllerAddress, governorAddress, minterAddress, burnerAddress } = await getAddresses()); + ({ userAddress, pcvControllerAddress, governorAddress, minterAddress, burnerAddress, guardianAddress } = + await getAddresses()); core = await getCore(); @@ -385,6 +388,23 @@ describe('BalancerLBPSwapper', function () { await balancerLBPSwapper.connect(impersonatedSigners[governorAddress]).swap(); }); + describe('emergencyExit', function () { + it('guardian succeeds', async function () { + expect(await pool.balanceOf(balancerLBPSwapper.address)).to.be.bignumber.equal(await vault.LIQUIDITY_AMOUNT()); + await balancerLBPSwapper.connect(impersonatedSigners[guardianAddress]).emergencyExit(); + expect(await pool.balanceOf(balancerLBPSwapper.address)).to.be.bignumber.equal(toBN(0)); + expect(await fei.balanceOf(balancerLBPSwapper.address)).to.be.bignumber.equal( + ethers.constants.WeiPerEther.mul(toBN(2)) + ); + }); + + it('non-authorized reverts', async function () { + await expectRevert( + balancerLBPSwapper.connect(impersonatedSigners[userAddress]).emergencyExit(), + 'UNAUTHORIZED' + ); + }); + }); it('succeeds', async function () { expect(await pool.balanceOf(balancerLBPSwapper.address)).to.be.bignumber.equal(await vault.LIQUIDITY_AMOUNT()); await balancerLBPSwapper.connect(impersonatedSigners[pcvControllerAddress]).exitPool(userAddress); From 8c02fe202f6d029986ee57d78817ef49404126d1 Mon Sep 17 00:00:00 2001 From: Joey Santoro Date: Mon, 6 Jun 2022 14:58:37 -0700 Subject: [PATCH 239/274] ->exitPoolToSelf --- contracts/pcv/balancer/BalancerLBPSwapper.sol | 2 +- test/unit/pcv/balancer/BalancerLBPSwapper.test.ts | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/contracts/pcv/balancer/BalancerLBPSwapper.sol b/contracts/pcv/balancer/BalancerLBPSwapper.sol index 0704eccdd..5e43166e5 100644 --- a/contracts/pcv/balancer/BalancerLBPSwapper.sol +++ b/contracts/pcv/balancer/BalancerLBPSwapper.sol @@ -201,7 +201,7 @@ contract BalancerLBPSwapper is IPCVSwapper, OracleRef, Timed, WeightedBalancerPo } /// @notice exit LBP with all assets to this contract. The tokens can then be withdrawn via standard PCV deposit methods. - function emergencyExit() + function exitPoolToSelf() external hasAnyOfThreeRoles(TribeRoles.GUARDIAN, TribeRoles.PCV_CONTROLLER, TribeRoles.SWAP_ADMIN_ROLE) { diff --git a/test/unit/pcv/balancer/BalancerLBPSwapper.test.ts b/test/unit/pcv/balancer/BalancerLBPSwapper.test.ts index a726e6145..4d9113958 100644 --- a/test/unit/pcv/balancer/BalancerLBPSwapper.test.ts +++ b/test/unit/pcv/balancer/BalancerLBPSwapper.test.ts @@ -388,10 +388,10 @@ describe('BalancerLBPSwapper', function () { await balancerLBPSwapper.connect(impersonatedSigners[governorAddress]).swap(); }); - describe('emergencyExit', function () { + describe('exitPoolToSelf', function () { it('guardian succeeds', async function () { expect(await pool.balanceOf(balancerLBPSwapper.address)).to.be.bignumber.equal(await vault.LIQUIDITY_AMOUNT()); - await balancerLBPSwapper.connect(impersonatedSigners[guardianAddress]).emergencyExit(); + await balancerLBPSwapper.connect(impersonatedSigners[guardianAddress]).exitPoolToSelf(); expect(await pool.balanceOf(balancerLBPSwapper.address)).to.be.bignumber.equal(toBN(0)); expect(await fei.balanceOf(balancerLBPSwapper.address)).to.be.bignumber.equal( ethers.constants.WeiPerEther.mul(toBN(2)) @@ -400,7 +400,7 @@ describe('BalancerLBPSwapper', function () { it('non-authorized reverts', async function () { await expectRevert( - balancerLBPSwapper.connect(impersonatedSigners[userAddress]).emergencyExit(), + balancerLBPSwapper.connect(impersonatedSigners[userAddress]).exitPoolToSelf(), 'UNAUTHORIZED' ); }); From 381f49dbb59810a1b5abd7abd3ab44cec2cd750c Mon Sep 17 00:00:00 2001 From: Erwan Beauvois Date: Tue, 7 Jun 2022 11:14:02 +0200 Subject: [PATCH 240/274] fix tribalchief conf merge issue --- protocol-configuration/tribalchief.ts | 36 +++++++++++++-------------- 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/protocol-configuration/tribalchief.ts b/protocol-configuration/tribalchief.ts index 9cf03708d..5351372bb 100644 --- a/protocol-configuration/tribalchief.ts +++ b/protocol-configuration/tribalchief.ts @@ -1,24 +1,24 @@ import { TribalChiefConfig } from '../types/types'; const config: TribalChiefConfig = { - feiTribePair: { allocPoint: 0, unlocked: false }, // Uniswap-v2 FEI/TRIBE LP - curveFei3crvMetapool: { allocPoint: 0, unlocked: false }, // Curve 3crv-FEI metapool LP - gUniFeiDaiLP: { allocPoint: 0, unlocked: true }, // G-UNI DAI/FEI 0.05% fee tier - stakingTokenWrapperRari: { allocPoint: 1000, unlocked: false }, // FeiRari: TRIBE - stakingTokenWrapperGROLaaS: { allocPoint: 0, unlocked: false }, // LaaS: GRO - stakingTokenWrapperFOXLaaS: { allocPoint: 0, unlocked: false }, // LaaS: FOX - stakingTokenWrapperUMALaaS: { allocPoint: 0, unlocked: false }, // LaaS: UMA - stakingTokenWrapperSYNLaaS: { allocPoint: 0, unlocked: false }, // LaaS: SYN - stakingTokenWrapperNEARLaaS: { allocPoint: 0, unlocked: false }, // LaaS: NEAR - stakingTokenWrapperKYLINLaaS: { allocPoint: 0, unlocked: false }, // LaaS: KYLIN - stakingTokenWrapperMStableLaaS: { allocPoint: 0, unlocked: false }, // LaaS: MStable - stakingTokenWrapperPoolTogetherLaaS: { allocPoint: 0, unlocked: false }, // LaaS: PoolTogether - stakingTokenWrapperBribeD3pool: { allocPoint: 250, unlocked: false }, // Votium bribes: d3pool - d3StakingTokenWrapper: { allocPoint: 250, unlocked: false }, // FeiRari: d3pool LP - fei3CrvStakingtokenWrapper: { allocPoint: 1000, unlocked: false }, // FeiRari: 3crv-FEI metapool LP - feiDaiStakingTokenWrapper: { allocPoint: 100, unlocked: false }, // FeiRari: G-UNI DAI/FEI 0.05% fee tier - feiUsdcStakingTokenWrapper: { allocPoint: 500, unlocked: false }, // FeiRari: G-UNI USDC/FEI 0.01% fee tier - stakingTokenWrapperBribe3Crvpool: { allocPoint: 250, unlocked: false } // Votium bribes: 3crv-FEI metapool + feiTribePair: { allocPoint: 1, unlocked: false }, // Uniswap-v2 FEI/TRIBE LP, 0 (poolId) + curveFei3crvMetapool: { allocPoint: 0, unlocked: false }, // Curve 3crv-FEI metapool LP, 1 + gUniFeiDaiLP: { allocPoint: 0, unlocked: true }, // G-UNI DAI/FEI 0.05% fee tier, 2 + stakingTokenWrapperRari: { allocPoint: 0, unlocked: false }, // FeiRari: TRIBE, 3 + stakingTokenWrapperGROLaaS: { allocPoint: 0, unlocked: false }, // LaaS: GRO, 4 + stakingTokenWrapperFOXLaaS: { allocPoint: 0, unlocked: false }, // LaaS: FOX, 5 + stakingTokenWrapperUMALaaS: { allocPoint: 0, unlocked: false }, // LaaS: UMA, 6 + stakingTokenWrapperSYNLaaS: { allocPoint: 0, unlocked: false }, // LaaS: SYN, 7 + stakingTokenWrapperNEARLaaS: { allocPoint: 0, unlocked: false }, // LaaS: NEAR, 8 + stakingTokenWrapperKYLINLaaS: { allocPoint: 0, unlocked: false }, // LaaS: KYLIN, 9 + stakingTokenWrapperMStableLaaS: { allocPoint: 0, unlocked: false }, // LaaS: MStable, 10 + stakingTokenWrapperPoolTogetherLaaS: { allocPoint: 0, unlocked: false }, // LaaS: PoolTogether, 11 + stakingTokenWrapperBribeD3pool: { allocPoint: 0, unlocked: false }, // Votium bribes: d3pool, 12 + d3StakingTokenWrapper: { allocPoint: 0, unlocked: false }, // FeiRari: d3pool LP, 13 + fei3CrvStakingtokenWrapper: { allocPoint: 0, unlocked: false }, // FeiRari: 3crv-FEI metapool LP, 14 + feiDaiStakingTokenWrapper: { allocPoint: 0, unlocked: false }, // FeiRari: G-UNI DAI/FEI 0.05% fee tier, 15 + feiUsdcStakingTokenWrapper: { allocPoint: 0, unlocked: false }, // FeiRari: G-UNI USDC/FEI 0.01% fee tier, 16 + stakingTokenWrapperBribe3Crvpool: { allocPoint: 0, unlocked: false } // Votium bribes: 3crv-FEI metapool, 17 }; export default config; From ff4bc98f672bf03233dc1ea9cd6646eb20a0fdf7 Mon Sep 17 00:00:00 2001 From: Caleb Date: Tue, 7 Jun 2022 02:36:23 -0700 Subject: [PATCH 241/274] Add a lot of typings; in progress --- scripts/utils/checkProposal.ts | 2 +- scripts/utils/constructProposal.ts | 20 ++++++++++---------- scripts/utils/constructProposalCalldata.ts | 4 ++-- scripts/utils/exec.ts | 15 ++++++++++----- test/helpers.ts | 5 ++--- test/integration/setup/index.ts | 8 ++++++-- test/integration/setup/loadContracts.ts | 2 +- tsconfig.json | 5 +++-- types/types.ts | 4 ++-- 9 files changed, 37 insertions(+), 28 deletions(-) diff --git a/scripts/utils/checkProposal.ts b/scripts/utils/checkProposal.ts index 0a2a3638c..cee6c8ecb 100644 --- a/scripts/utils/checkProposal.ts +++ b/scripts/utils/checkProposal.ts @@ -1,6 +1,6 @@ import { getAllContracts, getAllContractAddresses } from '@test/integration/setup/loadContracts'; import { NamedContracts, UpgradeFuncs } from '@custom-types/types'; -import proposals from '@test/integration/proposalsConfig'; +import proposals from '@protocol/proposalsConfig'; import * as dotenv from 'dotenv'; import { execProposal } from './exec'; diff --git a/scripts/utils/constructProposal.ts b/scripts/utils/constructProposal.ts index 26bc1b218..68d23d5b1 100644 --- a/scripts/utils/constructProposal.ts +++ b/scripts/utils/constructProposal.ts @@ -1,16 +1,16 @@ -import hre, { proposals } from 'hardhat'; import { MainnetContracts, NamedAddresses, ProposalDescription } from '@custom-types/types'; -import format from 'string-template'; +import { errors, PACKAGE_NAME } from '@idle-finance/hardhat-proposals-plugin/dist/src/constants'; import { AlphaProposal, AlphaProposalBuilder } from '@idle-finance/hardhat-proposals-plugin/dist/src/proposals/compound-alpha'; -import { BigNumber, utils } from 'ethers'; import { InternalProposalState } from '@idle-finance/hardhat-proposals-plugin/dist/src/proposals/proposal'; +import { time } from '@test/helpers'; +import { BigNumber, utils } from 'ethers'; +import hre from 'hardhat'; import { HardhatPluginError } from 'hardhat/plugins'; -import { PACKAGE_NAME, errors } from '@idle-finance/hardhat-proposals-plugin/dist/src/constants'; import { HardhatRuntimeEnvironment } from 'hardhat/types'; -import { time } from '@test/helpers'; +import format from 'string-template'; export class SigmaProposal extends AlphaProposal { protected async mineBlocks(blocks: any) { @@ -82,7 +82,7 @@ export default async function constructProposal( for (let i = 0; i < proposalInfo.commands.length; i += 1) { const command = proposalInfo.commands[i]; - const ethersContract = contracts[command.target]; + const ethersContract = contracts[command.target as keyof MainnetContracts]; const args = replaceArgs(command.arguments, contractAddresses); proposalBuilder.addContractAction(ethersContract, command.method, args, command.values); @@ -97,13 +97,13 @@ export default async function constructProposal( } // Recursively interpolate strings in the argument array -const replaceArgs = (args: any[], contractNames: NamedAddresses) => { +const replaceArgs = (args: any[], contractNames: NamedAddresses): any[] => { const result = []; for (let i = 0; i < args.length; i++) { const element = args[i]; - if (typeof element === typeof '') { - const formatted = format(element, contractNames); - result.push(formatted); + if (typeof element === 'string') { + if (contractNames[element] === undefined) throw new Error(`Unknown contract name: ${element}. Cannot parse.`); + result.push(format(element, contractNames)); } else if (typeof element === typeof []) { result.push(replaceArgs(element, contractNames)); } else { diff --git a/scripts/utils/constructProposalCalldata.ts b/scripts/utils/constructProposalCalldata.ts index 9cb63aac7..c99e9dd16 100644 --- a/scripts/utils/constructProposalCalldata.ts +++ b/scripts/utils/constructProposalCalldata.ts @@ -5,7 +5,7 @@ import { Interface } from '@ethersproject/abi'; import { utils } from 'ethers'; import { getAllContractAddresses, getAllContracts } from '@test/integration/setup/loadContracts'; import { ProposalCategory, ProposalDescription } from '@custom-types/types'; -import proposals from '@test/integration/proposalsConfig'; +import proposals from '@protocol/proposalsConfig'; type ExtendedAlphaProposal = { targets: string[]; @@ -23,7 +23,7 @@ export async function constructProposalCalldata(proposalName: string): Promise { - const description = []; + const description = ''; await hre.network.provider.request({ method: 'hardhat_impersonateAccount', @@ -310,7 +309,7 @@ async function initialiseGnosisSDK(safeOwner: Signer, safeAddress: string): Prom ethers, signer: safeOwner }); - const { chainId } = await safeOwner.provider.getNetwork(); + const { chainId } = await safeOwner.provider!.getNetwork(); const contractNetworks = { [chainId]: { multiSendAddress: '0x8D29bE29923b68abfDD21e541b9374737B49cdAD', diff --git a/test/integration/setup/index.ts b/test/integration/setup/index.ts index 3a7db2158..be20f357c 100644 --- a/test/integration/setup/index.ts +++ b/test/integration/setup/index.ts @@ -4,7 +4,7 @@ import { Config, ContractAccessRights, TestCoordinator, - Env, + ContractsAndAddresses, ProposalConfig, namedContractsToNamedAddresses, NamedAddresses, @@ -39,6 +39,10 @@ export class TestEndtoEndCoordinator implements TestCoordinator { constructor(private config: Config, proposals?: any) { this.proposals = proposals; + + this.mainnetContracts = {}; + this.afterUpgradeAddresses = {}; + this.afterUpgradeContracts = {}; } public async initMainnetContracts(): Promise { @@ -55,7 +59,7 @@ export class TestEndtoEndCoordinator implements TestCoordinator { * 3) Apply appropriate permissions to the contracts e.g. minter, burner priviledges * */ - public async loadEnvironment(): Promise { + public async loadEnvironment(): Promise { await resetFork(); await this.initMainnetContracts(); let existingContracts = this.mainnetContracts; diff --git a/test/integration/setup/loadContracts.ts b/test/integration/setup/loadContracts.ts index cc9c0e1dc..ab2eab3a5 100644 --- a/test/integration/setup/loadContracts.ts +++ b/test/integration/setup/loadContracts.ts @@ -1,5 +1,5 @@ import mainnetAddresses from '@protocol/mainnetAddresses'; -import { artifacts, ethers } from 'hardhat'; +import { ethers } from 'hardhat'; import { MainnetContracts, MainnetContractsConfig, NamedAddresses } from '@custom-types/types'; export async function getAllContracts(): Promise { diff --git a/tsconfig.json b/tsconfig.json index 2d399b0a8..25ef1d3bd 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -3,8 +3,9 @@ "moduleResolution": "node", "allowJs": true, "checkJs": true, - "noImplicitAny": false, - "noImplicitThis": false, + "strict": true, + "noImplicitAny": true, + "noImplicitThis": true, "target": "es2018", "module": "commonjs", "esModuleInterop": true, diff --git a/types/types.ts b/types/types.ts index 734576961..ce6a4322a 100644 --- a/types/types.ts +++ b/types/types.ts @@ -37,13 +37,13 @@ import { } from './contracts'; import { RestrictedPermissions } from './contracts/RestrictedPermissions'; -export type Env = { +export type ContractsAndAddresses = { contracts: NamedContracts; contractAddresses: NamedAddresses; }; export interface TestCoordinator { - loadEnvironment(): Promise; + loadEnvironment(): Promise; } export function namedContractsToNamedAddresses(contracts: NamedContracts): NamedAddresses { From 58fbcc1002e85d1c259773b8693fef6d233a1fdc Mon Sep 17 00:00:00 2001 From: Caleb Date: Tue, 7 Jun 2022 03:25:11 -0700 Subject: [PATCH 242/274] Remove replaceArgs --- .../description/old/repay_fuse_bad_debt.ts | 1 + scripts/utils/checkProposal.ts | 2 +- scripts/utils/constructProposal.ts | 31 ++++--------- scripts/utils/constructProposalCalldata.ts | 6 +-- scripts/utils/simulateTimelockProposal.ts | 46 +++++++++---------- types/types.ts | 22 +++++++-- 6 files changed, 54 insertions(+), 54 deletions(-) diff --git a/proposals/description/old/repay_fuse_bad_debt.ts b/proposals/description/old/repay_fuse_bad_debt.ts index 4a58741bb..68d7438b0 100644 --- a/proposals/description/old/repay_fuse_bad_debt.ts +++ b/proposals/description/old/repay_fuse_bad_debt.ts @@ -1,3 +1,4 @@ +import { MainnetAddresses } from '@custom-types/contracts'; import { ProposalDescription } from '@custom-types/types'; const fip_x: ProposalDescription = { diff --git a/scripts/utils/checkProposal.ts b/scripts/utils/checkProposal.ts index cee6c8ecb..3a91b501c 100644 --- a/scripts/utils/checkProposal.ts +++ b/scripts/utils/checkProposal.ts @@ -42,7 +42,7 @@ async function checkProposal(proposalName: string, doSetup?: string) { const proposalNo = proposals[proposalName].proposalId; - await execProposal(voterAddress, feiDAO.address, proposals[proposalName].totalValue, proposalNo); + await execProposal(voterAddress, feiDAO.address, proposals[proposalName].totalValue.toString(), proposalNo); console.log('Teardown'); await proposalFuncs.teardown( diff --git a/scripts/utils/constructProposal.ts b/scripts/utils/constructProposal.ts index 68d23d5b1..91b20702d 100644 --- a/scripts/utils/constructProposal.ts +++ b/scripts/utils/constructProposal.ts @@ -1,4 +1,9 @@ -import { MainnetContracts, NamedAddresses, ProposalDescription } from '@custom-types/types'; +import { + MainnetContracts, + NamedAddresses, + ProposalDescription, + TemplatedProposalDescription +} from '@custom-types/types'; import { errors, PACKAGE_NAME } from '@idle-finance/hardhat-proposals-plugin/dist/src/constants'; import { AlphaProposal, @@ -10,7 +15,6 @@ import { BigNumber, utils } from 'ethers'; import hre from 'hardhat'; import { HardhatPluginError } from 'hardhat/plugins'; import { HardhatRuntimeEnvironment } from 'hardhat/types'; -import format from 'string-template'; export class SigmaProposal extends AlphaProposal { protected async mineBlocks(blocks: any) { @@ -64,7 +68,7 @@ export class SigmaProposalBuilder extends AlphaProposalBuilder { * */ export default async function constructProposal( - proposalInfo: ProposalDescription, + proposalInfo: TemplatedProposalDescription, contracts: MainnetContracts, contractAddresses: NamedAddresses, logging = false @@ -84,7 +88,9 @@ export default async function constructProposal( const command = proposalInfo.commands[i]; const ethersContract = contracts[command.target as keyof MainnetContracts]; - const args = replaceArgs(command.arguments, contractAddresses); + const generateArgsFunc = command.arguments; + const args = generateArgsFunc(contractAddresses); + proposalBuilder.addContractAction(ethersContract, command.method, args, command.values); logging && console.log(`Adding proposal step: ${command.description}`); @@ -95,20 +101,3 @@ export default async function constructProposal( logging && console.log(await proposal.printProposalInfo()); return proposal; } - -// Recursively interpolate strings in the argument array -const replaceArgs = (args: any[], contractNames: NamedAddresses): any[] => { - const result = []; - for (let i = 0; i < args.length; i++) { - const element = args[i]; - if (typeof element === 'string') { - if (contractNames[element] === undefined) throw new Error(`Unknown contract name: ${element}. Cannot parse.`); - result.push(format(element, contractNames)); - } else if (typeof element === typeof []) { - result.push(replaceArgs(element, contractNames)); - } else { - result.push(element); - } - } - return result; -}; diff --git a/scripts/utils/constructProposalCalldata.ts b/scripts/utils/constructProposalCalldata.ts index c99e9dd16..a78bff35c 100644 --- a/scripts/utils/constructProposalCalldata.ts +++ b/scripts/utils/constructProposalCalldata.ts @@ -4,7 +4,7 @@ import { ethers } from 'hardhat'; import { Interface } from '@ethersproject/abi'; import { utils } from 'ethers'; import { getAllContractAddresses, getAllContracts } from '@test/integration/setup/loadContracts'; -import { ProposalCategory, ProposalDescription } from '@custom-types/types'; +import { ProposalCategory, ProposalDescription, TemplatedProposalDescription } from '@custom-types/types'; import proposals from '@protocol/proposalsConfig'; type ExtendedAlphaProposal = { @@ -20,7 +20,7 @@ type ExtendedAlphaProposal = { * See `proposals/utils/getProposalCalldata.js` on how to construct the proposal calldata */ export async function constructProposalCalldata(proposalName: string): Promise { - const proposalInfo = (await import(`@proposals/description/${proposalName}`)).default as ProposalDescription; + const proposalInfo = (await import(`@proposals/description/${proposalName}`)).default as TemplatedProposalDescription; const contracts = await getAllContracts(); const contractAddresses = getAllContractAddresses(); @@ -59,7 +59,7 @@ function getDAOCalldata(proposal: ExtendedAlphaProposal): string { return calldata; } -function getTimelockCalldata(proposal: ExtendedAlphaProposal, proposalInfo: ProposalDescription): string { +function getTimelockCalldata(proposal: ExtendedAlphaProposal, proposalInfo: TemplatedProposalDescription): string { const proposeFuncFrag = new Interface([ 'function scheduleBatch(address[] calldata targets,uint256[] calldata values,bytes[] calldata data,bytes32 predecessor,bytes32 salt,uint256 delay) public', 'function executeBatch(address[] calldata targets,uint256[] calldata values,bytes[] calldata data,bytes32 predecessor,bytes32 salt) public' diff --git a/scripts/utils/simulateTimelockProposal.ts b/scripts/utils/simulateTimelockProposal.ts index a939a4f72..2052083c4 100644 --- a/scripts/utils/simulateTimelockProposal.ts +++ b/scripts/utils/simulateTimelockProposal.ts @@ -1,14 +1,17 @@ import { ethers } from 'hardhat'; -import { MainnetContracts, NamedAddresses, ProposalDescription } from '@custom-types/types'; -import format from 'string-template'; +import { + MainnetContracts, + NamedAddresses, + ProposalDescription, + TemplatedProposalDescription +} from '@custom-types/types'; import { OptimisticTimelock } from '@custom-types/contracts'; import { getImpersonatedSigner, time } from '@test/helpers'; import { Contract } from '@ethersproject/contracts'; import { forceEth } from '@test/integration/setup/utils'; -import { TransactionRequest } from '@ethersproject/abstract-provider'; export async function simulateOAProposal( - proposalInfo: ProposalDescription, + proposalInfo: TemplatedProposalDescription, contracts: MainnetContracts, contractAddresses: NamedAddresses, logging = false @@ -19,7 +22,7 @@ export async function simulateOAProposal( } export async function simulateTCProposal( - proposalInfo: ProposalDescription, + proposalInfo: TemplatedProposalDescription, contracts: MainnetContracts, contractAddresses: NamedAddresses, logging = false @@ -32,7 +35,7 @@ export async function simulateTCProposal( export async function simulateTimelockProposal( timelock: OptimisticTimelock, multisigAddress: string, - proposalInfo: ProposalDescription, + proposalInfo: TemplatedProposalDescription, contracts: MainnetContracts, contractAddresses: NamedAddresses, logging = false @@ -51,13 +54,23 @@ export async function simulateTimelockProposal( for (let i = 0; i < proposalInfo.commands.length; i += 1) { const command = proposalInfo.commands[i]; - const ethersContract: Contract = contracts[command.target] as Contract; + if (contracts[command.target as keyof MainnetContracts] === undefined) { + throw new Error(`Unknown contract ${command.target}, cannot parse (from MainnetContracts)`); + } + + if (contractAddresses[command.target] === undefined) { + throw new Error(`Unknown contract ${command.target}, cannot parse (from NamedAddresses)`); + } + const ethersContract: Contract = contracts[command.target as keyof MainnetContracts] as Contract; const target = contractAddresses[command.target]; + targets.push(target); values.push(command.values); - const args = replaceArgs(command.arguments, contractAddresses); + const generateArgsFunc = command.arguments; + const args = generateArgsFunc(contractAddresses); + const data = ethersContract.interface.encodeFunctionData(command.method, args); datas.push(data); @@ -87,20 +100,3 @@ export async function simulateTimelockProposal( console.log('Operation not ready for execution'); } } - -// Recursively interpolate strings in the argument array -export function replaceArgs(args: any[], contractNames: NamedAddresses) { - const result = []; - for (let i = 0; i < args.length; i++) { - const element = args[i]; - if (typeof element === typeof '') { - const formatted = format(element, contractNames); - result.push(formatted); - } else if (typeof element === typeof []) { - result.push(replaceArgs(element, contractNames)); - } else { - result.push(element); - } - } - return result; -} diff --git a/types/types.ts b/types/types.ts index ce6a4322a..5c752da28 100644 --- a/types/types.ts +++ b/types/types.ts @@ -84,19 +84,33 @@ export type ProposalsConfigMap = { [key: string]: ProposalConfig; }; -export type ProposalDescription = { +export interface ProposalDescription { title: string; commands: ProposalCommand[]; description: string; -}; +} -export type ProposalCommand = { +export interface TemplatedProposalDescription { + title: string; + commands: TemplatedProposalCommand[]; + description: string; +} + +export interface ProposalCommand { target: string; values: string; method: string; arguments: any[]; description: string; -}; +} + +export interface TemplatedProposalCommand { + target: string; + values: string; + method: string; + arguments: (namedAddresses: NamedAddresses) => any[]; + description: string; +} export interface MainnetContractsConfig { [key: string]: ContractConfig; From 7e28604d3effc80301aae6d7a9780b2c34b13c56 Mon Sep 17 00:00:00 2001 From: Caleb Date: Tue, 7 Jun 2022 03:31:55 -0700 Subject: [PATCH 243/274] Organize imports; fix psm test --- scripts/utils/checkProposal.ts | 7 +------ .../tests/balancer-weightedpool.ts | 12 +++++------ test/integration/tests/buybacks.ts | 13 ++++++------ .../tests/collateralizationOracle.ts | 20 +++++++++---------- test/integration/tests/daiFixedPricePSM.ts | 15 +++++++------- test/integration/tests/dao.ts | 12 +++++------ test/integration/tests/ethPSM.ts | 9 ++++----- test/integration/tests/fei.ts | 12 +++++------ test/integration/tests/fip-38-tokemak.ts | 10 +++++----- test/integration/tests/fuse.ts | 6 +++--- test/integration/tests/lusdPSM.ts | 14 ++++--------- test/integration/tests/pcv.ts | 8 ++++---- test/integration/tests/podOperation.ts | 16 +++++++-------- test/integration/tests/psm.ts | 10 +++++----- test/integration/tests/staking.ts | 8 ++++---- test/integration/tests/tribalCouncil.ts | 14 ++++++------- test/integration/tests/tribalchief.ts | 10 +++++----- test/integration/tests/tribeIncentivesEnd.ts | 10 +++++----- test/integration/tests/turboPCVDeposit.ts | 8 ++++---- test/integration/tests/votium-bribe.ts | 9 ++++----- 20 files changed, 104 insertions(+), 119 deletions(-) diff --git a/scripts/utils/checkProposal.ts b/scripts/utils/checkProposal.ts index 3a91b501c..c2601823b 100644 --- a/scripts/utils/checkProposal.ts +++ b/scripts/utils/checkProposal.ts @@ -30,12 +30,7 @@ async function checkProposal(proposalName: string, doSetup?: string) { if (doSetup) { console.log('Setup'); - await proposalFuncs.setup( - contractAddresses, - contracts as unknown as NamedContracts, - contracts as unknown as NamedContracts, - true - ); + await proposalFuncs.setup(contractAddresses, contracts, contracts, true); } const { feiDAO } = contracts; diff --git a/test/integration/tests/balancer-weightedpool.ts b/test/integration/tests/balancer-weightedpool.ts index 0186a2d5c..863f2c085 100644 --- a/test/integration/tests/balancer-weightedpool.ts +++ b/test/integration/tests/balancer-weightedpool.ts @@ -1,14 +1,14 @@ -import chai, { expect } from 'chai'; -import CBN from 'chai-bn'; -import { solidity } from 'ethereum-waffle'; -import { ethers } from 'hardhat'; import { NamedContracts } from '@custom-types/types'; -import { getImpersonatedSigner, expectRevert, expectApproxAbs, balance, resetFork } from '@test/helpers'; +import { TransactionResponse } from '@ethersproject/providers'; import proposals from '@protocol/proposalsConfig'; +import { balance, expectApproxAbs, expectRevert, getImpersonatedSigner } from '@test/helpers'; import { TestEndtoEndCoordinator } from '@test/integration/setup'; import { forceEth } from '@test/integration/setup/utils'; +import chai, { expect } from 'chai'; +import CBN from 'chai-bn'; +import { solidity } from 'ethereum-waffle'; +import { ethers } from 'hardhat'; const toBN = ethers.BigNumber.from; -import { TransactionResponse } from '@ethersproject/providers'; const BNe18 = (x: any) => ethers.constants.WeiPerEther.mul(toBN(x)); describe('balancer-weightedpool', function () { diff --git a/test/integration/tests/buybacks.ts b/test/integration/tests/buybacks.ts index eef5b3078..9e0102185 100644 --- a/test/integration/tests/buybacks.ts +++ b/test/integration/tests/buybacks.ts @@ -1,19 +1,18 @@ -import chai, { expect } from 'chai'; -import CBN from 'chai-bn'; -import { solidity } from 'ethereum-waffle'; -import { ethers } from 'hardhat'; +import { CollateralizationOracle } from '@custom-types/contracts'; import { NamedAddresses, NamedContracts } from '@custom-types/types'; +import proposals from '@protocol/proposalsConfig'; import { expectApprox, getImpersonatedSigner, increaseTime, latestTime, - resetFork, overwriteChainlinkAggregator } from '@test/helpers'; -import proposals from '@protocol/proposalsConfig'; import { TestEndtoEndCoordinator } from '@test/integration/setup'; -import { CollateralizationOracle } from '@custom-types/contracts'; +import chai, { expect } from 'chai'; +import CBN from 'chai-bn'; +import { solidity } from 'ethereum-waffle'; +import { ethers } from 'hardhat'; const toBN = ethers.BigNumber.from; describe('e2e-buybacks', function () { diff --git a/test/integration/tests/collateralizationOracle.ts b/test/integration/tests/collateralizationOracle.ts index 56446812f..73feafc2e 100644 --- a/test/integration/tests/collateralizationOracle.ts +++ b/test/integration/tests/collateralizationOracle.ts @@ -1,18 +1,18 @@ -import chai, { expect } from 'chai'; -import CBN from 'chai-bn'; -import { solidity } from 'ethereum-waffle'; -import { ethers } from 'hardhat'; -import { NamedAddresses, NamedContracts } from '@custom-types/types'; -import { expectApprox, overwriteChainlinkAggregator } from '@test/helpers'; -import proposals from '@protocol/proposalsConfig'; -import collateralizationAddresses from '@protocol/collateralizationOracle'; -import { TestEndtoEndCoordinator } from '@test/integration/setup'; import { CollateralizationOracle, - CollateralizationOracleWrapper, CollateralizationOracleGuardian, + CollateralizationOracleWrapper, NamedStaticPCVDepositWrapper } from '@custom-types/contracts'; +import { NamedAddresses, NamedContracts } from '@custom-types/types'; +import collateralizationAddresses from '@protocol/collateralizationOracle'; +import proposals from '@protocol/proposalsConfig'; +import { expectApprox, overwriteChainlinkAggregator } from '@test/helpers'; +import { TestEndtoEndCoordinator } from '@test/integration/setup'; +import chai, { expect } from 'chai'; +import CBN from 'chai-bn'; +import { solidity } from 'ethereum-waffle'; +import { ethers } from 'hardhat'; describe('e2e-collateralization', function () { let contracts: NamedContracts; diff --git a/test/integration/tests/daiFixedPricePSM.ts b/test/integration/tests/daiFixedPricePSM.ts index 7a3544ad3..26ee12690 100644 --- a/test/integration/tests/daiFixedPricePSM.ts +++ b/test/integration/tests/daiFixedPricePSM.ts @@ -1,15 +1,14 @@ -import chai, { expect } from 'chai'; -import CBN from 'chai-bn'; -import { solidity } from 'ethereum-waffle'; -import { ethers } from 'hardhat'; +import { FixedPricePSM } from '@custom-types/contracts'; import { NamedContracts } from '@custom-types/types'; -import { expectRevert, getAddresses, getImpersonatedSigner, resetFork, time } from '@test/helpers'; -import { TestEndtoEndCoordinator } from '@test/integration/setup'; import proposals from '@protocol/proposalsConfig'; +import { expectApprox, expectRevert, getAddresses, getImpersonatedSigner, time } from '@test/helpers'; +import { TestEndtoEndCoordinator } from '@test/integration/setup'; import { forceEth } from '@test/integration/setup/utils'; +import chai, { expect } from 'chai'; +import CBN from 'chai-bn'; +import { solidity } from 'ethereum-waffle'; import { Contract, Signer } from 'ethers'; -import { expectApprox } from '@test/helpers'; -import { FixedPricePSM } from '@custom-types/contracts'; +import { ethers } from 'hardhat'; before(async () => { chai.use(CBN(ethers.BigNumber)); diff --git a/test/integration/tests/dao.ts b/test/integration/tests/dao.ts index 004a71a83..c53ae2578 100644 --- a/test/integration/tests/dao.ts +++ b/test/integration/tests/dao.ts @@ -1,13 +1,13 @@ -import chai, { expect } from 'chai'; -import CBN from 'chai-bn'; -import { solidity } from 'ethereum-waffle'; -import hre, { ethers } from 'hardhat'; +import { Core } from '@custom-types/contracts'; import { NamedAddresses, NamedContracts } from '@custom-types/types'; -import { getImpersonatedSigner, increaseTime, latestTime, resetFork, time } from '@test/helpers'; import proposals from '@protocol/proposalsConfig'; +import { getImpersonatedSigner, increaseTime, latestTime, time } from '@test/helpers'; import { TestEndtoEndCoordinator } from '@test/integration/setup'; import { forceEth } from '@test/integration/setup/utils'; -import { Core } from '@custom-types/contracts'; +import chai, { expect } from 'chai'; +import CBN from 'chai-bn'; +import { solidity } from 'ethereum-waffle'; +import hre, { ethers } from 'hardhat'; const toBN = ethers.BigNumber.from; describe('e2e-dao', function () { diff --git a/test/integration/tests/ethPSM.ts b/test/integration/tests/ethPSM.ts index c1c0f29e3..17556db4b 100644 --- a/test/integration/tests/ethPSM.ts +++ b/test/integration/tests/ethPSM.ts @@ -1,24 +1,23 @@ import { AavePCVDeposit, - PegStabilityModule, Fei, IERC20, PCVDripController, + PegStabilityModule, PSMRouter, WETH9 } from '@custom-types/contracts'; +import { NamedAddresses, NamedContracts } from '@custom-types/types'; import { SignerWithAddress } from '@nomiclabs/hardhat-ethers/signers'; +import proposals from '@protocol/proposalsConfig'; +import { expectApprox, expectRevert, getImpersonatedSigner, increaseTime, time } from '@test/helpers'; import chai, { expect } from 'chai'; import CBN from 'chai-bn'; import { solidity } from 'ethereum-waffle'; import { BigNumber } from 'ethers'; import hre, { ethers } from 'hardhat'; -import { NamedAddresses, NamedContracts } from '@custom-types/types'; -import { expectApprox, expectRevert, getImpersonatedSigner, increaseTime, resetFork } from '@test/helpers'; -import proposals from '@protocol/proposalsConfig'; import { TestEndtoEndCoordinator } from '../setup'; import { forceEth } from '../setup/utils'; -import { time } from '@test/helpers'; const oneEth = ethers.constants.WeiPerEther; diff --git a/test/integration/tests/fei.ts b/test/integration/tests/fei.ts index 60bfb25ba..69dcac5b5 100644 --- a/test/integration/tests/fei.ts +++ b/test/integration/tests/fei.ts @@ -1,13 +1,13 @@ +import { Fei } from '@custom-types/contracts'; +import { NamedContracts } from '@custom-types/types'; +import { Signer } from '@ethersproject/abstract-signer'; +import proposals from '@protocol/proposalsConfig'; +import { ZERO_ADDRESS } from '@test/helpers'; +import { TestEndtoEndCoordinator } from '@test/integration/setup'; import chai, { expect } from 'chai'; import CBN from 'chai-bn'; import { solidity } from 'ethereum-waffle'; import { ethers } from 'hardhat'; -import { NamedAddresses, NamedContracts } from '@custom-types/types'; -import { getAddresses, getImpersonatedSigner, resetFork, ZERO_ADDRESS } from '@test/helpers'; -import proposals from '@protocol/proposalsConfig'; -import { TestEndtoEndCoordinator } from '@test/integration/setup'; -import { Fei } from '@custom-types/contracts'; -import { Signer } from '@ethersproject/abstract-signer'; const toBN = ethers.BigNumber.from; describe('e2e-fei', function () { diff --git a/test/integration/tests/fip-38-tokemak.ts b/test/integration/tests/fip-38-tokemak.ts index 6d4a3d4ff..db58e465c 100644 --- a/test/integration/tests/fip-38-tokemak.ts +++ b/test/integration/tests/fip-38-tokemak.ts @@ -1,12 +1,12 @@ -import chai, { expect } from 'chai'; -import CBN from 'chai-bn'; -import { solidity } from 'ethereum-waffle'; -import { ethers } from 'hardhat'; import { NamedContracts } from '@custom-types/types'; -import { getImpersonatedSigner, time, resetFork } from '@test/helpers'; import proposals from '@protocol/proposalsConfig'; +import { getImpersonatedSigner, time } from '@test/helpers'; import { TestEndtoEndCoordinator } from '@test/integration/setup'; import { forceEth } from '@test/integration/setup/utils'; +import chai, { expect } from 'chai'; +import CBN from 'chai-bn'; +import { solidity } from 'ethereum-waffle'; +import { ethers } from 'hardhat'; const toBN = ethers.BigNumber.from; const tenPow18 = toBN('1000000000000000000'); diff --git a/test/integration/tests/fuse.ts b/test/integration/tests/fuse.ts index e28298613..8183df452 100644 --- a/test/integration/tests/fuse.ts +++ b/test/integration/tests/fuse.ts @@ -1,10 +1,10 @@ +import { NamedAddresses, NamedContracts } from '@custom-types/types'; +import proposals from '@protocol/proposalsConfig'; +import { getImpersonatedSigner, time } from '@test/helpers'; import chai, { expect } from 'chai'; import CBN from 'chai-bn'; import { solidity } from 'ethereum-waffle'; import { ethers } from 'hardhat'; -import { NamedAddresses, NamedContracts } from '@custom-types/types'; -import { getImpersonatedSigner, resetFork, time } from '@test/helpers'; -import proposals from '@protocol/proposalsConfig'; import { TestEndtoEndCoordinator } from '../setup'; import { forceEth } from '../setup/utils'; diff --git a/test/integration/tests/lusdPSM.ts b/test/integration/tests/lusdPSM.ts index 5fde0e5ff..50791f1f2 100644 --- a/test/integration/tests/lusdPSM.ts +++ b/test/integration/tests/lusdPSM.ts @@ -1,19 +1,13 @@ -import { PegStabilityModule, Fei, IERC20, PCVDripController, BAMMDeposit, FeiSkimmer } from '@custom-types/contracts'; +import { BAMMDeposit, Fei, FeiSkimmer, IERC20, PCVDripController, PegStabilityModule } from '@custom-types/contracts'; +import { NamedAddresses, NamedContracts } from '@custom-types/types'; import { SignerWithAddress } from '@nomiclabs/hardhat-ethers/signers'; +import proposals from '@protocol/proposalsConfig'; +import { expectRevert, getImpersonatedSigner, increaseTime, overwriteChainlinkAggregator } from '@test/helpers'; import chai, { expect } from 'chai'; import CBN from 'chai-bn'; import { solidity } from 'ethereum-waffle'; import { BigNumber } from 'ethers'; import hre, { ethers } from 'hardhat'; -import { NamedAddresses, NamedContracts } from '@custom-types/types'; -import { - expectRevert, - getImpersonatedSigner, - increaseTime, - overwriteChainlinkAggregator, - resetFork -} from '@test/helpers'; -import proposals from '@protocol/proposalsConfig'; import { TestEndtoEndCoordinator } from '../setup'; import { forceEth } from '../setup/utils'; diff --git a/test/integration/tests/pcv.ts b/test/integration/tests/pcv.ts index 93edd99db..802d8462f 100644 --- a/test/integration/tests/pcv.ts +++ b/test/integration/tests/pcv.ts @@ -1,13 +1,13 @@ +import { NamedAddresses, NamedContracts } from '@custom-types/types'; +import proposals from '@protocol/proposalsConfig'; +import { expectApprox, getImpersonatedSigner, overwriteChainlinkAggregator, resetFork, time } from '@test/helpers'; +import { forceEth } from '@test/integration/setup/utils'; import chai, { expect } from 'chai'; import CBN from 'chai-bn'; import { solidity } from 'ethereum-waffle'; import { Contract } from 'ethers'; import hre, { ethers } from 'hardhat'; -import { NamedAddresses, NamedContracts } from '@custom-types/types'; -import { expectApprox, getImpersonatedSigner, overwriteChainlinkAggregator, resetFork, time } from '@test/helpers'; -import proposals from '@protocol/proposalsConfig'; import { TestEndtoEndCoordinator } from '../setup'; -import { forceEth } from '@test/integration/setup/utils'; const toBN = ethers.BigNumber.from; diff --git a/test/integration/tests/podOperation.ts b/test/integration/tests/podOperation.ts index 26efbe593..bcf9b70a1 100644 --- a/test/integration/tests/podOperation.ts +++ b/test/integration/tests/podOperation.ts @@ -1,18 +1,18 @@ import { PodAdminGateway, PodFactory } from '@custom-types/contracts'; +import { NamedAddresses, NamedContracts } from '@custom-types/types'; +import Safe from '@gnosis.pm/safe-core-sdk'; import { SignerWithAddress } from '@nomiclabs/hardhat-ethers/signers'; +import { MIN_TIMELOCK_DELAY, TRIBAL_COUNCIL_POD_ID, tribeCouncilPodConfig } from '@protocol/optimisticGovernance'; +import proposals from '@protocol/proposalsConfig'; +import { getImpersonatedSigner, initialiseGnosisSDK, time } from '@test/helpers'; +import { forceEth } from '@test/integration/setup/utils'; import chai, { expect } from 'chai'; import CBN from 'chai-bn'; import { solidity } from 'ethereum-waffle'; -import { ethers } from 'hardhat'; -import { NamedAddresses, NamedContracts } from '@custom-types/types'; -import { getImpersonatedSigner, time, initialiseGnosisSDK } from '@test/helpers'; -import proposals from '@protocol/proposalsConfig'; -import { forceEth } from '@test/integration/setup/utils'; -import { TestEndtoEndCoordinator } from '../setup'; import { BigNumberish, Contract } from 'ethers'; +import { ethers } from 'hardhat'; import { abi as timelockABI } from '../../../artifacts/@openzeppelin/contracts/governance/TimelockController.sol/TimelockController.json'; -import { MIN_TIMELOCK_DELAY, tribeCouncilPodConfig, TRIBAL_COUNCIL_POD_ID } from '@protocol/optimisticGovernance'; -import Safe from '@gnosis.pm/safe-core-sdk'; +import { TestEndtoEndCoordinator } from '../setup'; function createSafeTxArgs(timelock: Contract, functionSig: string, args: any[]) { return { diff --git a/test/integration/tests/psm.ts b/test/integration/tests/psm.ts index 5355d8bef..f47ed6c12 100644 --- a/test/integration/tests/psm.ts +++ b/test/integration/tests/psm.ts @@ -21,8 +21,8 @@ describe('e2e-peg-stability-module', function () { let daiPCVDripController: Contract; let doLogging: boolean; let ethPSMRouter: Contract; - let userAddress; - let minterAddress; + let userAddress: string; + let minterAddress: string; let governorAddress; let weth: Contract; let dai: Contract; @@ -31,9 +31,9 @@ describe('e2e-peg-stability-module', function () { let fei: Contract; let rai: Contract; let core: Contract; - let feiDAOTimelock; - let beneficiaryAddress1; - let guardianAddress; + let feiDAOTimelock: Contract; + let beneficiaryAddress1: string; + let guardianAddress: string; let daiFixedPricePSM: Contract; before(async () => { diff --git a/test/integration/tests/staking.ts b/test/integration/tests/staking.ts index 5d7f378b6..081e2fb58 100644 --- a/test/integration/tests/staking.ts +++ b/test/integration/tests/staking.ts @@ -9,17 +9,17 @@ import { TribalChiefSyncV2, Tribe } from '@custom-types/contracts'; +import { NamedAddresses, NamedContracts } from '@custom-types/types'; import { SignerWithAddress } from '@nomiclabs/hardhat-ethers/signers'; +import proposals from '@protocol/proposalsConfig'; +import { expectApprox, getImpersonatedSigner, time } from '@test/helpers'; +import { forceEth } from '@test/integration/setup/utils'; import chai, { expect } from 'chai'; import CBN from 'chai-bn'; import { solidity } from 'ethereum-waffle'; import { BigNumber, Contract } from 'ethers'; import hre, { ethers } from 'hardhat'; -import { NamedAddresses, NamedContracts } from '@custom-types/types'; -import { expectApprox, getImpersonatedSigner, time } from '@test/helpers'; -import proposals from '@protocol/proposalsConfig'; import { TestEndtoEndCoordinator } from '../setup'; -import { forceEth } from '@test/integration/setup/utils'; const toBN = ethers.BigNumber.from; diff --git a/test/integration/tests/tribalCouncil.ts b/test/integration/tests/tribalCouncil.ts index c1cdf0da4..a8864088c 100644 --- a/test/integration/tests/tribalCouncil.ts +++ b/test/integration/tests/tribalCouncil.ts @@ -1,16 +1,16 @@ -import { PodFactory, PodAdminGateway, RoleBastion, Core } from '@custom-types/contracts'; +import { Core, PodAdminGateway, PodFactory, RoleBastion } from '@custom-types/contracts'; +import { NamedAddresses, NamedContracts } from '@custom-types/types'; import { SignerWithAddress } from '@nomiclabs/hardhat-ethers/signers'; +import { MIN_TIMELOCK_DELAY, tribalCouncilMembers } from '@protocol/optimisticGovernance'; +import proposals from '@protocol/proposalsConfig'; +import { getImpersonatedSigner } from '@test/helpers'; +import { forceEth } from '@test/integration/setup/utils'; import chai, { expect } from 'chai'; import CBN from 'chai-bn'; import { solidity } from 'ethereum-waffle'; +import { BigNumber } from 'ethers'; import { ethers } from 'hardhat'; -import { NamedAddresses, NamedContracts } from '@custom-types/types'; -import { getImpersonatedSigner, resetFork } from '@test/helpers'; -import proposals from '@protocol/proposalsConfig'; -import { forceEth } from '@test/integration/setup/utils'; import { TestEndtoEndCoordinator } from '../setup'; -import { BigNumber } from 'ethers'; -import { tribalCouncilMembers, MIN_TIMELOCK_DELAY } from '@protocol/optimisticGovernance'; const toBN = ethers.BigNumber.from; diff --git a/test/integration/tests/tribalchief.ts b/test/integration/tests/tribalchief.ts index 6d197010c..fa2e99232 100644 --- a/test/integration/tests/tribalchief.ts +++ b/test/integration/tests/tribalchief.ts @@ -1,12 +1,12 @@ +import { NamedContracts } from '@custom-types/types'; +import mainnetAddresses from '@protocol/mainnetAddresses'; +import proposals from '@protocol/proposalsConfig'; +import tribalchief from '@protocol/tribalchief'; +import { TestEndtoEndCoordinator } from '@test/integration/setup'; import chai, { expect } from 'chai'; import CBN from 'chai-bn'; import { solidity } from 'ethereum-waffle'; import { ethers } from 'hardhat'; -import { NamedContracts } from '@custom-types/types'; -import { TestEndtoEndCoordinator } from '@test/integration/setup'; -import proposals from '@protocol/proposalsConfig'; -import mainnetAddresses from '@protocol/mainnetAddresses'; -import tribalchief from '@protocol/tribalchief'; describe('e2e-tribalchief', function () { let contracts: NamedContracts; diff --git a/test/integration/tests/tribeIncentivesEnd.ts b/test/integration/tests/tribeIncentivesEnd.ts index 6bcb2bcc1..60a22fa26 100644 --- a/test/integration/tests/tribeIncentivesEnd.ts +++ b/test/integration/tests/tribeIncentivesEnd.ts @@ -1,13 +1,13 @@ +import { TribalChief, Tribe } from '@custom-types/contracts'; +import { NamedAddresses, NamedContracts } from '@custom-types/types'; +import proposals from '@protocol/proposalsConfig'; +import { getImpersonatedSigner, resetFork, time } from '@test/helpers'; +import { forceEth } from '@test/integration/setup/utils'; import chai, { expect } from 'chai'; import CBN from 'chai-bn'; import { solidity } from 'ethereum-waffle'; import { ethers } from 'hardhat'; -import { NamedAddresses, NamedContracts } from '@custom-types/types'; -import { getImpersonatedSigner, resetFork, time } from '@test/helpers'; -import proposals from '@protocol/proposalsConfig'; import { TestEndtoEndCoordinator } from '../setup'; -import { forceEth } from '@test/integration/setup/utils'; -import { TribalChief, Tribe } from '@custom-types/contracts'; const toBN = ethers.BigNumber.from; chai.use(CBN(ethers.BigNumber)); diff --git a/test/integration/tests/turboPCVDeposit.ts b/test/integration/tests/turboPCVDeposit.ts index aa3394802..cb24359df 100644 --- a/test/integration/tests/turboPCVDeposit.ts +++ b/test/integration/tests/turboPCVDeposit.ts @@ -1,12 +1,12 @@ +import { NamedAddresses, NamedContracts } from '@custom-types/types'; +import proposals from '@protocol/proposalsConfig'; +import { expectApprox, getImpersonatedSigner } from '@test/helpers'; import chai, { expect } from 'chai'; import CBN from 'chai-bn'; import { solidity } from 'ethereum-waffle'; import { ethers } from 'hardhat'; -import { NamedAddresses, NamedContracts } from '@custom-types/types'; -import proposals from '@protocol/proposalsConfig'; -import { TestEndtoEndCoordinator } from '../setup'; -import { expectApprox, getImpersonatedSigner, resetFork } from '@test/helpers'; import { abi as PCVDepositAbi } from '../../../artifacts/contracts/pcv/compound/ERC20CompoundPCVDeposit.sol/ERC20CompoundPCVDeposit.json'; +import { TestEndtoEndCoordinator } from '../setup'; import { forceEth } from '../setup/utils'; describe('Turbo PCV deposit', function () { diff --git a/test/integration/tests/votium-bribe.ts b/test/integration/tests/votium-bribe.ts index 6f43ee51d..c95ab1f34 100644 --- a/test/integration/tests/votium-bribe.ts +++ b/test/integration/tests/votium-bribe.ts @@ -1,10 +1,9 @@ -import { expect } from 'chai'; -import { ethers } from 'hardhat'; import { NamedContracts } from '@custom-types/types'; -import { getImpersonatedSigner, time } from '@test/helpers'; -import { TestEndtoEndCoordinator } from '@test/integration/setup'; import proposals from '@protocol/proposalsConfig'; -import { expectRevert } from '@test/helpers'; +import { expectRevert, getImpersonatedSigner, time } from '@test/helpers'; +import { TestEndtoEndCoordinator } from '@test/integration/setup'; +import { expect } from 'chai'; +import { ethers } from 'hardhat'; import { forceEth } from '../setup/utils'; const VOTIUM_ADMIN = '0xdC7C7F0bEA8444c12ec98Ec626ff071c6fA27a19'; // tommyg.eth From 75ced9f3ae58058a1dbe6cc9a0104cadbaac0a8a Mon Sep 17 00:00:00 2001 From: Caleb Date: Tue, 7 Jun 2022 03:40:55 -0700 Subject: [PATCH 244/274] Fix last of the integration tests --- .../collateralizationOracle.ts | 4 +++- test/integration/tests/daiFixedPricePSM.ts | 4 ++-- test/integration/tests/dao.ts | 18 ++++++++++++------ test/integration/tests/podOperation.ts | 9 +++++---- test/integration/tests/tribalCouncil.ts | 3 ++- 5 files changed, 24 insertions(+), 14 deletions(-) diff --git a/protocol-configuration/collateralizationOracle.ts b/protocol-configuration/collateralizationOracle.ts index 6ed1e8c77..1f1ac50e3 100644 --- a/protocol-configuration/collateralizationOracle.ts +++ b/protocol-configuration/collateralizationOracle.ts @@ -1,4 +1,4 @@ -const collateralizationAddresses = { +const collateralizationAddresses: CollateralizationAddressType = { fei: [ 'feiOATimelockWrapper', 'rariPool6FeiPCVDepositWrapper', @@ -34,4 +34,6 @@ const collateralizationAddresses = { volt: ['voltDepositWrapper'] }; +export type CollateralizationAddressType = { [key: string]: string[] }; + export default collateralizationAddresses; diff --git a/test/integration/tests/daiFixedPricePSM.ts b/test/integration/tests/daiFixedPricePSM.ts index 26ee12690..1fdf0f7a2 100644 --- a/test/integration/tests/daiFixedPricePSM.ts +++ b/test/integration/tests/daiFixedPricePSM.ts @@ -22,8 +22,8 @@ describe('e2e-peg-stability-module', function () { let e2eCoord: TestEndtoEndCoordinator; let daiPCVDripController: Contract; let doLogging: boolean; - let userAddress; - let minterAddress; + let userAddress: string; + let minterAddress: string; let governorAddress; let dai: Contract; let daiPSM: Contract; diff --git a/test/integration/tests/dao.ts b/test/integration/tests/dao.ts index c53ae2578..4049e4720 100644 --- a/test/integration/tests/dao.ts +++ b/test/integration/tests/dao.ts @@ -1,5 +1,5 @@ import { Core } from '@custom-types/contracts'; -import { NamedAddresses, NamedContracts } from '@custom-types/types'; +import { ContractAccessRights, NamedAddresses, NamedContracts } from '@custom-types/types'; import proposals from '@protocol/proposalsConfig'; import { getImpersonatedSigner, increaseTime, latestTime, time } from '@test/helpers'; import { TestEndtoEndCoordinator } from '@test/integration/setup'; @@ -71,7 +71,7 @@ describe('e2e-dao', function () { const calldatas = [ '0x70b0f660000000000000000000000000000000000000000000000000000000000000000a' // set voting delay 10 ]; - const description = []; + const description = ''; await hre.network.provider.request({ method: 'hardhat_impersonateAccount', @@ -218,7 +218,10 @@ describe('e2e-dao', function () { const id = ethers.utils.id(element); const numRoles = await core.getRoleMemberCount(id); doLogging && console.log(`Role count for ${element}: ${numRoles}`); - expect(numRoles.toNumber()).to.be.equal(accessRights[element].length, 'role ' + element); + expect(numRoles.toNumber()).to.be.equal( + accessRights[element as keyof ContractAccessRights].length, + 'role ' + element + ); } }); @@ -230,13 +233,16 @@ describe('e2e-dao', function () { for (let i = 0; i < roles.length; i++) { const element = roles[i]; const id = ethers.utils.id(element); - for (let i = 0; i < accessControl[element].length; i++) { - const contractAddress = accessControl[element][i]; + for (let i = 0; i < accessControl[element as keyof ContractAccessRights].length; i++) { + const contractAddress = accessControl[element as keyof ContractAccessRights][i]; doLogging && console.log(`${element} contract address: ${contractAddress}`); const hasRole = await core.hasRole(id, contractAddress); expect(hasRole).to.be.equal( true, - 'expect contract ' + accessControl[element][i] + ' expected to have role ' + element + 'expect contract ' + + accessControl[element as keyof ContractAccessRights][i] + + ' expected to have role ' + + element ); } } diff --git a/test/integration/tests/podOperation.ts b/test/integration/tests/podOperation.ts index bcf9b70a1..e2efa8b60 100644 --- a/test/integration/tests/podOperation.ts +++ b/test/integration/tests/podOperation.ts @@ -103,8 +103,8 @@ describe('Pod operation and veto', function () { // 1. Deploy a pod through which a proposal will be executed const deployTx = await podFactory.connect(tribalCouncilTimelockSigner).createOptimisticPod(podConfig); - const { args } = (await deployTx.wait()).events.find((elem) => elem.event === 'CreatePod'); - + const result = (await deployTx.wait()).events!.find((elem) => elem.event === 'CreatePod'); + const args = result!.args!; podId = args.podId; const safeAddress = await podFactory.getPodSafe(podId); timelockAddress = await podFactory.getPodTimelock(podId); @@ -213,7 +213,8 @@ describe('Pod operation and veto', function () { const values = [0]; const proposeTx = await nopeDAO.propose(targets, values, calldatas, description); - const { args } = (await proposeTx.wait()).events.find((elem) => elem.event === 'ProposalCreated'); + const result = (await proposeTx.wait()).events!.find((elem: any) => elem.event === 'ProposalCreated'); + const args = result!.args!; const nopeDAOProposalId = args.proposalId; // Use the proposalID to vote for this proposal on the nopeDAO @@ -317,7 +318,7 @@ describe('Pod operation and veto', function () { const values = [0]; const proposeTx = await nopeDAO.propose(targets, values, calldatas, description); - const { args } = (await proposeTx.wait()).events.find((elem) => elem.event === 'ProposalCreated'); + const { args } = (await proposeTx.wait()).events.find((elem: any) => elem.event === 'ProposalCreated'); const nopeDAOProposalId = args.proposalId; // Use the proposalID to vote for this proposal on the nopeDAO diff --git a/test/integration/tests/tribalCouncil.ts b/test/integration/tests/tribalCouncil.ts index a8864088c..52b72f172 100644 --- a/test/integration/tests/tribalCouncil.ts +++ b/test/integration/tests/tribalCouncil.ts @@ -121,7 +121,8 @@ describe('Tribal Council', function () { /////////// TribalCouncil management of other pods ///////////// it('can create a child pod', async () => { const deployTx = await podFactory.connect(tribalCouncilTimelockSigner).createOptimisticPod(podConfig); - const { args } = (await deployTx.wait()).events.find((elem) => elem.event === 'CreatePod'); + const result = (await deployTx.wait()).events!.find((elem) => elem.event === 'CreatePod'); + const args = result!.args!; const podId = args.podId; const numPodMembers = await podFactory.getNumMembers(podId); expect(numPodMembers).to.equal(4); From 162bc6973e49b2c032c8e6bcaa45f9eec0c22e55 Mon Sep 17 00:00:00 2001 From: Caleb Date: Tue, 7 Jun 2022 03:49:57 -0700 Subject: [PATCH 245/274] More fixes --- test/helpers.ts | 13 +++++++------ test/integration/tests/ethPSM.ts | 6 +++--- test/integration/tests/lusdPSM.ts | 6 +++--- 3 files changed, 13 insertions(+), 12 deletions(-) diff --git a/test/helpers.ts b/test/helpers.ts index d7101def1..3c04312ba 100644 --- a/test/helpers.ts +++ b/test/helpers.ts @@ -2,11 +2,12 @@ import hre, { ethers, artifacts, network } from 'hardhat'; import chai from 'chai'; import CBN from 'chai-bn'; import { Core, Core__factory } from '@custom-types/contracts'; -import { BigNumber, BigNumberish, Contract, Signer } from 'ethers'; +import { BigNumber, BigNumberish, Contract, ContractTransaction, Signer } from 'ethers'; import { NamedAddresses } from '@custom-types/types'; import { SignerWithAddress } from '@nomiclabs/hardhat-ethers/signers'; import EthersAdapter from '@gnosis.pm/safe-ethers-lib'; import Safe from '@gnosis.pm/safe-core-sdk'; +import { TransactionDescription } from 'ethers/lib/utils'; // use default BigNumber chai.use(CBN(ethers.BigNumber)); @@ -175,17 +176,17 @@ async function expectApproxAbs( expect(actualBN).to.be.lte(upperBound); } -async function expectEvent(tx, contract: any, event: string, args: any[]): Promise { +async function expectEvent(tx: ContractTransaction, contract: any, event: string, args: any[]): Promise { await expect(tx) .to.emit(contract, event) .withArgs(...args); } -async function expectRevert(tx, errorMessage: string): Promise { +async function expectRevert(tx: ContractTransaction, errorMessage: string): Promise { await expect(tx).to.be.revertedWith(errorMessage); } -async function expectUnspecifiedRevert(tx): Promise { +async function expectUnspecifiedRevert(tx: ContractTransaction): Promise { await expect(tx).to.be.reverted; } @@ -199,7 +200,7 @@ const balance = { } }; -async function overwriteChainlinkAggregator(chainlink, value, decimals) { +async function overwriteChainlinkAggregator(aggregatorAddress: string, value: string, decimals: string) { // Deploy new mock aggregator const factory = await ethers.getContractFactory('MockChainlinkOracle'); const mockAggregator = await factory.deploy(value, decimals); @@ -208,7 +209,7 @@ async function overwriteChainlinkAggregator(chainlink, value, decimals) { // Overwrite storage at chainlink address to use mock aggregator for updates const address = `0x00000000000000000000${mockAggregator.address.slice(2)}0005`; - await hre.network.provider.send('hardhat_setStorageAt', [chainlink, '0x2', address]); + await hre.network.provider.send('hardhat_setStorageAt', [aggregatorAddress, '0x2', address]); } const time = { diff --git a/test/integration/tests/ethPSM.ts b/test/integration/tests/ethPSM.ts index 17556db4b..3aba11217 100644 --- a/test/integration/tests/ethPSM.ts +++ b/test/integration/tests/ethPSM.ts @@ -94,7 +94,7 @@ describe('eth PSM', function () { describe('ethPSM', async () => { it('cannot sell eth to the PSM as redemptions are disabled', async () => { - await expectRevert(ethPSM.redeem(ethPSM.address, 0, 0), 'EthPSM: Redeem paused'); + await expectRevert(await ethPSM.redeem(ethPSM.address, 0, 0), 'EthPSM: Redeem paused'); }); it('can sell weth directly to the PSM as minting is active', async () => { @@ -114,7 +114,7 @@ describe('eth PSM', function () { describe('PSMRouter', async () => { it('cannot sell fei to the PSM as redemptions are disabled', async () => { await expectRevert( - ethPSMRouter.connect(deployAddress)['redeem(address,uint256,uint256)'](ethPSM.address, 0, 0), + await ethPSMRouter.connect(deployAddress)['redeem(address,uint256,uint256)'](ethPSM.address, 0, 0), 'EthPSM: Redeem paused' ); }); @@ -147,7 +147,7 @@ describe('eth PSM', function () { }); it('dripper cannot drip because it is paused', async () => { - await expectRevert(dripper.drip(), 'Pausable: paused'); + await expectRevert(await dripper.drip(), 'Pausable: paused'); }); }); diff --git a/test/integration/tests/lusdPSM.ts b/test/integration/tests/lusdPSM.ts index 50791f1f2..501316a28 100644 --- a/test/integration/tests/lusdPSM.ts +++ b/test/integration/tests/lusdPSM.ts @@ -81,11 +81,11 @@ describe('lusd PSM', function () { describe('lusdPSM', async () => { /// create a before each hook that approves the PSM to spend user's LUSD it('cannot sell lusd to the PSM as redemptions are disabled', async () => { - await expectRevert(lusdPSM.redeem(lusdPSM.address, 0, 0), 'EthPSM: Redeem paused'); + await expectRevert(await lusdPSM.redeem(lusdPSM.address, 0, 0), 'EthPSM: Redeem paused'); }); it('cannot buy lusd to the PSM as minting is disabled', async () => { - await expectRevert(lusdPSM.mint(lusdPSM.address, 0, 0), 'Pausable: paused'); + await expectRevert(await lusdPSM.mint(lusdPSM.address, 0, 0), 'Pausable: paused'); }); }); @@ -97,7 +97,7 @@ describe('lusd PSM', function () { }); it('dripper cannot drip because it is paused', async () => { - await expectRevert(dripper.drip(), 'Pausable: paused'); + await expectRevert(await dripper.drip(), 'Pausable: paused'); }); }); From d040733f425f62aaebfb76fcecba185d7d3e407b Mon Sep 17 00:00:00 2001 From: Caleb Date: Tue, 7 Jun 2022 03:52:00 -0700 Subject: [PATCH 246/274] Fixes --- test/helpers.ts | 6 +++--- test/integration/tests/lusdPSM.ts | 6 +++--- test/integration/tests/metagov/BalancerGaugeStaker.ts | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/test/helpers.ts b/test/helpers.ts index 3c04312ba..c57638df4 100644 --- a/test/helpers.ts +++ b/test/helpers.ts @@ -176,17 +176,17 @@ async function expectApproxAbs( expect(actualBN).to.be.lte(upperBound); } -async function expectEvent(tx: ContractTransaction, contract: any, event: string, args: any[]): Promise { +async function expectEvent(tx: Promise, contract: any, event: string, args: any[]): Promise { await expect(tx) .to.emit(contract, event) .withArgs(...args); } -async function expectRevert(tx: ContractTransaction, errorMessage: string): Promise { +async function expectRevert(tx: Promise, errorMessage: string): Promise { await expect(tx).to.be.revertedWith(errorMessage); } -async function expectUnspecifiedRevert(tx: ContractTransaction): Promise { +async function expectUnspecifiedRevert(tx: Promise): Promise { await expect(tx).to.be.reverted; } diff --git a/test/integration/tests/lusdPSM.ts b/test/integration/tests/lusdPSM.ts index 501316a28..50791f1f2 100644 --- a/test/integration/tests/lusdPSM.ts +++ b/test/integration/tests/lusdPSM.ts @@ -81,11 +81,11 @@ describe('lusd PSM', function () { describe('lusdPSM', async () => { /// create a before each hook that approves the PSM to spend user's LUSD it('cannot sell lusd to the PSM as redemptions are disabled', async () => { - await expectRevert(await lusdPSM.redeem(lusdPSM.address, 0, 0), 'EthPSM: Redeem paused'); + await expectRevert(lusdPSM.redeem(lusdPSM.address, 0, 0), 'EthPSM: Redeem paused'); }); it('cannot buy lusd to the PSM as minting is disabled', async () => { - await expectRevert(await lusdPSM.mint(lusdPSM.address, 0, 0), 'Pausable: paused'); + await expectRevert(lusdPSM.mint(lusdPSM.address, 0, 0), 'Pausable: paused'); }); }); @@ -97,7 +97,7 @@ describe('lusd PSM', function () { }); it('dripper cannot drip because it is paused', async () => { - await expectRevert(await dripper.drip(), 'Pausable: paused'); + await expectRevert(dripper.drip(), 'Pausable: paused'); }); }); diff --git a/test/integration/tests/metagov/BalancerGaugeStaker.ts b/test/integration/tests/metagov/BalancerGaugeStaker.ts index 644636419..d4fd44911 100644 --- a/test/integration/tests/metagov/BalancerGaugeStaker.ts +++ b/test/integration/tests/metagov/BalancerGaugeStaker.ts @@ -155,7 +155,7 @@ describe('e2e-metagov', function () { it('should work if user has PCV_CONTROLLER_ROLE role', async function () { const balanceBefore = await contracts.bal.balanceOf(daoSigner.address); expectEvent( - await staker.connect(daoSigner).withdrawERC20(contracts.bal.address, daoSigner.address, '10'), + staker.connect(daoSigner).withdrawERC20(contracts.bal.address, daoSigner.address, '10'), staker, 'WithdrawERC20', [daoSigner.address, contracts.bal.address, daoSigner.address, '10'] From a818cbef6e9ba45a1e07b6822dade15c1923fe05 Mon Sep 17 00:00:00 2001 From: thomas-waite Date: Tue, 7 Jun 2022 12:12:05 +0100 Subject: [PATCH 247/274] test: relax sanity check on DAI amount --- proposals/dao/fip_104b.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/proposals/dao/fip_104b.ts b/proposals/dao/fip_104b.ts index 97f3f114a..f02b01a33 100644 --- a/proposals/dao/fip_104b.ts +++ b/proposals/dao/fip_104b.ts @@ -52,7 +52,7 @@ const teardown: TeardownUpgradeFunc = async (addresses, oldContracts, contracts, // IE check balances, check state of contracts, etc. const validate: ValidateUpgradeFunc = async (addresses, oldContracts, contracts, logging) => { // 1. Validate withdrawn liquidity destinations - const sanityCheckDAIAmount = ethers.constants.WeiPerEther.mul(3_500_000); + const sanityCheckDAIAmount = ethers.constants.WeiPerEther.mul(3_200_000); const finalDAIDepositBalance = await contracts.compoundDaiPCVDeposit.balance(); const daiGained = finalDAIDepositBalance.sub(initialDaiPCVBalance); expect(daiGained).to.be.bignumber.at.least(sanityCheckDAIAmount); From 0e43fe9a48d05b2655f89a69e1ce1a8f4185425f Mon Sep 17 00:00:00 2001 From: Caleb Date: Tue, 7 Jun 2022 04:12:36 -0700 Subject: [PATCH 248/274] Fix index --- protocol-configuration/permissions.ts | 2 ++ scripts/utils/simulateDEBUGProposal.ts | 27 +++++--------------------- test/integration/setup/index.ts | 17 +++++++++++----- types/types.ts | 14 +++++++++++-- 4 files changed, 31 insertions(+), 29 deletions(-) diff --git a/protocol-configuration/permissions.ts b/protocol-configuration/permissions.ts index f6f5896df..048ec479e 100644 --- a/protocol-configuration/permissions.ts +++ b/protocol-configuration/permissions.ts @@ -58,3 +58,5 @@ export const permissions = { PCV_MINOR_PARAM_ROLE: ['feiDAOTimelock', 'optimisticTimelock', 'tribalCouncilTimelock'], TOKEMAK_DEPOSIT_ADMIN_ROLE: ['optimisticTimelock', 'feiDAOTimelock', 'tribalCouncilTimelock'] }; + +export type PermissionsType = keyof typeof permissions; diff --git a/scripts/utils/simulateDEBUGProposal.ts b/scripts/utils/simulateDEBUGProposal.ts index a926ae17c..aedfa3860 100644 --- a/scripts/utils/simulateDEBUGProposal.ts +++ b/scripts/utils/simulateDEBUGProposal.ts @@ -1,12 +1,11 @@ -import { MainnetContracts, NamedAddresses, ProposalConfig } from '@custom-types/types'; +import { MainnetContracts, NamedAddresses, ProposalConfig, TemplatedProposalConfig } from '@custom-types/types'; import { Contract, Signer } from 'ethers'; -import format from 'string-template'; export async function simulateDEBUGProposal( signer: Signer, contractAddresses: NamedAddresses, contracts: MainnetContracts, - config: ProposalConfig + config: TemplatedProposalConfig ) { let totalGasUsed = 0; for (let i = 0; i < config.proposal.commands.length; i++) { @@ -15,8 +14,9 @@ export async function simulateDEBUGProposal( console.log(' Step' + (config.proposal.commands.length >= 10 && i < 10 ? ' ' : ''), i, ':', cmd.description); const to = contractAddresses[cmd.target] || cmd.target; const value = cmd.values; - const args = replaceArgs(cmd.arguments, contractAddresses); - const ethersContract: Contract = contracts[cmd.target] as Contract; + + const args = cmd.arguments(contractAddresses); + const ethersContract: Contract = contracts[cmd.target as keyof MainnetContracts] as Contract; const calldata = ethersContract.interface.encodeFunctionData(cmd.method, args); console.log(' Target:', cmd.target, '[' + to + ']'); console.log(' Method:', cmd.method, '- Calling...'); @@ -29,20 +29,3 @@ export async function simulateDEBUGProposal( } console.log(' Done. Used', totalGasUsed, 'gas in total.'); } - -// Recursively interpolate strings in the argument array -export function replaceArgs(args: any[], contractNames: NamedAddresses): any[] { - const result = []; - for (let i = 0; i < args.length; i++) { - const element = args[i]; - if (typeof element === typeof '') { - const formatted = format(element, contractNames); - result.push(formatted); - } else if (typeof element === typeof []) { - result.push(replaceArgs(element, contractNames)); - } else { - result.push(element); - } - } - return result; -} diff --git a/test/integration/setup/index.ts b/test/integration/setup/index.ts index be20f357c..6ad05629f 100644 --- a/test/integration/setup/index.ts +++ b/test/integration/setup/index.ts @@ -1,4 +1,4 @@ -import { permissions } from '@protocol/permissions'; +import { permissions, PermissionsType } from '@protocol/permissions'; import { getAllContractAddresses, getAllContracts } from './loadContracts'; import { Config, @@ -6,6 +6,7 @@ import { TestCoordinator, ContractsAndAddresses, ProposalConfig, + TemplatedProposalConfig, namedContractsToNamedAddresses, NamedAddresses, NamedContracts, @@ -99,7 +100,7 @@ export class TestEndtoEndCoordinator implements TestCoordinator { async applyUpgrade( existingContracts: NamedContracts, proposalName: string, - config: ProposalConfig + config: TemplatedProposalConfig ): Promise { let deployedUpgradedContracts = {}; @@ -247,16 +248,22 @@ export class TestEndtoEndCoordinator implements TestCoordinator { * permissions contract */ getAccessControlMapping(): ContractAccessRights { - const accessControlRoles = {}; + const accessControlRoles: ContractAccessRights = { + minter: [], + burner: [], + pcvController: [], + governor: [], + guardian: [] + }; // Array of all deployed contracts Object.keys(permissions).map((role) => { - const contracts = permissions[role]; + const contracts = permissions[role as PermissionsType]; const addresses = contracts.map((contractName) => { return this.afterUpgradeAddresses[contractName]; }); - accessControlRoles[role] = addresses; + accessControlRoles[role as keyof ContractAccessRights] = addresses; }); return accessControlRoles as ContractAccessRights; diff --git a/types/types.ts b/types/types.ts index 5c752da28..f3db8922c 100644 --- a/types/types.ts +++ b/types/types.ts @@ -70,7 +70,7 @@ export enum ProposalCategory { None } -export type ProposalConfig = { +export interface ProposalConfig { deploy: boolean; category: ProposalCategory; totalValue: number; @@ -78,7 +78,17 @@ export type ProposalConfig = { affectedContractSignoff: string[]; deprecatedContractSignoff: string[]; proposalId: string; -}; +} + +export interface TemplatedProposalConfig { + deploy: boolean; + category: ProposalCategory; + totalValue: number; + proposal: TemplatedProposalDescription; + affectedContractSignoff: string[]; + deprecatedContractSignoff: string[]; + proposalId: string; +} export type ProposalsConfigMap = { [key: string]: ProposalConfig; From 7d23881c7450585cb78fd7ed78b06968796ba74b Mon Sep 17 00:00:00 2001 From: Joey Santoro Date: Tue, 7 Jun 2022 04:16:37 -0700 Subject: [PATCH 249/274] deploy and verify --- block.txt | 2 +- protocol-configuration/mainnetAddresses.ts | 20 ++++++++++++++++++++ test/integration/proposals_config.ts | 2 +- 3 files changed, 22 insertions(+), 2 deletions(-) diff --git a/block.txt b/block.txt index 4245c0f7a..e539c50d3 100644 --- a/block.txt +++ b/block.txt @@ -1 +1 @@ -14885000 +14920337 diff --git a/protocol-configuration/mainnetAddresses.ts b/protocol-configuration/mainnetAddresses.ts index be2665256..1ce0b0ddc 100644 --- a/protocol-configuration/mainnetAddresses.ts +++ b/protocol-configuration/mainnetAddresses.ts @@ -196,6 +196,26 @@ const MainnetAddresses: MainnetAddresses = { address: '0xd10386804959a121a8a487e49f45aa9f5a2eb2a0', category: AddressCategory.External }, + ethToDaiLBPSwapper: { + artifactName: 'BalancerLBPSwapper', + address: '0xf7991f4698ffb6716982aec7f78964dd731c4a54', + category: AddressCategory.Core + }, + ethToDaiLensDai: { + artifactName: 'BPTLens', + address: '0xdf9ff5c077d9f3427ade67ac2d27a864be6f3187', + category: AddressCategory.PCV + }, + ethToDaiLensEth: { + artifactName: 'BPTLens', + address: '0xf24401f6992faeacbc5d6c6991db15b5f8364a1b', + category: AddressCategory.PCV + }, + ethToDaiLBPPool: { + artifactName: 'IWeightedPool', + address: '0x34809aEDF93066b49F638562c42A9751eDb36DF5', + category: AddressCategory.External + }, aaveEthPCVDeposit: { artifactName: 'AavePCVDeposit', address: '0x5B86887e171bAE0C2C826e87E34Df8D558C079B9', diff --git a/test/integration/proposals_config.ts b/test/integration/proposals_config.ts index 4b0d168ad..079411230 100644 --- a/test/integration/proposals_config.ts +++ b/test/integration/proposals_config.ts @@ -7,7 +7,7 @@ import end_tribe_incentives from '@proposals/description/end_tribe_incentives'; const proposals: ProposalsConfigMap = { eth_lbp: { - deploy: true, // deploy flag for whether to run deploy action during e2e tests or use mainnet state + deploy: false, // deploy flag for whether to run deploy action during e2e tests or use mainnet state totalValue: 0, // amount of ETH to send to DAO execution proposal: eth_lbp, // full proposal file, imported from '@proposals/description/fip_xx.ts' proposalId: '', From 6a2d27c3a849aab45dd510384904846b8feb57ff Mon Sep 17 00:00:00 2001 From: Caleb Date: Tue, 7 Jun 2022 04:17:10 -0700 Subject: [PATCH 250/274] Fix eth psm --- test/integration/tests/ethPSM.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/test/integration/tests/ethPSM.ts b/test/integration/tests/ethPSM.ts index 3aba11217..17556db4b 100644 --- a/test/integration/tests/ethPSM.ts +++ b/test/integration/tests/ethPSM.ts @@ -94,7 +94,7 @@ describe('eth PSM', function () { describe('ethPSM', async () => { it('cannot sell eth to the PSM as redemptions are disabled', async () => { - await expectRevert(await ethPSM.redeem(ethPSM.address, 0, 0), 'EthPSM: Redeem paused'); + await expectRevert(ethPSM.redeem(ethPSM.address, 0, 0), 'EthPSM: Redeem paused'); }); it('can sell weth directly to the PSM as minting is active', async () => { @@ -114,7 +114,7 @@ describe('eth PSM', function () { describe('PSMRouter', async () => { it('cannot sell fei to the PSM as redemptions are disabled', async () => { await expectRevert( - await ethPSMRouter.connect(deployAddress)['redeem(address,uint256,uint256)'](ethPSM.address, 0, 0), + ethPSMRouter.connect(deployAddress)['redeem(address,uint256,uint256)'](ethPSM.address, 0, 0), 'EthPSM: Redeem paused' ); }); @@ -147,7 +147,7 @@ describe('eth PSM', function () { }); it('dripper cannot drip because it is paused', async () => { - await expectRevert(await dripper.drip(), 'Pausable: paused'); + await expectRevert(dripper.drip(), 'Pausable: paused'); }); }); From 39d2f3ac74d0a93983028c7adb4108207e01df87 Mon Sep 17 00:00:00 2001 From: Joey Santoro Date: Tue, 7 Jun 2022 04:23:20 -0700 Subject: [PATCH 251/274] description --- proposals/description/eth_lbp.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/proposals/description/eth_lbp.ts b/proposals/description/eth_lbp.ts index 2390794a7..e38289397 100644 --- a/proposals/description/eth_lbp.ts +++ b/proposals/description/eth_lbp.ts @@ -1,7 +1,7 @@ import { ProposalDescription } from '@custom-types/types'; const eth_lbp: ProposalDescription = { - title: 'FIP-110: Reinforce PCV via ETH LBP and tighter spread', + title: 'FIP-111: Reinforce PCV via ETH LBP and tighter spread', commands: [ { target: 'pcvGuardianNew', @@ -57,7 +57,10 @@ const eth_lbp: ProposalDescription = { } ], description: ` - FIP-110: Reinforce PCV via ETH LBP and tighter spread. + FIP-111: Reinforce PCV via ETH LBP and tighter spread. + + This proposal uses a balancer liquidity bootstrapping pool to sell 20k ETH for DAI over 2 days. + It also tightens the spread on the ETH psm by allowing redemptions for a 60bps fee. ` }; From b00b8da1235602839c3d81bcdc1f561112bc8dcb Mon Sep 17 00:00:00 2001 From: Caleb Date: Tue, 7 Jun 2022 04:25:55 -0700 Subject: [PATCH 252/274] Fix dao proposal test --- test/integration/tests/dao.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/integration/tests/dao.ts b/test/integration/tests/dao.ts index 4049e4720..503b46df0 100644 --- a/test/integration/tests/dao.ts +++ b/test/integration/tests/dao.ts @@ -71,7 +71,7 @@ describe('e2e-dao', function () { const calldatas = [ '0x70b0f660000000000000000000000000000000000000000000000000000000000000000a' // set voting delay 10 ]; - const description = ''; + const description: any[] = []; await hre.network.provider.request({ method: 'hardhat_impersonateAccount', From 737f2c19473c71e1a32e4c0cb69fabcec021e24c Mon Sep 17 00:00:00 2001 From: Caleb Date: Tue, 7 Jun 2022 04:26:50 -0700 Subject: [PATCH 253/274] Update block --- block.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/block.txt b/block.txt index 5abc08db3..d6c1f8268 100644 --- a/block.txt +++ b/block.txt @@ -1 +1 @@ -14908000 \ No newline at end of file +14920000 \ No newline at end of file From 502d3273ca03f4d353125c76be5f6e0c8f44d015 Mon Sep 17 00:00:00 2001 From: Caleb Date: Tue, 7 Jun 2022 04:35:47 -0700 Subject: [PATCH 254/274] update proposalsconfig' --- .../dao/{old => }/end_tribe_incentives.ts | 0 .../dao/{old => }/repay_fuse_bad_debt.ts | 0 .../{old => }/end_tribe_incentives.ts | 0 .../{old => }/repay_fuse_bad_debt.ts | 0 protocol-configuration/proposalsConfig.ts | 72 ++++++++++++++++++- 5 files changed, 71 insertions(+), 1 deletion(-) rename proposals/dao/{old => }/end_tribe_incentives.ts (100%) rename proposals/dao/{old => }/repay_fuse_bad_debt.ts (100%) rename proposals/description/{old => }/end_tribe_incentives.ts (100%) rename proposals/description/{old => }/repay_fuse_bad_debt.ts (100%) diff --git a/proposals/dao/old/end_tribe_incentives.ts b/proposals/dao/end_tribe_incentives.ts similarity index 100% rename from proposals/dao/old/end_tribe_incentives.ts rename to proposals/dao/end_tribe_incentives.ts diff --git a/proposals/dao/old/repay_fuse_bad_debt.ts b/proposals/dao/repay_fuse_bad_debt.ts similarity index 100% rename from proposals/dao/old/repay_fuse_bad_debt.ts rename to proposals/dao/repay_fuse_bad_debt.ts diff --git a/proposals/description/old/end_tribe_incentives.ts b/proposals/description/end_tribe_incentives.ts similarity index 100% rename from proposals/description/old/end_tribe_incentives.ts rename to proposals/description/end_tribe_incentives.ts diff --git a/proposals/description/old/repay_fuse_bad_debt.ts b/proposals/description/repay_fuse_bad_debt.ts similarity index 100% rename from proposals/description/old/repay_fuse_bad_debt.ts rename to proposals/description/repay_fuse_bad_debt.ts diff --git a/protocol-configuration/proposalsConfig.ts b/protocol-configuration/proposalsConfig.ts index 98ab69fc6..46e6c360c 100644 --- a/protocol-configuration/proposalsConfig.ts +++ b/protocol-configuration/proposalsConfig.ts @@ -1,5 +1,75 @@ import { ProposalCategory, ProposalsConfigMap } from '@custom-types/types'; -const proposals: ProposalsConfigMap = {}; +import repay_fuse_bad_debt from '@proposals/description/repay_fuse_bad_debt'; +import end_tribe_incentives from '@proposals/description/end_tribe_incentives'; +import fip_104b from '@proposals/description/fip_104b'; + +const proposals: ProposalsConfigMap = { + repay_fuse_bad_debt: { + deploy: false, // deploy flag for whether to run deploy action during e2e tests or use mainnet state + totalValue: 0, // amount of ETH to send to DAO execution + proposal: repay_fuse_bad_debt, // full proposal file, imported from '@proposals/description/fip_xx.ts' + proposalId: '', + affectedContractSignoff: ['core', 'fuseFixer', 'pcvGuardianNew'], + deprecatedContractSignoff: [], + category: ProposalCategory.TC + }, + end_tribe_incentives: { + deploy: false, // deploy flag for whether to run deploy action during e2e tests or use mainnet state + totalValue: 0, // amount of ETH to send to DAO execution + proposal: end_tribe_incentives, // full proposal file, imported from '@proposals/description/fip_xx.ts' + proposalId: '', + affectedContractSignoff: [ + 'core', + 'tribalChief', + 'tribalCouncilTimelock', + 'collateralizationOracle', + 'opsOptimisticTimelock' + ], + deprecatedContractSignoff: [ + 'creamDepositWrapper', + 'fei3CrvAutoRewardsDistributor', + 'd3AutoRewardsDistributor', + 'autoRewardsDistributor', + 'feiDaiAutoRewardsDistributor', + 'feiUsdcAutoRewardsDistributor', + 'stakingTokenWrapperRari', + 'stakingTokenWrapperFOXLaaS', + 'stakingTokenWrapperGROLaaS', + 'stakingTokenWrapperKYLINLaaS', + 'stakingTokenWrapperMStableLaaS', + 'stakingTokenWrapperNEARLaaS', + 'stakingTokenWrapperPoolTogetherLaaS', + 'stakingTokenWrapperUMALaaS', + 'stakingTokenWrapperSYNLaaS', + 'rewardsDistributorAdmin', + 'stwBulkHarvest', + 'stakingTokenWrapperBribeD3pool', + 'fei3CrvStakingtokenWrapper', + 'feiDaiStakingTokenWrapper', + 'feiUsdcStakingTokenWrapper', + 'stakingTokenWrapperBribe3Crvpool', + 'tribalChiefSyncV2', + 'tribalChiefSyncExtension', + 'd3StakingTokenWrapper', + 'votiumBriberD3pool' + ], + category: ProposalCategory.TC + }, + fip_104b: { + deploy: false, // deploy flag for whether to run deploy action during e2e tests or use mainnet state + totalValue: 0, // amount of ETH to send to DAO execution + proposal: fip_104b, // full proposal file, imported from '@proposals/description/fip_xx.ts' + proposalId: '', + affectedContractSignoff: [ + 'dpiToDaiLBPSwapper', + 'compoundDaiPCVDeposit', + 'tribalCouncilSafe', + 'ratioPCVControllerV2' + ], + deprecatedContractSignoff: [], + category: ProposalCategory.DAO + } +}; export default proposals; From 28af5c3b6870e684ef7ba067ae45408c363b8df0 Mon Sep 17 00:00:00 2001 From: Caleb Date: Tue, 7 Jun 2022 04:49:07 -0700 Subject: [PATCH 255/274] Convert proposalsConfigMap to templated version --- proposals/description/end_tribe_incentives.ts | 93 ++++++++++--------- proposals/description/fip_104b.ts | 16 ++-- proposals/description/repay_fuse_bad_debt.ts | 6 +- protocol-configuration/proposalsConfig.ts | 7 +- test/integration/tests/tribeIncentivesEnd.ts | 2 +- types/types.ts | 8 +- 6 files changed, 69 insertions(+), 63 deletions(-) diff --git a/proposals/description/end_tribe_incentives.ts b/proposals/description/end_tribe_incentives.ts index 67c58b23d..3dc84d236 100644 --- a/proposals/description/end_tribe_incentives.ts +++ b/proposals/description/end_tribe_incentives.ts @@ -1,6 +1,6 @@ -import { ProposalDescription } from '@custom-types/types'; +import { ProposalDescription, TemplatedProposalDescription } from '@custom-types/types'; -const end_tribe_incentives: ProposalDescription = { +const end_tribe_incentives: TemplatedProposalDescription = { title: 'TIP-109: Discontinue Tribe Incentives', commands: [ /////// TC grants itself TRIBAL_CHIEF_ADMIN_ROLE @@ -8,7 +8,10 @@ const end_tribe_incentives: ProposalDescription = { target: 'core', values: '0', method: 'grantRole(bytes32,address)', - arguments: ['0x23970cab3799b6876df4319661e6c03cc45bd59628799d92e988dd8cbdc90e31', '{tribalCouncilTimelock}'], + arguments: (addresses) => [ + '0x23970cab3799b6876df4319661e6c03cc45bd59628799d92e988dd8cbdc90e31', + addresses.tribalCouncilTimelock + ], description: 'Grant TRIBAL_CHIEF_ADMIN_ROLE to Tribal Council timelock' }, @@ -20,126 +23,126 @@ const end_tribe_incentives: ProposalDescription = { target: 'tribalChief', values: '0', method: 'set(uint256,uint120,address,bool)', - arguments: ['0', '1', '0x0000000000000000000000000000000000000000', false], + arguments: (addresses) => ['0', '1', '0x0000000000000000000000000000000000000000', false], description: 'Set Pool 0 rewards to 1 and do not overwrite or change the rewarder' }, { target: 'tribalChief', values: '0', method: 'set(uint256,uint120,address,bool)', - arguments: ['1', '0', '0x0000000000000000000000000000000000000000', false], + arguments: (addresses) => ['1', '0', '0x0000000000000000000000000000000000000000', false], description: 'Set Pool 1 rewards to 0 and do not overwrite or change the rewarder' }, { target: 'tribalChief', values: '0', method: 'set(uint256,uint120,address,bool)', - arguments: ['2', '0', '0x0000000000000000000000000000000000000000', false], + arguments: (addresses) => ['2', '0', '0x0000000000000000000000000000000000000000', false], description: 'Set Pool 2 rewards to 0 and do not overwrite or change the rewarder' }, { target: 'tribalChief', values: '0', method: 'set(uint256,uint120,address,bool)', - arguments: ['3', '0', '0x0000000000000000000000000000000000000000', false], + arguments: (addresses) => ['3', '0', '0x0000000000000000000000000000000000000000', false], description: 'Set Pool 3 rewards to 0 and do not overwrite or change the rewarder' }, { target: 'tribalChief', values: '0', method: 'set(uint256,uint120,address,bool)', - arguments: ['4', '0', '0x0000000000000000000000000000000000000000', false], + arguments: (addresses) => ['4', '0', '0x0000000000000000000000000000000000000000', false], description: 'Set Pool 4 rewards to 0 and do not overwrite or change the rewarder' }, { target: 'tribalChief', values: '0', method: 'set(uint256,uint120,address,bool)', - arguments: ['5', '0', '0x0000000000000000000000000000000000000000', false], + arguments: (addresses) => ['5', '0', '0x0000000000000000000000000000000000000000', false], description: 'Set Pool 5 rewards to 0 and do not overwrite or change the rewarder' }, { target: 'tribalChief', values: '0', method: 'set(uint256,uint120,address,bool)', - arguments: ['6', '0', '0x0000000000000000000000000000000000000000', false], + arguments: (addresses) => ['6', '0', '0x0000000000000000000000000000000000000000', false], description: 'Set Pool 6 rewards to 0 and do not overwrite or change the rewarder' }, { target: 'tribalChief', values: '0', method: 'set(uint256,uint120,address,bool)', - arguments: ['7', '0', '0x0000000000000000000000000000000000000000', false], + arguments: (addresses) => ['7', '0', '0x0000000000000000000000000000000000000000', false], description: 'Set Pool 7 rewards to 0 and do not overwrite or change the rewarder' }, { target: 'tribalChief', values: '0', method: 'set(uint256,uint120,address,bool)', - arguments: ['8', '0', '0x0000000000000000000000000000000000000000', false], + arguments: (addresses) => ['8', '0', '0x0000000000000000000000000000000000000000', false], description: 'Set Pool 8 rewards to 0 and do not overwrite or change the rewarder' }, { target: 'tribalChief', values: '0', method: 'set(uint256,uint120,address,bool)', - arguments: ['9', '0', '0x0000000000000000000000000000000000000000', false], + arguments: (addresses) => ['9', '0', '0x0000000000000000000000000000000000000000', false], description: 'Set Pool 9 rewards to 0 and do not overwrite or change the rewarder' }, { target: 'tribalChief', values: '0', method: 'set(uint256,uint120,address,bool)', - arguments: ['10', '0', '0x0000000000000000000000000000000000000000', false], + arguments: (addresses) => ['10', '0', '0x0000000000000000000000000000000000000000', false], description: 'Set Pool 10 rewards to 0 and do not overwrite or change the rewarder' }, { target: 'tribalChief', values: '0', method: 'set(uint256,uint120,address,bool)', - arguments: ['11', '0', '0x0000000000000000000000000000000000000000', false], + arguments: (addresses) => ['11', '0', '0x0000000000000000000000000000000000000000', false], description: 'Set Pool 11 rewards to 0 and do not overwrite or change the rewarder' }, { target: 'tribalChief', values: '0', method: 'set(uint256,uint120,address,bool)', - arguments: ['12', '0', '0x0000000000000000000000000000000000000000', false], + arguments: (addresses) => ['12', '0', '0x0000000000000000000000000000000000000000', false], description: 'Set Pool 12 rewards to 0 and do not overwrite or change the rewarder' }, { target: 'tribalChief', values: '0', method: 'set(uint256,uint120,address,bool)', - arguments: ['13', '0', '0x0000000000000000000000000000000000000000', false], + arguments: (addresses) => ['13', '0', '0x0000000000000000000000000000000000000000', false], description: 'Set Pool 13 rewards to 0 and do not overwrite or change the rewarder' }, { target: 'tribalChief', values: '0', method: 'set(uint256,uint120,address,bool)', - arguments: ['14', '0', '0x0000000000000000000000000000000000000000', false], + arguments: (addresses) => ['14', '0', '0x0000000000000000000000000000000000000000', false], description: 'Set Pool 14 rewards to 0 and do not overwrite or change the rewarder' }, { target: 'tribalChief', values: '0', method: 'set(uint256,uint120,address,bool)', - arguments: ['15', '0', '0x0000000000000000000000000000000000000000', false], + arguments: (addresses) => ['15', '0', '0x0000000000000000000000000000000000000000', false], description: 'Set Pool 15 rewards to 0 and do not overwrite or change the rewarder' }, { target: 'tribalChief', values: '0', method: 'set(uint256,uint120,address,bool)', - arguments: ['16', '0', '0x0000000000000000000000000000000000000000', false], + arguments: (addresses) => ['16', '0', '0x0000000000000000000000000000000000000000', false], description: 'Set Pool 16 rewards to 0 and do not overwrite or change the rewarder' }, { target: 'tribalChief', values: '0', method: 'set(uint256,uint120,address,bool)', - arguments: ['17', '0', '0x0000000000000000000000000000000000000000', false], + arguments: (addresses) => ['17', '0', '0x0000000000000000000000000000000000000000', false], description: 'Set Pool 17 rewards to 0 and do not overwrite or change the rewarder' }, @@ -148,7 +151,7 @@ const end_tribe_incentives: ProposalDescription = { target: 'tribalChief', values: '0', method: 'updateBlockReward(uint256)', - arguments: ['100000'], + arguments: (addresses) => ['100000'], description: 'Set Tribal Chief block reward effectively to zero. Setting to 100000' }, @@ -157,35 +160,35 @@ const end_tribe_incentives: ProposalDescription = { target: 'autoRewardsDistributor', values: '0', method: 'setAutoRewardsDistribution()', - arguments: [], + arguments: (addresses) => [], description: 'Sync the reward speed of the AutoRewardsDistributor' }, { target: 'd3AutoRewardsDistributor', values: '0', method: 'setAutoRewardsDistribution()', - arguments: [], + arguments: (addresses) => [], description: 'Sync the reward speed of the d3AutoRewardsDistributor' }, { target: 'fei3CrvAutoRewardsDistributor', values: '0', method: 'setAutoRewardsDistribution()', - arguments: [], + arguments: (addresses) => [], description: 'Sync the reward speed of the fei3CrvAutoRewardsDistributor' }, { target: 'feiDaiAutoRewardsDistributor', values: '0', method: 'setAutoRewardsDistribution()', - arguments: [], + arguments: (addresses) => [], description: 'Sync the reward speed of the feiDaiAutoRewardsDistributor' }, { target: 'feiUsdcAutoRewardsDistributor', values: '0', method: 'setAutoRewardsDistribution()', - arguments: [], + arguments: (addresses) => [], description: 'Sync the reward speed of the feiUsdcAutoRewardsDistributor' }, ///// Deprecate roles of Incentives system @@ -193,9 +196,9 @@ const end_tribe_incentives: ProposalDescription = { target: 'core', values: '0', method: 'revokeRole(bytes32,address)', - arguments: [ + arguments: (addresses) => [ '0x7f85477db6c0857f19179a2b3846a7ddbc64caeeb3a02ef34771b82f5ab926e4', // FUSE_ADMIN - '{tribalChiefSyncV2}' + addresses.tribalChiefSyncV2 ], description: 'Revoke FUSE_ADMIN from tribalChiefSyncV2' }, @@ -203,9 +206,9 @@ const end_tribe_incentives: ProposalDescription = { target: 'core', values: '0', method: 'revokeRole(bytes32,address)', - arguments: [ + arguments: (addresses) => [ '0x23970cab3799b6876df4319661e6c03cc45bd59628799d92e988dd8cbdc90e31', // TRIBAL_CHIEF_ADMIN_ROLE - '{tribalChiefSyncV2}' + addresses.tribalChiefSyncV2 ], description: 'Revoke TRIBAL_CHIEF_ADMIN_ROLE from tribalChiefSyncV2' }, @@ -215,7 +218,7 @@ const end_tribe_incentives: ProposalDescription = { target: 'rewardsDistributorAdmin', values: '0', method: 'becomeAdmin()', - arguments: [], + arguments: (addresses) => [], description: 'Grant the TC timelock the DEFAULT_ADMIN_ROLE, to it can dismantle the RewardDistributorAdmin permissions' }, @@ -223,9 +226,9 @@ const end_tribe_incentives: ProposalDescription = { target: 'rewardsDistributorAdmin', values: '0', method: 'revokeRole(bytes32,address)', - arguments: [ + arguments: (addresses) => [ '0x19cca239eaee0f28c6ba4c8c860332b8a23b35008b89b0507b96138ca5691cbb', // AUTO_REWARDS_DISTRIBUTOR_ROLE - '{feiDaiAutoRewardsDistributor}' + addresses.feiDaiAutoRewardsDistributor ], description: 'Revoke AUTO_REWARDS_DISTRIBUTOR_ROLE from feiDaiAutoRewardsDistributor' }, @@ -233,9 +236,9 @@ const end_tribe_incentives: ProposalDescription = { target: 'rewardsDistributorAdmin', values: '0', method: 'revokeRole(bytes32,address)', - arguments: [ + arguments: (addresses) => [ '0x19cca239eaee0f28c6ba4c8c860332b8a23b35008b89b0507b96138ca5691cbb', // AUTO_REWARDS_DISTRIBUTOR_ROLE - '{feiUsdcAutoRewardsDistributor}' + addresses.feiUsdcAutoRewardsDistributor ], description: 'Revoke AUTO_REWARDS_DISTRIBUTOR_ROLE from feiUsdcAutoRewardsDistributor' }, @@ -243,9 +246,9 @@ const end_tribe_incentives: ProposalDescription = { target: 'rewardsDistributorAdmin', values: '0', method: 'revokeRole(bytes32,address)', - arguments: [ + arguments: (addresses) => [ '0x19cca239eaee0f28c6ba4c8c860332b8a23b35008b89b0507b96138ca5691cbb', // AUTO_REWARDS_DISTRIBUTOR_ROLE - '{autoRewardsDistributor}' + addresses.autoRewardsDistributor ], description: 'Revoke AUTO_REWARDS_DISTRIBUTOR_ROLE from autoRewardsDistributor' }, @@ -253,9 +256,9 @@ const end_tribe_incentives: ProposalDescription = { target: 'rewardsDistributorAdmin', values: '0', method: 'revokeRole(bytes32,address)', - arguments: [ + arguments: (addresses) => [ '0x19cca239eaee0f28c6ba4c8c860332b8a23b35008b89b0507b96138ca5691cbb', // AUTO_REWARDS_DISTRIBUTOR_ROLE - '{d3AutoRewardsDistributor}' + addresses.d3AutoRewardsDistributor ], description: 'Revoke AUTO_REWARDS_DISTRIBUTOR_ROLE from d3AutoRewardsDistributor' }, @@ -263,9 +266,9 @@ const end_tribe_incentives: ProposalDescription = { target: 'rewardsDistributorAdmin', values: '0', method: 'revokeRole(bytes32,address)', - arguments: [ + arguments: (addresses) => [ '0x19cca239eaee0f28c6ba4c8c860332b8a23b35008b89b0507b96138ca5691cbb', // AUTO_REWARDS_DISTRIBUTOR_ROLE - '{fei3CrvAutoRewardsDistributor}' + addresses.fei3CrvAutoRewardsDistributor ], description: 'Revoke AUTO_REWARDS_DISTRIBUTOR_ROLE from fei3CrvAutoRewardsDistributor' }, @@ -275,9 +278,9 @@ const end_tribe_incentives: ProposalDescription = { target: 'core', values: '0', method: 'revokeRole(bytes32,address)', - arguments: [ + arguments: (addresses) => [ '0x2d46c62aa6fbc9b550f22e00476aebb90f4ea69cd492a68db4d444217763330d', // VOTIUM_ADMIN_ROLE - '{opsOptimisticTimelock}' + addresses.opsOptimisticTimelock ], description: 'Revoke VOTIUM_ROLE from opsOptimisticTimelock as no longer required' }, @@ -287,7 +290,7 @@ const end_tribe_incentives: ProposalDescription = { target: 'collateralizationOracle', values: '0', method: 'removeDeposit(address)', - arguments: ['{creamDepositWrapper}'], + arguments: (addresses) => [addresses.creamDepositWrapper], description: 'Remove empty CREAM deposit from the CR oracle' } ], diff --git a/proposals/description/fip_104b.ts b/proposals/description/fip_104b.ts index c7cd2fccb..40772787e 100644 --- a/proposals/description/fip_104b.ts +++ b/proposals/description/fip_104b.ts @@ -1,23 +1,23 @@ -import { ProposalDescription } from '@custom-types/types'; +import { TemplatedProposalDescription } from '@custom-types/types'; -const fip_104b: ProposalDescription = { +const fip_104b: TemplatedProposalDescription = { title: 'FIP_104b: Withdraw LBP liquidity', commands: [ { target: 'dpiToDaiLBPSwapper', values: '0', method: 'exitPool(address)', - arguments: ['{compoundDaiPCVDeposit}'], + arguments: (addresses) => [addresses.compoundDaiPCVDeposit], description: 'Withdraw all DAI and DPI from LBP pool to the compoundDAIPCVDeposit (~$3.8m)' }, { target: 'ratioPCVControllerV2', values: '0', method: 'withdrawRatioERC20(address,address,address,uint256)', - arguments: [ - '{compoundDaiPCVDeposit}', // pcvDeposit - '{dpi}', // token - '{tribalCouncilSafe}', // to + arguments: (addresses) => [ + addresses.compoundDaiPCVDeposit, // pcvDeposit + addresses.dpi, // token + addresses.tribalCouncilSafe, // to '10000' // basisPoints, 100% ], description: @@ -27,7 +27,7 @@ const fip_104b: ProposalDescription = { target: 'compoundDaiPCVDeposit', values: '0', method: 'deposit()', - arguments: [], + arguments: (addresses) => [], description: 'Deposit DAI on compoundDAIPCVdeposit into Compound' } ], diff --git a/proposals/description/repay_fuse_bad_debt.ts b/proposals/description/repay_fuse_bad_debt.ts index 68d7438b0..782f438bd 100644 --- a/proposals/description/repay_fuse_bad_debt.ts +++ b/proposals/description/repay_fuse_bad_debt.ts @@ -1,14 +1,14 @@ import { MainnetAddresses } from '@custom-types/contracts'; -import { ProposalDescription } from '@custom-types/types'; +import { ProposalDescription, TemplatedProposalDescription } from '@custom-types/types'; -const fip_x: ProposalDescription = { +const fip_x: TemplatedProposalDescription = { title: 'Repay Fuse Bad Debt', commands: [ { target: 'pcvGuardianNew', values: '0', method: 'setSafeAddress(address)', - arguments: ['{fuseFixer}'], + arguments: (addresses) => [addresses.fuseFixer], description: 'Set FuseFixer as a safe address' } ], diff --git a/protocol-configuration/proposalsConfig.ts b/protocol-configuration/proposalsConfig.ts index 46e6c360c..2ac9e96ce 100644 --- a/protocol-configuration/proposalsConfig.ts +++ b/protocol-configuration/proposalsConfig.ts @@ -1,10 +1,9 @@ -import { ProposalCategory, ProposalsConfigMap } from '@custom-types/types'; - -import repay_fuse_bad_debt from '@proposals/description/repay_fuse_bad_debt'; +import { ProposalCategory, TemplatedProposalsConfigMap } from '@custom-types/types'; import end_tribe_incentives from '@proposals/description/end_tribe_incentives'; import fip_104b from '@proposals/description/fip_104b'; +import repay_fuse_bad_debt from '@proposals/description/repay_fuse_bad_debt'; -const proposals: ProposalsConfigMap = { +const proposals: TemplatedProposalsConfigMap = { repay_fuse_bad_debt: { deploy: false, // deploy flag for whether to run deploy action during e2e tests or use mainnet state totalValue: 0, // amount of ETH to send to DAO execution diff --git a/test/integration/tests/tribeIncentivesEnd.ts b/test/integration/tests/tribeIncentivesEnd.ts index 847e33ee2..ea5c8ae74 100644 --- a/test/integration/tests/tribeIncentivesEnd.ts +++ b/test/integration/tests/tribeIncentivesEnd.ts @@ -1,5 +1,6 @@ import { TribalChief, Tribe } from '@custom-types/contracts'; import { NamedAddresses, NamedContracts } from '@custom-types/types'; +import { SignerWithAddress } from '@nomiclabs/hardhat-ethers/signers'; import proposals from '@protocol/proposalsConfig'; import { getImpersonatedSigner, resetFork, time } from '@test/helpers'; import { forceEth } from '@test/integration/setup/utils'; @@ -8,7 +9,6 @@ import CBN from 'chai-bn'; import { solidity } from 'ethereum-waffle'; import { ethers } from 'hardhat'; import { TestEndtoEndCoordinator } from '../setup'; -import { SignerWithAddress } from '@nomiclabs/hardhat-ethers/signers'; const toBN = ethers.BigNumber.from; chai.use(CBN(ethers.BigNumber)); diff --git a/types/types.ts b/types/types.ts index 4ce1afecc..84334c5c5 100644 --- a/types/types.ts +++ b/types/types.ts @@ -90,9 +90,13 @@ export interface TemplatedProposalConfig { proposalId: string; } -export type ProposalsConfigMap = { +export interface ProposalsConfigMap { [key: string]: ProposalConfig; -}; +} + +export interface TemplatedProposalsConfigMap { + [key: string]: TemplatedProposalConfig; +} export interface ProposalDescription { title: string; From eb3f2615e9a2b3a45f81676a25fdb75f2a8f9ef2 Mon Sep 17 00:00:00 2001 From: Caleb Date: Tue, 7 Jun 2022 04:54:17 -0700 Subject: [PATCH 256/274] Add prettier back in --- contracts/.prettierrc | 15 +++++++++++++++ scripts/utils/constructProposal.ts | 3 +++ scripts/utils/simulateTimelockProposal.ts | 3 +++ 3 files changed, 21 insertions(+) create mode 100644 contracts/.prettierrc diff --git a/contracts/.prettierrc b/contracts/.prettierrc new file mode 100644 index 000000000..cbf243f3d --- /dev/null +++ b/contracts/.prettierrc @@ -0,0 +1,15 @@ +{ + "overrides": [ + { + "files": "*.sol", + "options": { + "printWidth": 120, + "tabWidth": 4, + "useTabs": false, + "singleQuote": false, + "bracketSpacing": false, + "explicitTypes": "always" + } + } + ] + } \ No newline at end of file diff --git a/scripts/utils/constructProposal.ts b/scripts/utils/constructProposal.ts index 91b20702d..b87bbc491 100644 --- a/scripts/utils/constructProposal.ts +++ b/scripts/utils/constructProposal.ts @@ -89,6 +89,9 @@ export default async function constructProposal( const ethersContract = contracts[command.target as keyof MainnetContracts]; const generateArgsFunc = command.arguments; + if (typeof generateArgsFunc !== 'function') { + throw new Error(`Command ${command.target} has no arguments function (cannot use direct assignments)`); + } const args = generateArgsFunc(contractAddresses); proposalBuilder.addContractAction(ethersContract, command.method, args, command.values); diff --git a/scripts/utils/simulateTimelockProposal.ts b/scripts/utils/simulateTimelockProposal.ts index 2052083c4..3aeb9b7f4 100644 --- a/scripts/utils/simulateTimelockProposal.ts +++ b/scripts/utils/simulateTimelockProposal.ts @@ -69,6 +69,9 @@ export async function simulateTimelockProposal( values.push(command.values); const generateArgsFunc = command.arguments; + if (typeof generateArgsFunc !== 'function') { + throw new Error(`Command ${command.target} has no arguments function (cannot use direct assignments)`); + } const args = generateArgsFunc(contractAddresses); const data = ethersContract.interface.encodeFunctionData(command.method, args); From 1094f1b28c86a9badcb70f8162c43a4f096c529f Mon Sep 17 00:00:00 2001 From: Joey Santoro Date: Tue, 7 Jun 2022 05:12:50 -0700 Subject: [PATCH 257/274] checksum --- protocol-configuration/mainnetAddresses.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/protocol-configuration/mainnetAddresses.ts b/protocol-configuration/mainnetAddresses.ts index c84eadefa..0664b5f83 100644 --- a/protocol-configuration/mainnetAddresses.ts +++ b/protocol-configuration/mainnetAddresses.ts @@ -203,12 +203,12 @@ const MainnetAddresses: MainnetAddresses = { }, ethToDaiLensDai: { artifactName: 'BPTLens', - address: '0xdf9ff5c077d9f3427ade67ac2d27a864be6f3187', + address: '0xdF9Ff5c077d9F3427ade67AC2d27a864Be6F3187', category: AddressCategory.PCV }, ethToDaiLensEth: { artifactName: 'BPTLens', - address: '0xf24401f6992faeacbc5d6c6991db15b5f8364a1b', + address: '0xf24401F6992FaEAcbc5d6C6991db15B5F8364A1B', category: AddressCategory.PCV }, ethToDaiLBPPool: { From 4f2af2ca16369cc80096299f90f78339f71985ef Mon Sep 17 00:00:00 2001 From: Caleb Date: Tue, 7 Jun 2022 05:26:39 -0700 Subject: [PATCH 258/274] Fix unit tests, organize imports on unit tests --- test/helpers.ts | 6 +- test/unit/dao/governor/FeiDao.test.ts | 8 +-- .../unit/dao/timelocks/FeiDAOTimelock.test.ts | 4 +- .../dao/timelocks/OptimisticTimelock.test.ts | 6 +- test/unit/fei/Fei.test.ts | 12 ++-- test/unit/fei/minter/FeiTimedMinter.test.ts | 13 ++-- .../minter/GlobalRateLimitedMinter.test.ts | 15 ++-- .../GlobalRateLimitedMinterGovernor.test.ts | 10 +-- test/unit/fei/minter/PCVEquityMinter.test.ts | 4 +- .../unit/fei/minter/RateLimitedMinter.test.ts | 8 +-- test/unit/fuse/AutoRewardsDistributor.test.ts | 6 +- .../unit/fuse/RewardsDistributorAdmin.test.ts | 4 +- .../oracle/ChainlinkOracleWrapper.test.ts | 4 +- test/unit/oracle/CompositeOracle.test.ts | 4 +- test/unit/oracle/ConstantOracle.test.ts | 4 +- .../CollateralizationOracle.test.ts | 4 +- .../CollateralizationOracleGuardian.test.ts | 8 +-- .../CollateralizationOracleWrapper.test.ts | 4 +- test/unit/pcv/PCVGuardian.test.ts | 13 ++-- test/unit/pcv/aave/AavePCVDeposit.test.ts | 2 +- .../pcv/angle/AngleUniswapPCVDeposit.test.ts | 2 +- test/unit/pcv/balancer/BPTLens.test.ts | 4 +- .../pcv/balancer/BalancerLBPSwapper.test.ts | 12 ++-- .../BalancerPCVDepositWeightedPool.test.ts | 23 +++--- .../pcv/balancer/BalancerPool2Lens.test.ts | 12 ++-- .../compound/ERC20CompoundPCVDeposit.test.ts | 2 +- .../compound/EthCompoundPCVDeposit.test.ts | 4 +- test/unit/pcv/convex/ConvexPCVDeposit.test.ts | 22 +++--- .../curve/CurvePCVDepositPlainPool.test.ts | 14 ++-- test/unit/pcv/lido/EthLidoPCVDeposit.test.ts | 12 ++-- .../tokemak/ERC20TokemakPCVDeposit.test.ts | 20 +++--- .../pcv/tokemak/EthTokemakPCVDeposit.test.ts | 20 +++--- .../pcv/uniswap/UniswapPCVDeposit.test.ts | 14 ++-- test/unit/pcv/utils/DelayedPCVMover.test.ts | 4 +- test/unit/pcv/utils/ERC20Dripper.test.ts | 2 +- .../pcv/utils/ERC20PCVDepositWrapper.test.ts | 6 +- test/unit/pcv/utils/ERC20Splitter.test.ts | 2 +- .../NamedStaticPCVDepositWrapper.test.ts | 39 ++++------- test/unit/pcv/utils/PCVDepositWrapper.test.ts | 6 +- test/unit/pcv/utils/PCVDripController.test.ts | 8 +-- .../pcv/utils/RatioPCVControllerV2.test.ts | 24 +++---- test/unit/peg/FixedPricePSM.test.ts | 20 +++--- test/unit/peg/MintRedeemPausePSM.test.ts | 22 +++--- test/unit/peg/PSMRouter.test.ts | 16 ++--- test/unit/peg/PegStabilityModule.test.ts | 20 +++--- .../peg/PriceBoundPegStabilityModule.test.ts | 20 +++--- test/unit/peg/ReserveStabilizer.test.ts | 12 ++-- test/unit/refs/OracleRef.test.ts | 8 +-- test/unit/sentinel/PCVSentinel.test.ts | 25 +++---- test/unit/staking/TribalChiefPart1.test.ts | 70 +++++++++---------- test/unit/staking/TribalChiefPart2.test.ts | 54 +++++++------- test/unit/staking/TribalChiefPart3.test.ts | 53 +++++++------- test/unit/timelocks/QuadraticTimelock.test.ts | 43 ++++++------ .../timelocks/TimelockedDelegator.test.ts | 4 +- test/unit/tribe/TribeMinter.test.ts | 15 ++-- .../unit/tribe/TribeReserveStabilizer.test.ts | 22 +++--- 56 files changed, 384 insertions(+), 411 deletions(-) diff --git a/test/helpers.ts b/test/helpers.ts index c57638df4..7f1cd716c 100644 --- a/test/helpers.ts +++ b/test/helpers.ts @@ -176,17 +176,17 @@ async function expectApproxAbs( expect(actualBN).to.be.lte(upperBound); } -async function expectEvent(tx: Promise, contract: any, event: string, args: any[]): Promise { +async function expectEvent(tx: Promise, contract: any, event: string, args: any[]): Promise { await expect(tx) .to.emit(contract, event) .withArgs(...args); } -async function expectRevert(tx: Promise, errorMessage: string): Promise { +async function expectRevert(tx: Promise, errorMessage: string): Promise { await expect(tx).to.be.revertedWith(errorMessage); } -async function expectUnspecifiedRevert(tx: Promise): Promise { +async function expectUnspecifiedRevert(tx: Promise): Promise { await expect(tx).to.be.reverted; } diff --git a/test/unit/dao/governor/FeiDao.test.ts b/test/unit/dao/governor/FeiDao.test.ts index 6c383bfef..96b72bb13 100644 --- a/test/unit/dao/governor/FeiDao.test.ts +++ b/test/unit/dao/governor/FeiDao.test.ts @@ -1,9 +1,9 @@ -import { expectRevert, time, getCore, getAddresses } from '@test/helpers'; +import { Core, FeiDAO, Timelock } from '@custom-types/contracts'; +import { TransactionResponse } from '@ethersproject/providers'; +import { expectRevert, getAddresses, getCore, time } from '@test/helpers'; import { expect } from 'chai'; -import hre, { artifacts, ethers, network } from 'hardhat'; import { Signer } from 'ethers'; -import { TransactionResponse } from '@ethersproject/providers'; -import { Core, FeiDAO, Timelock } from '@custom-types/contracts'; +import hre, { artifacts, ethers, network } from 'hardhat'; const Tribe = artifacts.readArtifactSync('Tribe'); diff --git a/test/unit/dao/timelocks/FeiDAOTimelock.test.ts b/test/unit/dao/timelocks/FeiDAOTimelock.test.ts index 6d37497b9..2c3b9c5c1 100644 --- a/test/unit/dao/timelocks/FeiDAOTimelock.test.ts +++ b/test/unit/dao/timelocks/FeiDAOTimelock.test.ts @@ -1,8 +1,8 @@ +import { Core, FeiDAOTimelock } from '@custom-types/contracts'; +import { Signer } from '@ethersproject/abstract-signer'; import { expectRevert, getAddresses, getCore, getImpersonatedSigner, latestTime } from '@test/helpers'; import { expect } from 'chai'; import { ethers } from 'hardhat'; -import { Core, FeiDAOTimelock } from '@custom-types/contracts'; -import { Signer } from '@ethersproject/abstract-signer'; describe('FeiDAOTimelock', function () { let userAddress: string; diff --git a/test/unit/dao/timelocks/OptimisticTimelock.test.ts b/test/unit/dao/timelocks/OptimisticTimelock.test.ts index 294a93844..a23654ac2 100644 --- a/test/unit/dao/timelocks/OptimisticTimelock.test.ts +++ b/test/unit/dao/timelocks/OptimisticTimelock.test.ts @@ -1,15 +1,15 @@ import { expectRevert, getAddresses, getCore } from '@test/helpers'; import { expect } from 'chai'; -import hre, { ethers } from 'hardhat'; import { Signer } from 'ethers'; +import hre, { ethers } from 'hardhat'; const toBN = ethers.BigNumber.from; const impersonatedSigners: { [key: string]: Signer } = {}; describe('TimelockedDelegator', function () { - let userAddress; - let governorAddress; + let userAddress: string; + let governorAddress: string; before(async () => { const addresses = await getAddresses(); diff --git a/test/unit/fei/Fei.test.ts b/test/unit/fei/Fei.test.ts index 9f0c308b1..374d25510 100644 --- a/test/unit/fei/Fei.test.ts +++ b/test/unit/fei/Fei.test.ts @@ -1,15 +1,15 @@ -import { ZERO_ADDRESS, expectRevert, getAddresses, getCore } from '../../helpers'; import { expect } from 'chai'; -import hre, { ethers } from 'hardhat'; import { Signer } from 'ethers'; +import hre, { ethers } from 'hardhat'; +import { expectRevert, getAddresses, getCore, ZERO_ADDRESS } from '../../helpers'; const toBN = ethers.BigNumber.from; describe('Fei', function () { - let userAddress; - let governorAddress; - let minterAddress; - let burnerAddress; + let userAddress: string; + let governorAddress: string; + let minterAddress: string; + let burnerAddress: string; const impersonatedSigners: { [key: string]: Signer } = {}; diff --git a/test/unit/fei/minter/FeiTimedMinter.test.ts b/test/unit/fei/minter/FeiTimedMinter.test.ts index dab7b43cc..a94ed351f 100644 --- a/test/unit/fei/minter/FeiTimedMinter.test.ts +++ b/test/unit/fei/minter/FeiTimedMinter.test.ts @@ -1,18 +1,17 @@ -import { ZERO_ADDRESS, expectRevert, time, getAddresses, getCore, expectApprox } from '@test/helpers'; +import { expectApprox, expectRevert, getAddresses, getCore, time, ZERO_ADDRESS } from '@test/helpers'; import chai, { expect } from 'chai'; -import hre, { ethers } from 'hardhat'; -import { Signer } from 'ethers'; - import CBN from 'chai-bn'; +import { Signer } from 'ethers'; +import hre, { ethers } from 'hardhat'; before(() => { chai.use(CBN(ethers.BigNumber)); }); describe('FeiTimedMinter', function () { - let userAddress; - let secondUserAddress; - let governorAddress; + let userAddress: string; + let secondUserAddress: string; + let governorAddress: string; const impersonatedSigners: { [key: string]: Signer } = {}; diff --git a/test/unit/fei/minter/GlobalRateLimitedMinter.test.ts b/test/unit/fei/minter/GlobalRateLimitedMinter.test.ts index d5cee4e6a..402f2c2e0 100644 --- a/test/unit/fei/minter/GlobalRateLimitedMinter.test.ts +++ b/test/unit/fei/minter/GlobalRateLimitedMinter.test.ts @@ -1,16 +1,15 @@ +import { Core, Fei, GlobalRateLimitedMinter, MockMinter } from '@custom-types/contracts'; import { expectRevert, getAddresses, getCore, ZERO_ADDRESS } from '@test/helpers'; import { expect } from 'chai'; -import hre, { ethers } from 'hardhat'; -import { Signer, utils } from 'ethers'; -import { Core, Fei, GlobalRateLimitedMinter, MockMinter } from '@custom-types/contracts'; +import { BigNumber, Signer, utils } from 'ethers'; import { keccak256 } from 'ethers/lib/utils'; +import hre, { ethers } from 'hardhat'; -const toBN = ethers.BigNumber.from; const scale = ethers.constants.WeiPerEther; describe('GlobalRateLimitedMinterGovernor', function () { - let userAddress; - let governorAddress; + let userAddress: string; + let governorAddress: string; let globalRateLimitedMinter: GlobalRateLimitedMinter; let authorizedMinter: MockMinter; let core: Core; @@ -148,8 +147,8 @@ describe('GlobalRateLimitedMinterGovernor', function () { }); describe('Add Minter Under Caps', function () { - let rateLimitPerSecond; - let bufferCap; + let rateLimitPerSecond: BigNumber; + let bufferCap: BigNumber; beforeEach(async function () { rateLimitPerSecond = await globalRateLimitedMinter.individualMaxRateLimitPerSecond(); diff --git a/test/unit/fei/minter/GlobalRateLimitedMinterGovernor.test.ts b/test/unit/fei/minter/GlobalRateLimitedMinterGovernor.test.ts index 4ce98fa05..5a95fa1cd 100644 --- a/test/unit/fei/minter/GlobalRateLimitedMinterGovernor.test.ts +++ b/test/unit/fei/minter/GlobalRateLimitedMinterGovernor.test.ts @@ -1,14 +1,14 @@ -import { time, expectRevert, expectApprox, getAddresses, getCore } from '@test/helpers'; +import { Core, Fei, GlobalRateLimitedMinter } from '@custom-types/contracts'; +import { expectApprox, expectRevert, getAddresses, getCore, time } from '@test/helpers'; import { expect } from 'chai'; -import hre, { ethers } from 'hardhat'; import { Contract, Signer } from 'ethers'; -import { Core, Fei, GlobalRateLimitedMinter } from '@custom-types/contracts'; +import hre, { ethers } from 'hardhat'; const scale = ethers.constants.WeiPerEther; describe('GlobalRateLimitedMinterBuffer', function () { - let userAddress; - let governorAddress; + let userAddress: string; + let governorAddress: string; let globalRateLimitedMinter: GlobalRateLimitedMinter; let authorizedMinter: Contract; let core: Core; diff --git a/test/unit/fei/minter/PCVEquityMinter.test.ts b/test/unit/fei/minter/PCVEquityMinter.test.ts index 72ba2dec1..717024006 100644 --- a/test/unit/fei/minter/PCVEquityMinter.test.ts +++ b/test/unit/fei/minter/PCVEquityMinter.test.ts @@ -1,7 +1,7 @@ -import { ZERO_ADDRESS, expectRevert, time, getAddresses, getCore, expectApprox } from '@test/helpers'; +import { expectApprox, expectRevert, getAddresses, getCore, time, ZERO_ADDRESS } from '@test/helpers'; import { expect } from 'chai'; -import hre, { ethers } from 'hardhat'; import { Signer } from 'ethers'; +import hre, { ethers } from 'hardhat'; describe('PCVEquityMinter', function () { let userAddress: string; diff --git a/test/unit/fei/minter/RateLimitedMinter.test.ts b/test/unit/fei/minter/RateLimitedMinter.test.ts index 8b5888239..b17012060 100644 --- a/test/unit/fei/minter/RateLimitedMinter.test.ts +++ b/test/unit/fei/minter/RateLimitedMinter.test.ts @@ -1,13 +1,13 @@ -import { time, expectRevert, expectApprox, getAddresses, getCore } from '@test/helpers'; +import { expectApprox, expectRevert, getAddresses, getCore, time } from '@test/helpers'; import { expect } from 'chai'; -import hre, { ethers } from 'hardhat'; import { Signer } from 'ethers'; +import hre, { ethers } from 'hardhat'; const toBN = ethers.BigNumber.from; describe('RateLimitedMinter', function () { - let userAddress; - let governorAddress; + let userAddress: string; + let governorAddress: string; const impersonatedSigners: { [key: string]: Signer } = {}; diff --git a/test/unit/fuse/AutoRewardsDistributor.test.ts b/test/unit/fuse/AutoRewardsDistributor.test.ts index cc5e3e0ec..e9fc35c68 100644 --- a/test/unit/fuse/AutoRewardsDistributor.test.ts +++ b/test/unit/fuse/AutoRewardsDistributor.test.ts @@ -1,12 +1,12 @@ -import { expectRevert, getAddresses, getCore } from '../../helpers'; import { expect } from 'chai'; +import { BigNumber, Signer } from 'ethers'; import hre, { ethers } from 'hardhat'; -import { Signer, BigNumber } from 'ethers'; import { AutoRewardsDistributor } from '../../../types/contracts/AutoRewardsDistributor'; +import { Core } from '../../../types/contracts/Core'; import { MockRewardsDistributor } from '../../../types/contracts/MockRewardsDistributor'; import { MockTribalChief } from '../../../types/contracts/MockTribalChief'; -import { Core } from '../../../types/contracts/Core'; import { Tribe } from '../../../types/contracts/Tribe'; +import { expectRevert, getAddresses, getCore } from '../../helpers'; const toBN = ethers.BigNumber.from; diff --git a/test/unit/fuse/RewardsDistributorAdmin.test.ts b/test/unit/fuse/RewardsDistributorAdmin.test.ts index 3da5e4e95..004aba9e0 100644 --- a/test/unit/fuse/RewardsDistributorAdmin.test.ts +++ b/test/unit/fuse/RewardsDistributorAdmin.test.ts @@ -1,9 +1,9 @@ +import { Core, MockRewardsDistributor, RewardsDistributorAdmin } from '@custom-types/contracts'; import { expectRevert, getAddresses, getCore, ZERO_ADDRESS } from '@test/helpers'; import { expect } from 'chai'; -import hre, { ethers } from 'hardhat'; import { Signer, utils } from 'ethers'; -import { Core, RewardsDistributorAdmin, MockRewardsDistributor } from '@custom-types/contracts'; import { keccak256 } from 'ethers/lib/utils'; +import hre, { ethers } from 'hardhat'; const toBN = ethers.BigNumber.from; diff --git a/test/unit/oracle/ChainlinkOracleWrapper.test.ts b/test/unit/oracle/ChainlinkOracleWrapper.test.ts index 879b3c806..dc866cc2f 100644 --- a/test/unit/oracle/ChainlinkOracleWrapper.test.ts +++ b/test/unit/oracle/ChainlinkOracleWrapper.test.ts @@ -1,7 +1,7 @@ -import { getCore, getAddresses } from '../../helpers'; import { expect } from 'chai'; -import hre, { ethers, artifacts } from 'hardhat'; import { Signer } from 'ethers'; +import hre, { artifacts, ethers } from 'hardhat'; +import { getAddresses, getCore } from '../../helpers'; const ChainlinkOracleWrapper = artifacts.readArtifactSync('ChainlinkOracleWrapper'); const MockChainlinkOracle = artifacts.readArtifactSync('MockChainlinkOracle'); diff --git a/test/unit/oracle/CompositeOracle.test.ts b/test/unit/oracle/CompositeOracle.test.ts index b06b46fb4..f530c0d82 100644 --- a/test/unit/oracle/CompositeOracle.test.ts +++ b/test/unit/oracle/CompositeOracle.test.ts @@ -1,7 +1,7 @@ -import { expectRevert, getAddresses, getCore } from '../../helpers'; import { expect } from 'chai'; -import hre, { ethers } from 'hardhat'; import { Signer } from 'ethers'; +import hre, { ethers } from 'hardhat'; +import { expectRevert, getAddresses, getCore } from '../../helpers'; describe('CompositeOracle', function () { let governorAddress: string; diff --git a/test/unit/oracle/ConstantOracle.test.ts b/test/unit/oracle/ConstantOracle.test.ts index a974e808b..02361c8b2 100644 --- a/test/unit/oracle/ConstantOracle.test.ts +++ b/test/unit/oracle/ConstantOracle.test.ts @@ -1,7 +1,7 @@ -import { getCore, getAddresses } from '../../helpers'; import { expect } from 'chai'; -import hre, { ethers, artifacts } from 'hardhat'; import { Signer } from 'ethers'; +import hre, { artifacts, ethers } from 'hardhat'; +import { getAddresses, getCore } from '../../helpers'; const ConstantOracle = artifacts.readArtifactSync('ConstantOracle'); diff --git a/test/unit/oracle/collateralization/CollateralizationOracle.test.ts b/test/unit/oracle/collateralization/CollateralizationOracle.test.ts index 4be2cd885..79162da6c 100644 --- a/test/unit/oracle/collateralization/CollateralizationOracle.test.ts +++ b/test/unit/oracle/collateralization/CollateralizationOracle.test.ts @@ -1,7 +1,7 @@ -import { ZERO_ADDRESS, getCore, getAddresses, expectRevert, expectUnspecifiedRevert } from '../../../helpers'; import { expect } from 'chai'; -import hre, { ethers } from 'hardhat'; import { Signer } from 'ethers'; +import hre, { ethers } from 'hardhat'; +import { expectRevert, expectUnspecifiedRevert, getAddresses, getCore, ZERO_ADDRESS } from '../../../helpers'; const e18 = '000000000000000000'; diff --git a/test/unit/oracle/collateralization/CollateralizationOracleGuardian.test.ts b/test/unit/oracle/collateralization/CollateralizationOracleGuardian.test.ts index ddc49e56e..4514a0560 100644 --- a/test/unit/oracle/collateralization/CollateralizationOracleGuardian.test.ts +++ b/test/unit/oracle/collateralization/CollateralizationOracleGuardian.test.ts @@ -1,9 +1,9 @@ -import { getCore, getAddresses, expectRevert, increaseTime, getImpersonatedSigner } from '../../../helpers'; -import { expect } from 'chai'; -import { ethers } from 'hardhat'; -import { Signer } from 'ethers'; import { CollateralizationOracleWrapper, Core, MockCollateralizationOracle } from '@custom-types/contracts'; import { CollateralizationOracleGuardian } from '@custom-types/contracts/CollateralizationOracleGuardian'; +import { expect } from 'chai'; +import { Signer } from 'ethers'; +import { ethers } from 'hardhat'; +import { expectRevert, getAddresses, getCore, getImpersonatedSigner, increaseTime } from '../../../helpers'; describe('CollateralizationOracleGuardian', function () { let userAddress: string; diff --git a/test/unit/oracle/collateralization/CollateralizationOracleWrapper.test.ts b/test/unit/oracle/collateralization/CollateralizationOracleWrapper.test.ts index 33858f8ee..4e98ec61d 100644 --- a/test/unit/oracle/collateralization/CollateralizationOracleWrapper.test.ts +++ b/test/unit/oracle/collateralization/CollateralizationOracleWrapper.test.ts @@ -1,7 +1,7 @@ -import { ZERO_ADDRESS, time, getCore, getAddresses, expectRevert } from '../../../helpers'; import { expect } from 'chai'; -import hre, { ethers } from 'hardhat'; import { Signer } from 'ethers'; +import hre, { ethers } from 'hardhat'; +import { expectRevert, getAddresses, getCore, time, ZERO_ADDRESS } from '../../../helpers'; const e18 = '000000000000000000'; diff --git a/test/unit/pcv/PCVGuardian.test.ts b/test/unit/pcv/PCVGuardian.test.ts index 7dd10e845..e626ddf71 100644 --- a/test/unit/pcv/PCVGuardian.test.ts +++ b/test/unit/pcv/PCVGuardian.test.ts @@ -1,17 +1,16 @@ -import { expectRevert, getAddresses, getCore, getImpersonatedSigner } from '@test/helpers'; -import { expect } from 'chai'; -import { Signer } from 'ethers'; -import { ethers } from 'hardhat'; import { Core, + MockERC20, MockERC20__factory, MockPCVDepositV2__factory, PCVDeposit, - PCVGuardian, - MockERC20 + PCVGuardian } from '@custom-types/contracts'; -import chai from 'chai'; +import { expectRevert, getAddresses, getCore, getImpersonatedSigner } from '@test/helpers'; import { forceEth } from '@test/integration/setup/utils'; +import chai, { expect } from 'chai'; +import { Signer } from 'ethers'; +import { ethers } from 'hardhat'; // This will theoretically make the error stack actually print! chai.config.includeStack = true; diff --git a/test/unit/pcv/aave/AavePCVDeposit.test.ts b/test/unit/pcv/aave/AavePCVDeposit.test.ts index afdc9ff2b..10cc49a00 100644 --- a/test/unit/pcv/aave/AavePCVDeposit.test.ts +++ b/test/unit/pcv/aave/AavePCVDeposit.test.ts @@ -1,7 +1,7 @@ import { expectRevert, getAddresses, getCore } from '@test/helpers'; import { expect } from 'chai'; -import hre, { ethers } from 'hardhat'; import { Signer } from 'ethers'; +import hre, { ethers } from 'hardhat'; const toBN = ethers.BigNumber.from; diff --git a/test/unit/pcv/angle/AngleUniswapPCVDeposit.test.ts b/test/unit/pcv/angle/AngleUniswapPCVDeposit.test.ts index 8fa52c791..0321f7d0d 100644 --- a/test/unit/pcv/angle/AngleUniswapPCVDeposit.test.ts +++ b/test/unit/pcv/angle/AngleUniswapPCVDeposit.test.ts @@ -1,4 +1,4 @@ -import { expectRevert, expectApprox, getAddresses, getCore, getImpersonatedSigner } from '@test/helpers'; +import { expectApprox, expectRevert, getAddresses, getCore, getImpersonatedSigner } from '@test/helpers'; import { expect } from 'chai'; import { ethers } from 'hardhat'; diff --git a/test/unit/pcv/balancer/BPTLens.test.ts b/test/unit/pcv/balancer/BPTLens.test.ts index c97e1e617..c5648bf44 100644 --- a/test/unit/pcv/balancer/BPTLens.test.ts +++ b/test/unit/pcv/balancer/BPTLens.test.ts @@ -1,9 +1,9 @@ +import { BPTLens, MockERC20, MockOracle, MockVault, MockWeightedPool } from '@custom-types/contracts'; import { getAddresses, getImpersonatedSigner } from '@test/helpers'; import chai, { expect } from 'chai'; import CBN from 'chai-bn'; -import { ethers } from 'hardhat'; import { Signer } from 'ethers'; -import { BPTLens, MockERC20, MockOracle, MockVault, MockWeightedPool } from '@custom-types/contracts'; +import { ethers } from 'hardhat'; before(async () => { chai.use(CBN(ethers.BigNumber)); diff --git a/test/unit/pcv/balancer/BalancerLBPSwapper.test.ts b/test/unit/pcv/balancer/BalancerLBPSwapper.test.ts index c7990e1a3..b4aceda88 100644 --- a/test/unit/pcv/balancer/BalancerLBPSwapper.test.ts +++ b/test/unit/pcv/balancer/BalancerLBPSwapper.test.ts @@ -1,18 +1,18 @@ +import { BalancerLBPSwapper, Core, Fei, Tribe } from '@custom-types/contracts'; +import { MockVault } from '@custom-types/contracts/MockVault'; +import { MockWeightedPool } from '@custom-types/contracts/MockWeightedPool'; import { expectRevert, getAddresses, getCore, getImpersonatedSigner, increaseTime, - ZERO_ADDRESS, - latestTime + latestTime, + ZERO_ADDRESS } from '@test/helpers'; import { expect } from 'chai'; -import { ethers } from 'hardhat'; import { Signer } from 'ethers'; -import { BalancerLBPSwapper, Core, Fei, Tribe } from '@custom-types/contracts'; -import { MockVault } from '@custom-types/contracts/MockVault'; -import { MockWeightedPool } from '@custom-types/contracts/MockWeightedPool'; +import { ethers } from 'hardhat'; const toBN = ethers.BigNumber.from; diff --git a/test/unit/pcv/balancer/BalancerPCVDepositWeightedPool.test.ts b/test/unit/pcv/balancer/BalancerPCVDepositWeightedPool.test.ts index 608353182..b3fce0d2b 100644 --- a/test/unit/pcv/balancer/BalancerPCVDepositWeightedPool.test.ts +++ b/test/unit/pcv/balancer/BalancerPCVDepositWeightedPool.test.ts @@ -1,24 +1,23 @@ -import { getImpersonatedSigner, balance, getAddresses, getCore } from '@test/helpers'; -import chai, { expect } from 'chai'; -import CBN from 'chai-bn'; -import { ethers } from 'hardhat'; import { + BalancerPCVDepositWeightedPool, + BalancerPCVDepositWeightedPool__factory, + Core, Fei, MockERC20, MockERC20__factory, + MockMerkleOrchard, + MockMerkleOrchard__factory, MockOracle, MockOracle__factory, - MockWeth, - MockWeth__factory, MockVault, MockVault__factory, - MockMerkleOrchard, - MockMerkleOrchard__factory, - BalancerPCVDepositWeightedPool, - BalancerPCVDepositWeightedPool__factory, - Core + MockWeth, + MockWeth__factory } from '@custom-types/contracts'; -import { expectApproxAbs } from '@test/helpers'; +import { expectApproxAbs, getAddresses, getCore, getImpersonatedSigner } from '@test/helpers'; +import chai, { expect } from 'chai'; +import CBN from 'chai-bn'; +import { ethers } from 'hardhat'; chai.config.includeStack = true; const toBN = ethers.BigNumber.from; diff --git a/test/unit/pcv/balancer/BalancerPool2Lens.test.ts b/test/unit/pcv/balancer/BalancerPool2Lens.test.ts index b65261f4c..065963ccc 100644 --- a/test/unit/pcv/balancer/BalancerPool2Lens.test.ts +++ b/test/unit/pcv/balancer/BalancerPool2Lens.test.ts @@ -1,16 +1,16 @@ -import { getAddresses, getImpersonatedSigner, getCore, expectApproxAbs } from '@test/helpers'; -import chai, { expect } from 'chai'; -import CBN from 'chai-bn'; -import { ethers } from 'hardhat'; -import { Signer } from 'ethers'; import { BalancerPool2Lens, MockERC20, MockOracle, - MockVault, MockPCVDepositV2, + MockVault, MockWeightedPool } from '@custom-types/contracts'; +import { expectApproxAbs, getAddresses, getCore, getImpersonatedSigner } from '@test/helpers'; +import chai, { expect } from 'chai'; +import CBN from 'chai-bn'; +import { Signer } from 'ethers'; +import { ethers } from 'hardhat'; before(async () => { chai.use(CBN(ethers.BigNumber)); diff --git a/test/unit/pcv/compound/ERC20CompoundPCVDeposit.test.ts b/test/unit/pcv/compound/ERC20CompoundPCVDeposit.test.ts index 9bf297275..269c51742 100644 --- a/test/unit/pcv/compound/ERC20CompoundPCVDeposit.test.ts +++ b/test/unit/pcv/compound/ERC20CompoundPCVDeposit.test.ts @@ -1,7 +1,7 @@ import { expectRevert, getAddresses, getCore } from '@test/helpers'; import { expect } from 'chai'; -import hre, { ethers } from 'hardhat'; import { Signer } from 'ethers'; +import hre, { ethers } from 'hardhat'; const toBN = ethers.BigNumber.from; diff --git a/test/unit/pcv/compound/EthCompoundPCVDeposit.test.ts b/test/unit/pcv/compound/EthCompoundPCVDeposit.test.ts index 827565d35..d2546ba89 100644 --- a/test/unit/pcv/compound/EthCompoundPCVDeposit.test.ts +++ b/test/unit/pcv/compound/EthCompoundPCVDeposit.test.ts @@ -1,7 +1,7 @@ -import { expectRevert, balance, getAddresses, getCore } from '@test/helpers'; +import { balance, expectRevert, getAddresses, getCore } from '@test/helpers'; import { expect } from 'chai'; -import hre, { ethers } from 'hardhat'; import { Signer } from 'ethers'; +import hre, { ethers } from 'hardhat'; const toBN = ethers.BigNumber.from; diff --git a/test/unit/pcv/convex/ConvexPCVDeposit.test.ts b/test/unit/pcv/convex/ConvexPCVDeposit.test.ts index ea35a0f61..4ec0efd4d 100644 --- a/test/unit/pcv/convex/ConvexPCVDeposit.test.ts +++ b/test/unit/pcv/convex/ConvexPCVDeposit.test.ts @@ -1,20 +1,20 @@ -import { getImpersonatedSigner, getAddresses, getCore } from '@test/helpers'; -import chai, { expect } from 'chai'; -import { ethers } from 'hardhat'; import { + ConvexPCVDeposit, + ConvexPCVDeposit__factory, Core, Fei, - MockERC20, - MockERC20__factory, - MockCurve3pool, - MockCurve3pool__factory, - MockConvexBooster, - MockConvexBooster__factory, MockConvexBaseRewardPool, MockConvexBaseRewardPool__factory, - ConvexPCVDeposit, - ConvexPCVDeposit__factory + MockConvexBooster, + MockConvexBooster__factory, + MockCurve3pool, + MockCurve3pool__factory, + MockERC20, + MockERC20__factory } from '@custom-types/contracts'; +import { getAddresses, getCore, getImpersonatedSigner } from '@test/helpers'; +import chai, { expect } from 'chai'; +import { ethers } from 'hardhat'; chai.config.includeStack = true; diff --git a/test/unit/pcv/curve/CurvePCVDepositPlainPool.test.ts b/test/unit/pcv/curve/CurvePCVDepositPlainPool.test.ts index da4e04c9f..ab6b85ca4 100644 --- a/test/unit/pcv/curve/CurvePCVDepositPlainPool.test.ts +++ b/test/unit/pcv/curve/CurvePCVDepositPlainPool.test.ts @@ -1,16 +1,16 @@ -import { getImpersonatedSigner, getAddresses, getCore } from '@test/helpers'; -import chai, { expect } from 'chai'; -import { ethers } from 'hardhat'; import { Core, + CurvePCVDepositPlainPool, + CurvePCVDepositPlainPool__factory, Fei, - MockERC20, - MockERC20__factory, MockCurve3pool, MockCurve3pool__factory, - CurvePCVDepositPlainPool, - CurvePCVDepositPlainPool__factory + MockERC20, + MockERC20__factory } from '@custom-types/contracts'; +import { getAddresses, getCore, getImpersonatedSigner } from '@test/helpers'; +import chai, { expect } from 'chai'; +import { ethers } from 'hardhat'; chai.config.includeStack = true; diff --git a/test/unit/pcv/lido/EthLidoPCVDeposit.test.ts b/test/unit/pcv/lido/EthLidoPCVDeposit.test.ts index d203353ed..adc6a2a6f 100644 --- a/test/unit/pcv/lido/EthLidoPCVDeposit.test.ts +++ b/test/unit/pcv/lido/EthLidoPCVDeposit.test.ts @@ -1,18 +1,18 @@ import { expectRevert, getAddresses, getCore } from '@test/helpers'; +import { forceSpecificEth } from '@test/integration/setup/utils'; import { expect } from 'chai'; -import hre, { ethers } from 'hardhat'; import { Signer } from 'ethers'; -import { forceSpecificEth } from '@test/integration/setup/utils'; +import hre, { ethers } from 'hardhat'; const e18 = '000000000000000000'; const toBN = ethers.BigNumber.from; describe('EthLidoPCVDeposit', function () { - let userAddress; - let secondUserAddress; - let governorAddress; - let pcvControllerAddress; + let userAddress: string; + let secondUserAddress: string; + let governorAddress: string; + let pcvControllerAddress: string; const impersonatedSigners: { [key: string]: Signer } = {}; diff --git a/test/unit/pcv/tokemak/ERC20TokemakPCVDeposit.test.ts b/test/unit/pcv/tokemak/ERC20TokemakPCVDeposit.test.ts index e2f68d0ec..e5a09dd7e 100644 --- a/test/unit/pcv/tokemak/ERC20TokemakPCVDeposit.test.ts +++ b/test/unit/pcv/tokemak/ERC20TokemakPCVDeposit.test.ts @@ -1,20 +1,18 @@ -import { getImpersonatedSigner, balance, getAddresses, getCore } from '@test/helpers'; -import chai, { expect } from 'chai'; -import hre, { ethers } from 'hardhat'; -import { Signer } from 'ethers'; import { + Core, + ERC20TokemakPCVDeposit, + ERC20TokemakPCVDeposit__factory, MockERC20, MockERC20__factory, - MockWeth, - MockWeth__factory, MockTokemakERC20Pool, MockTokemakERC20Pool__factory, MockTokemakRewards, - MockTokemakRewards__factory, - ERC20TokemakPCVDeposit, - ERC20TokemakPCVDeposit__factory, - Core + MockTokemakRewards__factory } from '@custom-types/contracts'; +import { balance, getAddresses, getCore, getImpersonatedSigner } from '@test/helpers'; +import chai, { expect } from 'chai'; +import { BigNumber } from 'ethers'; +import { ethers } from 'hardhat'; chai.config.includeStack = true; const toBN = ethers.BigNumber.from; @@ -31,7 +29,7 @@ describe('ERC20TokemakPCVDeposit', function () { let pcvControllerAddress: string; let governorAddress: string; - let depositAmount; + let depositAmount: BigNumber; before(async () => { const addresses = await getAddresses(); diff --git a/test/unit/pcv/tokemak/EthTokemakPCVDeposit.test.ts b/test/unit/pcv/tokemak/EthTokemakPCVDeposit.test.ts index 4c859a1df..e595ce22e 100644 --- a/test/unit/pcv/tokemak/EthTokemakPCVDeposit.test.ts +++ b/test/unit/pcv/tokemak/EthTokemakPCVDeposit.test.ts @@ -1,20 +1,20 @@ -import { getImpersonatedSigner, balance, getAddresses, getCore } from '@test/helpers'; -import chai, { expect } from 'chai'; -import hre, { ethers } from 'hardhat'; -import { Signer } from 'ethers'; import { + Core, + EthTokemakPCVDeposit, + EthTokemakPCVDeposit__factory, MockERC20, MockERC20__factory, - MockWeth, - MockWeth__factory, MockTokemakEthPool, MockTokemakEthPool__factory, MockTokemakRewards, MockTokemakRewards__factory, - EthTokemakPCVDeposit, - EthTokemakPCVDeposit__factory, - Core + MockWeth, + MockWeth__factory } from '@custom-types/contracts'; +import { balance, getAddresses, getCore, getImpersonatedSigner } from '@test/helpers'; +import chai, { expect } from 'chai'; +import { BigNumber } from 'ethers'; +import { ethers } from 'hardhat'; chai.config.includeStack = true; const toBN = ethers.BigNumber.from; @@ -31,7 +31,7 @@ describe('EthTokemakPCVDeposit', function () { let pcvControllerAddress: string; let governorAddress: string; - let depositAmount; + let depositAmount: BigNumber; before(async () => { const addresses = await getAddresses(); diff --git a/test/unit/pcv/uniswap/UniswapPCVDeposit.test.ts b/test/unit/pcv/uniswap/UniswapPCVDeposit.test.ts index e74486578..3dfabc3c5 100644 --- a/test/unit/pcv/uniswap/UniswapPCVDeposit.test.ts +++ b/test/unit/pcv/uniswap/UniswapPCVDeposit.test.ts @@ -1,17 +1,17 @@ -import { expectRevert, expectApprox, getAddresses, getCore } from '@test/helpers'; +import { expectApprox, expectRevert, getAddresses, getCore } from '@test/helpers'; import { expect } from 'chai'; -import hre, { ethers } from 'hardhat'; import { Signer } from 'ethers'; +import hre, { ethers } from 'hardhat'; const toBN = ethers.BigNumber.from; describe('EthUniswapPCVDeposit', function () { const LIQUIDITY_INCREMENT = 10000; // amount of liquidity created by mock for each deposit - let userAddress; - let governorAddress; - let minterAddress; - let beneficiaryAddress1; - let pcvControllerAddress; + let userAddress: string; + let governorAddress: string; + let minterAddress: string; + let beneficiaryAddress1: string; + let pcvControllerAddress: string; const impersonatedSigners: { [key: string]: Signer } = {}; diff --git a/test/unit/pcv/utils/DelayedPCVMover.test.ts b/test/unit/pcv/utils/DelayedPCVMover.test.ts index 10e8ebc26..056481faf 100644 --- a/test/unit/pcv/utils/DelayedPCVMover.test.ts +++ b/test/unit/pcv/utils/DelayedPCVMover.test.ts @@ -1,6 +1,6 @@ -import { Core, DelayedPCVMover, RatioPCVControllerV2, MockERC20, MockPCVDepositV2 } from '@custom-types/contracts'; +import { Core, DelayedPCVMover, MockERC20, MockPCVDepositV2, RatioPCVControllerV2 } from '@custom-types/contracts'; import { NamedAddresses } from '@custom-types/types'; -import { getCore, getAddresses, expectRevert, time, getImpersonatedSigner } from '@test/helpers'; +import { expectRevert, getAddresses, getCore, getImpersonatedSigner } from '@test/helpers'; import { expect } from 'chai'; import { ethers } from 'hardhat'; diff --git a/test/unit/pcv/utils/ERC20Dripper.test.ts b/test/unit/pcv/utils/ERC20Dripper.test.ts index aff7560e0..a9ad68fc3 100644 --- a/test/unit/pcv/utils/ERC20Dripper.test.ts +++ b/test/unit/pcv/utils/ERC20Dripper.test.ts @@ -1,4 +1,4 @@ -import { time, getCore, expectRevert, getAddresses, getImpersonatedSigner } from '@test/helpers'; +import { expectRevert, getAddresses, getCore, getImpersonatedSigner, time } from '@test/helpers'; import { expect } from 'chai'; import hre, { artifacts, ethers } from 'hardhat'; diff --git a/test/unit/pcv/utils/ERC20PCVDepositWrapper.test.ts b/test/unit/pcv/utils/ERC20PCVDepositWrapper.test.ts index cc83eb310..e01f522f5 100644 --- a/test/unit/pcv/utils/ERC20PCVDepositWrapper.test.ts +++ b/test/unit/pcv/utils/ERC20PCVDepositWrapper.test.ts @@ -1,13 +1,13 @@ import { getAddresses } from '@test/helpers'; import { expect } from 'chai'; +import { Contract, Signer } from 'ethers'; import hre, { ethers } from 'hardhat'; -import { Signer } from 'ethers'; describe('ERC20PCVDepositWrapper', function () { const impersonatedSigners: { [key: string]: Signer } = {}; - let userAddress; - let token; + let userAddress: string; + let token: Contract; const balance = '2000'; diff --git a/test/unit/pcv/utils/ERC20Splitter.test.ts b/test/unit/pcv/utils/ERC20Splitter.test.ts index 3948339cb..36791d9eb 100644 --- a/test/unit/pcv/utils/ERC20Splitter.test.ts +++ b/test/unit/pcv/utils/ERC20Splitter.test.ts @@ -1,7 +1,7 @@ import { expectRevert, getAddresses, getCore } from '@test/helpers'; import { expect } from 'chai'; -import hre, { ethers } from 'hardhat'; import { Signer } from 'ethers'; +import hre, { ethers } from 'hardhat'; describe('ERC20Splitter', function () { let userAddress: string; diff --git a/test/unit/pcv/utils/NamedStaticPCVDepositWrapper.test.ts b/test/unit/pcv/utils/NamedStaticPCVDepositWrapper.test.ts index a6e10a05c..3c1c321cb 100644 --- a/test/unit/pcv/utils/NamedStaticPCVDepositWrapper.test.ts +++ b/test/unit/pcv/utils/NamedStaticPCVDepositWrapper.test.ts @@ -1,8 +1,8 @@ -import { getCore, getAddresses, expectRevert, expectEvent, getImpersonatedSigner } from '@test/helpers'; +import { Core, NamedStaticPCVDepositWrapper } from '@custom-types/contracts'; +import { expectEvent, expectRevert, getAddresses, getCore, getImpersonatedSigner } from '@test/helpers'; import { expect } from 'chai'; -import hre, { ethers } from 'hardhat'; import { Signer } from 'ethers'; -import { Core, Fei, NamedStaticPCVDepositWrapper } from '@custom-types/contracts'; +import { ethers } from 'hardhat'; const toBN = ethers.BigNumber.from; describe('NamedStaticPCVDepositWrapper', function () { @@ -106,7 +106,7 @@ describe('NamedStaticPCVDepositWrapper', function () { const startingFeiBalance = await deposit.feiReportBalance(); expectEvent( - await deposit.connect(impersonatedSigners[governorAddress]).addDeposit({ + deposit.connect(impersonatedSigners[governorAddress]).addDeposit({ usdAmount: balance, feiAmount: feiBalance, underlyingTokenAmount: 1000, @@ -160,7 +160,7 @@ describe('NamedStaticPCVDepositWrapper', function () { const startingNumDeposits = await deposit.numDeposits(); expectEvent( - await deposit.connect(impersonatedSigners[governorAddress]).bulkAddDeposits([ + deposit.connect(impersonatedSigners[governorAddress]).bulkAddDeposits([ { usdAmount: balance, feiAmount: feiBalance, @@ -230,7 +230,7 @@ describe('NamedStaticPCVDepositWrapper', function () { balance = '100'; expectEvent( - await deposit + deposit .connect(impersonatedSigners[governorAddress]) .editDeposit(0, balance, feiBalance, newUnderlyingAmt, 'Visor Finance USDC/FEI Deposit', await core.fei()), deposit, @@ -303,12 +303,9 @@ describe('NamedStaticPCVDepositWrapper', function () { it('successfully removes existing deposit when governor calls removeDeposit', async function () { const startingNumDeposits = await deposit.numDeposits(); for (let i = 0; i < parseInt(startingNumDeposits.toString()); i++) { - expectEvent( - await deposit.connect(impersonatedSigners[governorAddress]).removeDeposit(0), - deposit, - 'DepositRemoved', - [0] - ); + expectEvent(deposit.connect(impersonatedSigners[governorAddress]).removeDeposit(0), deposit, 'DepositRemoved', [ + 0 + ]); } const endingBalance = await deposit.balance(); @@ -323,12 +320,9 @@ describe('NamedStaticPCVDepositWrapper', function () { it('successfully removes existing deposit when guardian calls removeDeposit', async function () { const startingNumDeposits = await deposit.numDeposits(); for (let i = 0; i < parseInt(startingNumDeposits.toString()); i++) { - expectEvent( - await deposit.connect(impersonatedSigners[guardianAddress]).removeDeposit(0), - deposit, - 'DepositRemoved', - [0] - ); + expectEvent(deposit.connect(impersonatedSigners[guardianAddress]).removeDeposit(0), deposit, 'DepositRemoved', [ + 0 + ]); } const [endingBalance, endingFeiBalance] = await deposit.resistantBalanceAndFei(); @@ -342,12 +336,9 @@ describe('NamedStaticPCVDepositWrapper', function () { it('successfully removes existing deposit when governor calls removeDeposit', async function () { const startingNumDeposits = await deposit.numDeposits(); for (let i = 0; i < parseInt(startingNumDeposits.toString()); i++) { - expectEvent( - await deposit.connect(impersonatedSigners[governorAddress]).removeDeposit(0), - deposit, - 'DepositRemoved', - [0] - ); + expectEvent(deposit.connect(impersonatedSigners[governorAddress]).removeDeposit(0), deposit, 'DepositRemoved', [ + 0 + ]); } const [endingBalance, endingFeiBalance] = await deposit.resistantBalanceAndFei(); diff --git a/test/unit/pcv/utils/PCVDepositWrapper.test.ts b/test/unit/pcv/utils/PCVDepositWrapper.test.ts index 52919b4ac..905633132 100644 --- a/test/unit/pcv/utils/PCVDepositWrapper.test.ts +++ b/test/unit/pcv/utils/PCVDepositWrapper.test.ts @@ -1,8 +1,8 @@ -import { getCore, getAddresses } from '@test/helpers'; +import { Core, MockERC20, MockPCVDepositV2 } from '@custom-types/contracts'; +import { getAddresses, getCore } from '@test/helpers'; import { expect } from 'chai'; -import hre, { ethers } from 'hardhat'; import { Signer } from 'ethers'; -import { Core, MockERC20, MockPCVDepositV2 } from '@custom-types/contracts'; +import hre, { ethers } from 'hardhat'; describe('PCVDepositWrapper', function () { const impersonatedSigners: { [key: string]: Signer } = {}; diff --git a/test/unit/pcv/utils/PCVDripController.test.ts b/test/unit/pcv/utils/PCVDripController.test.ts index 16354cf2f..cfcb28cca 100644 --- a/test/unit/pcv/utils/PCVDripController.test.ts +++ b/test/unit/pcv/utils/PCVDripController.test.ts @@ -1,13 +1,13 @@ -import { expectRevert, time, balance, getAddresses, getCore } from '@test/helpers'; +import { balance, expectRevert, getAddresses, getCore, time } from '@test/helpers'; import { expect } from 'chai'; -import hre, { ethers } from 'hardhat'; import { Signer } from 'ethers'; +import hre, { ethers } from 'hardhat'; const toBN = ethers.BigNumber.from; describe('PCVDripController', function () { - let userAddress; - let governorAddress; + let userAddress: string; + let governorAddress: string; let beneficiaryAddress1; const impersonatedSigners: { [key: string]: Signer } = {}; diff --git a/test/unit/pcv/utils/RatioPCVControllerV2.test.ts b/test/unit/pcv/utils/RatioPCVControllerV2.test.ts index 532eaa78f..b6ca8ca52 100644 --- a/test/unit/pcv/utils/RatioPCVControllerV2.test.ts +++ b/test/unit/pcv/utils/RatioPCVControllerV2.test.ts @@ -1,23 +1,23 @@ import { - expectRevert, + Core, + MockERC20, + MockEthUniswapPCVDeposit, + MockPCVDepositV2, + RatioPCVControllerV2, + WETH9 +} from '@custom-types/contracts'; +import { balance, + deployDevelopmentWeth, + expectRevert, getAddresses, getCore, - getImpersonatedSigner, - deployDevelopmentWeth + getImpersonatedSigner } from '@test/helpers'; import { forceEth } from '@test/integration/setup/utils'; import { expect } from 'chai'; -import { ethers } from 'hardhat'; import { BigNumber, Signer } from 'ethers'; -import { - MockEthUniswapPCVDeposit, - MockPCVDepositV2, - WETH9, - Core, - RatioPCVControllerV2, - MockERC20 -} from '@custom-types/contracts'; +import { ethers } from 'hardhat'; const toBN = ethers.BigNumber.from; diff --git a/test/unit/peg/FixedPricePSM.test.ts b/test/unit/peg/FixedPricePSM.test.ts index 0a8ecdfc6..78632b8de 100644 --- a/test/unit/peg/FixedPricePSM.test.ts +++ b/test/unit/peg/FixedPricePSM.test.ts @@ -1,25 +1,25 @@ -import hre, { ethers } from 'hardhat'; +import { Core, Fei, FixedPricePSM, MockERC20, MockOracle, MockPCVDepositV2 } from '@custom-types/contracts'; import { + deployDevelopmentWeth, expectRevert, getAddresses, getCore, - deployDevelopmentWeth, - ZERO_ADDRESS, - getImpersonatedSigner + getImpersonatedSigner, + ZERO_ADDRESS } from '@test/helpers'; import { expect } from 'chai'; import { Signer, utils } from 'ethers'; -import { Core, MockERC20, Fei, MockOracle, MockPCVDepositV2, FixedPricePSM } from '@custom-types/contracts'; import { keccak256 } from 'ethers/lib/utils'; +import hre, { ethers } from 'hardhat'; const toBN = ethers.BigNumber.from; describe('FixedPricePSM', function () { - let userAddress; - let governorAddress; - let minterAddress; - let pcvControllerAddress; - let psmAdminAddress; + let userAddress: string; + let governorAddress: string; + let minterAddress: string; + let pcvControllerAddress: string; + let psmAdminAddress: string; const mintFeeBasisPoints = 0; const redeemFeeBasisPoints = 30; diff --git a/test/unit/peg/MintRedeemPausePSM.test.ts b/test/unit/peg/MintRedeemPausePSM.test.ts index 63626edf6..132aaa2cc 100644 --- a/test/unit/peg/MintRedeemPausePSM.test.ts +++ b/test/unit/peg/MintRedeemPausePSM.test.ts @@ -1,26 +1,26 @@ -import hre, { ethers } from 'hardhat'; +import { Core, Fei, MockOracle, MockPCVDepositV2, PegStabilityModule, WETH9 } from '@custom-types/contracts'; import { + deployDevelopmentWeth, expectRevert, getAddresses, getCore, - deployDevelopmentWeth, - ZERO_ADDRESS, - getImpersonatedSigner + getImpersonatedSigner, + ZERO_ADDRESS } from '@test/helpers'; import { expect } from 'chai'; import { Signer, utils } from 'ethers'; -import { Core, Fei, MockOracle, MockPCVDepositV2, WETH9, PegStabilityModule } from '@custom-types/contracts'; import { keccak256 } from 'ethers/lib/utils'; +import hre, { ethers } from 'hardhat'; const toBN = ethers.BigNumber.from; describe('PegStabilityModule', function () { - let userAddress; - let governorAddress; - let minterAddress; - let pcvControllerAddress; - let psmAdminAddress; - let guardianAddress; + let userAddress: string; + let governorAddress: string; + let minterAddress: string; + let pcvControllerAddress: string; + let psmAdminAddress: string; + let guardianAddress: string; const mintFeeBasisPoints = 30; const redeemFeeBasisPoints = 30; diff --git a/test/unit/peg/PSMRouter.test.ts b/test/unit/peg/PSMRouter.test.ts index 07ba8b938..7636b8982 100644 --- a/test/unit/peg/PSMRouter.test.ts +++ b/test/unit/peg/PSMRouter.test.ts @@ -1,24 +1,24 @@ -import hre, { ethers } from 'hardhat'; +import { Core, Fei, MockOracle, MockPCVDepositV2, PegStabilityModule, PSMRouter, WETH9 } from '@custom-types/contracts'; import { + deployDevelopmentWeth, + expectRevert, getAddresses, getCore, - deployDevelopmentWeth, getImpersonatedSigner, - MAX_UINT256, - expectRevert + MAX_UINT256 } from '@test/helpers'; import { expect } from 'chai'; import { Signer, utils } from 'ethers'; -import { Core, Fei, MockOracle, MockPCVDepositV2, PegStabilityModule, PSMRouter, WETH9 } from '@custom-types/contracts'; import { keccak256 } from 'ethers/lib/utils'; +import hre, { ethers } from 'hardhat'; const toBN = ethers.BigNumber.from; describe('PSM Router', function () { - let userAddress; - let minterAddress; + let userAddress: string; + let minterAddress: string; let psmAdminAddress; - let receiver; + let receiver: string; const mintFeeBasisPoints = 30; const redeemFeeBasisPoints = 30; diff --git a/test/unit/peg/PegStabilityModule.test.ts b/test/unit/peg/PegStabilityModule.test.ts index d905fa1d9..fc353e1bc 100644 --- a/test/unit/peg/PegStabilityModule.test.ts +++ b/test/unit/peg/PegStabilityModule.test.ts @@ -1,25 +1,25 @@ -import hre, { ethers } from 'hardhat'; +import { Core, Fei, MockOracle, MockPCVDepositV2, PegStabilityModule, WETH9 } from '@custom-types/contracts'; import { + deployDevelopmentWeth, expectRevert, getAddresses, getCore, - deployDevelopmentWeth, - ZERO_ADDRESS, - getImpersonatedSigner + getImpersonatedSigner, + ZERO_ADDRESS } from '@test/helpers'; import { expect } from 'chai'; import { Signer, utils } from 'ethers'; -import { Core, Fei, MockOracle, PegStabilityModule, MockPCVDepositV2, WETH9 } from '@custom-types/contracts'; import { keccak256 } from 'ethers/lib/utils'; +import hre, { ethers } from 'hardhat'; const toBN = ethers.BigNumber.from; describe('PegStabilityModule', function () { - let userAddress; - let governorAddress; - let minterAddress; - let pcvControllerAddress; - let psmAdminAddress; + let userAddress: string; + let governorAddress: string; + let minterAddress: string; + let pcvControllerAddress: string; + let psmAdminAddress: string; const mintFeeBasisPoints = 30; const redeemFeeBasisPoints = 30; diff --git a/test/unit/peg/PriceBoundPegStabilityModule.test.ts b/test/unit/peg/PriceBoundPegStabilityModule.test.ts index 0271e97d9..9ded3f794 100644 --- a/test/unit/peg/PriceBoundPegStabilityModule.test.ts +++ b/test/unit/peg/PriceBoundPegStabilityModule.test.ts @@ -1,25 +1,25 @@ -import hre, { ethers } from 'hardhat'; +import { Core, Fei, MockERC20, MockOracle, MockPCVDepositV2, PriceBoundPSM } from '@custom-types/contracts'; import { + deployDevelopmentWeth, expectRevert, getAddresses, getCore, - deployDevelopmentWeth, - ZERO_ADDRESS, - getImpersonatedSigner + getImpersonatedSigner, + ZERO_ADDRESS } from '@test/helpers'; import { expect } from 'chai'; import { Signer, utils } from 'ethers'; -import { Core, MockERC20, Fei, MockOracle, PriceBoundPSM, MockPCVDepositV2 } from '@custom-types/contracts'; import { keccak256 } from 'ethers/lib/utils'; +import hre, { ethers } from 'hardhat'; const toBN = ethers.BigNumber.from; describe('PriceBoundPegStabilityModule', function () { - let userAddress; - let governorAddress; - let minterAddress; - let pcvControllerAddress; - let psmAdminAddress; + let userAddress: string; + let governorAddress: string; + let minterAddress: string; + let pcvControllerAddress: string; + let psmAdminAddress: string; const mintFeeBasisPoints = 30; const redeemFeeBasisPoints = 30; diff --git a/test/unit/peg/ReserveStabilizer.test.ts b/test/unit/peg/ReserveStabilizer.test.ts index be4792d5f..c059f9038 100644 --- a/test/unit/peg/ReserveStabilizer.test.ts +++ b/test/unit/peg/ReserveStabilizer.test.ts @@ -1,15 +1,15 @@ -import { expectRevert, getAddresses, getCore } from '../../helpers'; import { expect } from 'chai'; -import hre, { ethers } from 'hardhat'; import { Signer } from 'ethers'; +import hre, { ethers } from 'hardhat'; +import { expectRevert, getAddresses, getCore } from '../../helpers'; const toBN = ethers.BigNumber.from; describe('ReserveStabilizer', function () { - let userAddress; - let governorAddress; - let minterAddress; - let pcvControllerAddress; + let userAddress: string; + let governorAddress: string; + let minterAddress: string; + let pcvControllerAddress: string; const impersonatedSigners: { [key: string]: Signer } = {}; diff --git a/test/unit/refs/OracleRef.test.ts b/test/unit/refs/OracleRef.test.ts index 96a5bcab6..246b06a16 100644 --- a/test/unit/refs/OracleRef.test.ts +++ b/test/unit/refs/OracleRef.test.ts @@ -1,13 +1,13 @@ -import { expectRevert, getAddresses, getCore } from '../../helpers'; import { expect } from 'chai'; -import hre, { ethers } from 'hardhat'; import { Signer } from 'ethers'; +import hre, { ethers } from 'hardhat'; +import { expectRevert, getAddresses, getCore } from '../../helpers'; const toBN = ethers.BigNumber.from; describe('OracleRef', () => { - let userAddress; - let governorAddress; + let userAddress: string; + let governorAddress: string; const impersonatedSigners: { [key: string]: Signer } = {}; diff --git a/test/unit/sentinel/PCVSentinel.test.ts b/test/unit/sentinel/PCVSentinel.test.ts index d063684e3..b98b647fe 100644 --- a/test/unit/sentinel/PCVSentinel.test.ts +++ b/test/unit/sentinel/PCVSentinel.test.ts @@ -1,22 +1,17 @@ -import { balance, expectRevert, getAddresses, getCore, getImpersonatedSigner } from '@test/helpers'; -import { expect } from 'chai'; -import { Signer } from 'ethers'; -import { ethers } from 'hardhat'; import { - Core, - MockERC20__factory, - MockPCVDepositV2__factory, - PCVDeposit, - PCVSentinel, - MockERC20, - NoOpGuard, BalanceGuard, + Core, MultiActionGuard, - ReEntrancyGuard, - RecoverEthGuard + NoOpGuard, + PCVSentinel, + RecoverEthGuard, + ReEntrancyGuard } from '@custom-types/contracts'; -import chai from 'chai'; -import { forceEth, forceSpecificEth } from '@test/integration/setup/utils'; +import { getAddresses, getCore, getImpersonatedSigner } from '@test/helpers'; +import { forceSpecificEth } from '@test/integration/setup/utils'; +import chai, { expect } from 'chai'; +import { Signer } from 'ethers'; +import { ethers } from 'hardhat'; // This will theoretically make the error stack actually print! chai.config.includeStack = true; diff --git a/test/unit/staking/TribalChiefPart1.test.ts b/test/unit/staking/TribalChiefPart1.test.ts index c49be5ecf..fb3977a5c 100644 --- a/test/unit/staking/TribalChiefPart1.test.ts +++ b/test/unit/staking/TribalChiefPart1.test.ts @@ -5,13 +5,11 @@ /* eslint-disable no-unused-expressions */ /* eslint-disable no-plusplus */ /* eslint-disable no-await-in-loop */ -import { time } from '../../helpers'; -import { expectRevert, expectUnspecifiedRevert, getCore, getAddresses, expectApprox } from '../../helpers'; +import { TransactionReceipt, TransactionResponse } from '@ethersproject/abstract-provider'; import { expect } from 'chai'; +import { BigNumber, Contract, Signer } from 'ethers'; import hre, { ethers } from 'hardhat'; -import { BigNumber, Signer } from 'ethers'; -import { TransactionReceipt, TransactionResponse } from '@ethersproject/abstract-provider'; -import { BN } from 'ethereumjs-util'; +import { expectApprox, expectRevert, getAddresses, getCore, time } from '../../helpers'; const toBN = ethers.BigNumber.from; @@ -23,14 +21,14 @@ const blockReward = '100000000000000000000'; const impersonatedSigners: { [key: string]: Signer } = {}; async function testMultipleUsersPooling( - tribalChief, - lpToken, - userAddresses, - incrementAmount, - blocksToAdvance, - lockLength, - totalStaked, - pid + tribalChief: Contract, + lpToken: Contract, + userAddresses: string[], + incrementAmount: BigNumber | BigNumber[], + blocksToAdvance: number, + lockLength: number | number[], + totalStaked: string, + pid: number ) { // if lock length isn't defined, it defaults to 0 lockLength = lockLength === undefined ? 0 : lockLength; @@ -85,34 +83,34 @@ async function testMultipleUsersPooling( await expectApprox( toBN(await tribalChief.pendingRewards(pid, userAddresses[j])), - pendingBalances[j].add(userIncrementAmount) + pendingBalances[j].add(userIncrementAmount as any) ); } } } -const emergencyWithdrawReport = []; -const withdrawAllAndHarvestReport = []; -const withdrawFromDepositReport = []; -const harvestReport = []; -const depositReport = []; +const emergencyWithdrawReport: any[] = []; +const withdrawAllAndHarvestReport: any[] = []; +const withdrawFromDepositReport: any[] = []; +const harvestReport: any[] = []; +const depositReport: any[] = []; describe('TribalChief', () => { // this is the process ID of the staking rewards that we will use - let pid; - let minterAddress; - let governorAddress; - let userAddress; - let secondUserAddress; - let thirdUserAddress; - let fourthUserAddress; - let fifthUserAddress; - let sixthUserAddress; - let seventhUserAddress; - let eigthUserAddress; - let ninthUserAddress; - let tenthUserAddress; - let perBlockReward; + let pid: number; + let minterAddress: string; + let governorAddress: string; + let userAddress: string; + let secondUserAddress: string; + let thirdUserAddress: string; + let fourthUserAddress: string; + let fifthUserAddress: string; + let sixthUserAddress: string; + let seventhUserAddress: string; + let eigthUserAddress: string; + let ninthUserAddress: string; + let tenthUserAddress: string; + let perBlockReward: number; const multiplier10x = '100000'; const multiplier5x = '50000'; @@ -1102,7 +1100,7 @@ describe('TribalChief', () => { thirdPid ); - async function testFailureWithdraw(poolPid, users, tribalChief) { + async function testFailureWithdraw(poolPid: number, users: string[], tribalChief: Contract) { for (const user of users) { await expectRevert( tribalChief.connect(impersonatedSigners[user]).withdrawFromDeposit(poolPid, totalStaked, user, 0), @@ -1969,9 +1967,9 @@ describe('TribalChief', () => { }); it('', async () => { - function printData(data, message) { + function printData(data: any, message: any) { console.log(message); - data.forEach((e) => { + data.forEach((e: any) => { console.log(`${e.msg} ${e.gas}`); }); } diff --git a/test/unit/staking/TribalChiefPart2.test.ts b/test/unit/staking/TribalChiefPart2.test.ts index 79f9f4aaf..998abc362 100644 --- a/test/unit/staking/TribalChiefPart2.test.ts +++ b/test/unit/staking/TribalChiefPart2.test.ts @@ -5,13 +5,11 @@ /* eslint-disable no-unused-expressions */ /* eslint-disable no-plusplus */ /* eslint-disable no-await-in-loop */ -import { time } from '../../helpers'; -import { expectRevert, expectUnspecifiedRevert, getCore, getAddresses, expectApprox } from '../../helpers'; +import { TransactionResponse } from '@ethersproject/abstract-provider'; import { expect } from 'chai'; +import { BigNumber, Contract, Signer } from 'ethers'; import hre, { ethers } from 'hardhat'; -import { BigNumber, Signer } from 'ethers'; -import { TransactionReceipt, TransactionResponse } from '@ethersproject/abstract-provider'; -import { BN } from 'ethereumjs-util'; +import { expectApprox, expectRevert, expectUnspecifiedRevert, getAddresses, getCore, time } from '../../helpers'; const toBN = ethers.BigNumber.from; @@ -23,14 +21,14 @@ const blockReward = '100000000000000000000'; const impersonatedSigners: { [key: string]: Signer } = {}; async function testMultipleUsersPooling( - tribalChief, - lpToken, - userAddresses, - incrementAmount, - blocksToAdvance, - lockLength, - totalStaked, - pid + tribalChief: Contract, + lpToken: Contract, + userAddresses: string[], + incrementAmount: BigNumber | BigNumber[], + blocksToAdvance: number, + lockLength: number | number[], + totalStaked: string, + pid: number ) { // if lock length isn't defined, it defaults to 0 lockLength = lockLength === undefined ? 0 : lockLength; @@ -85,7 +83,7 @@ async function testMultipleUsersPooling( await expectApprox( toBN(await tribalChief.pendingRewards(pid, userAddresses[j])), - pendingBalances[j].add(userIncrementAmount) + pendingBalances[j].add(userIncrementAmount as any) ); } } @@ -99,20 +97,20 @@ const depositReport = []; describe('TribalChief', () => { // this is the process ID of the staking rewards that we will use - let pid; - let minterAddress; - let governorAddress; - let userAddress; - let secondUserAddress; - let thirdUserAddress; - let fourthUserAddress; - let fifthUserAddress; - let sixthUserAddress; - let seventhUserAddress; - let eigthUserAddress; - let ninthUserAddress; - let tenthUserAddress; - let perBlockReward; + let pid: number; + let minterAddress: string; + let governorAddress: string; + let userAddress: string; + let secondUserAddress: string; + let thirdUserAddress: string; + let fourthUserAddress: string; + let fifthUserAddress: string; + let sixthUserAddress: string; + let seventhUserAddress: string; + let eigthUserAddress: string; + let ninthUserAddress: string; + let tenthUserAddress: string; + let perBlockReward: number; const multiplier10x = '100000'; const multiplier5x = '50000'; diff --git a/test/unit/staking/TribalChiefPart3.test.ts b/test/unit/staking/TribalChiefPart3.test.ts index e127d9259..b8d832933 100644 --- a/test/unit/staking/TribalChiefPart3.test.ts +++ b/test/unit/staking/TribalChiefPart3.test.ts @@ -5,12 +5,11 @@ /* eslint-disable no-unused-expressions */ /* eslint-disable no-plusplus */ /* eslint-disable no-await-in-loop */ -import { time } from '../../helpers'; -import { expectRevert, expectUnspecifiedRevert, getCore, getAddresses, expectApprox } from '../../helpers'; +import { TransactionResponse } from '@ethersproject/abstract-provider'; import { expect } from 'chai'; +import { BigNumber, Contract, Signer } from 'ethers'; import hre, { ethers } from 'hardhat'; -import { Signer } from 'ethers'; -import { TransactionReceipt, TransactionResponse } from '@ethersproject/abstract-provider'; +import { expectApprox, expectRevert, getAddresses, getCore, time } from '../../helpers'; const toBN = ethers.BigNumber.from; @@ -22,14 +21,14 @@ const blockReward = '100000000000000000000'; const impersonatedSigners: { [key: string]: Signer } = {}; async function testMultipleUsersPooling( - tribalChief, - lpToken, - userAddresses, - incrementAmount, - blocksToAdvance, - lockLength, - totalStaked, - pid + tribalChief: Contract, + lpToken: Contract, + userAddresses: string[], + incrementAmount: BigNumber | BigNumber[], + blocksToAdvance: number, + lockLength: number | number[], + totalStaked: string, + pid: number ) { // if lock length isn't defined, it defaults to 0 lockLength = lockLength === undefined ? 0 : lockLength; @@ -84,7 +83,7 @@ async function testMultipleUsersPooling( await expectApprox( toBN(await tribalChief.pendingRewards(pid, userAddresses[j])), - pendingBalances[j].add(userIncrementAmount) + pendingBalances[j].add(userIncrementAmount as any) ); } } @@ -98,20 +97,20 @@ const depositReport = []; describe('TribalChief', () => { // this is the process ID of the staking rewards that we will use - let pid; - let minterAddress; - let governorAddress; - let userAddress; - let secondUserAddress; - let thirdUserAddress; - let fourthUserAddress; - let fifthUserAddress; - let sixthUserAddress; - let seventhUserAddress; - let eigthUserAddress; - let ninthUserAddress; - let tenthUserAddress; - let perBlockReward; + let pid: number; + let minterAddress: string; + let governorAddress: string; + let userAddress: string; + let secondUserAddress: string; + let thirdUserAddress: string; + let fourthUserAddress: string; + let fifthUserAddress: string; + let sixthUserAddress: string; + let seventhUserAddress: string; + let eigthUserAddress: string; + let ninthUserAddress: string; + let tenthUserAddress: string; + let perBlockReward: number; const multiplier10x = '100000'; const multiplier5x = '50000'; diff --git a/test/unit/timelocks/QuadraticTimelock.test.ts b/test/unit/timelocks/QuadraticTimelock.test.ts index 8095c00fd..012879c90 100644 --- a/test/unit/timelocks/QuadraticTimelock.test.ts +++ b/test/unit/timelocks/QuadraticTimelock.test.ts @@ -1,19 +1,20 @@ +import { MockTribe, QuadraticTimelockedDelegator } from '@custom-types/contracts'; import { expectEvent, expectRevert, getAddresses, getImpersonatedSigner, time } from '@test/helpers'; import { expect } from 'chai'; +import { BigNumber, Signer } from 'ethers'; import { ethers } from 'hardhat'; -import { Signer } from 'ethers'; import { forceEth } from '../../integration/setup/utils'; const toBN = ethers.BigNumber.from; describe('QuadraticTimelockedDelegator', function () { - let userAddress; - let secondUserAddress; - let beneficiaryAddress1; - let delegator; - let tribe; - let window; - let totalTribe; + let userAddress: string; + let secondUserAddress: string; + let beneficiaryAddress1: string; + let delegator: QuadraticTimelockedDelegator; + let tribe: MockTribe; + let window: BigNumber; + let totalTribe: BigNumber; const impersonatedSigners: { [key: string]: Signer } = {}; @@ -80,10 +81,10 @@ describe('QuadraticTimelockedDelegator', function () { }); describe('One Quarter (1/4)', function () { - let quarter; - let alreadyClaimed; - let available; - let remainingBalance; + let quarter: BigNumber; + let alreadyClaimed: BigNumber; + let available: BigNumber; + let remainingBalance: BigNumber; beforeEach(async function () { quarter = window.div(toBN(4)); @@ -91,7 +92,7 @@ describe('QuadraticTimelockedDelegator', function () { alreadyClaimed = toBN(0); // 0 available = totalTribe.div(toBN(16)); // (1*1)/(4*4) remainingBalance = totalTribe.sub(available); - expectEvent(await delegator.release(userAddress, available), delegator, 'Release', [ + expectEvent(delegator.release(userAddress, available), delegator, 'Release', [ userAddress, userAddress, available @@ -160,7 +161,7 @@ describe('QuadraticTimelockedDelegator', function () { describe('Total Release', function () { beforeEach(async function () { - expectEvent(await delegator.release(userAddress, totalTribe), delegator, 'Release', [ + expectEvent(delegator.release(userAddress, totalTribe), delegator, 'Release', [ userAddress, userAddress, totalTribe @@ -180,7 +181,7 @@ describe('QuadraticTimelockedDelegator', function () { describe('Release To', function () { beforeEach(async function () { - expectEvent(await delegator.release(userAddress, totalTribe), delegator, 'Release', [ + expectEvent(delegator.release(userAddress, totalTribe), delegator, 'Release', [ userAddress, userAddress, totalTribe @@ -199,11 +200,11 @@ describe('QuadraticTimelockedDelegator', function () { }); describe('Partial Release', function () { - let halfAmount; + let halfAmount: BigNumber; beforeEach(async function () { halfAmount = totalTribe.div(toBN(2)); - expectEvent(await delegator.release(userAddress, halfAmount), delegator, 'Release', [ + expectEvent(delegator.release(userAddress, halfAmount), delegator, 'Release', [ userAddress, userAddress, halfAmount @@ -236,9 +237,7 @@ describe('QuadraticTimelockedDelegator', function () { describe('Access', function () { describe('Set Pending Beneficiary', function () { it('Beneficiary set succeeds', async function () { - expectEvent(await delegator.setPendingBeneficiary(userAddress), delegator, 'PendingBeneficiaryUpdate', [ - userAddress - ]); + expectEvent(delegator.setPendingBeneficiary(userAddress), delegator, 'PendingBeneficiaryUpdate', [userAddress]); expect(await delegator.pendingBeneficiary()).to.be.equal(userAddress); }); @@ -253,7 +252,7 @@ describe('QuadraticTimelockedDelegator', function () { it('Pending Beneficiary succeeds', async function () { await delegator.setPendingBeneficiary(userAddress); expectEvent( - await delegator.connect(impersonatedSigners[userAddress]).acceptBeneficiary(), + delegator.connect(impersonatedSigners[userAddress]).acceptBeneficiary(), delegator, 'BeneficiaryUpdate', [userAddress] @@ -290,7 +289,7 @@ describe('QuadraticTimelockedDelegator', function () { }); describe('Clawback', function () { - let clawbackAdmin; + let clawbackAdmin: string; beforeEach(async function () { clawbackAdmin = await delegator.clawbackAdmin(); diff --git a/test/unit/timelocks/TimelockedDelegator.test.ts b/test/unit/timelocks/TimelockedDelegator.test.ts index 895d5443c..6ec5c03f8 100644 --- a/test/unit/timelocks/TimelockedDelegator.test.ts +++ b/test/unit/timelocks/TimelockedDelegator.test.ts @@ -1,7 +1,7 @@ -import { getAddresses, time } from '../../helpers'; import { expect } from 'chai'; -import hre, { ethers, artifacts } from 'hardhat'; import { Signer } from 'ethers'; +import hre, { artifacts, ethers } from 'hardhat'; +import { getAddresses, time } from '../../helpers'; const TimelockedDelegator = artifacts.readArtifactSync('TimelockedDelegator'); const MockTribe = artifacts.readArtifactSync('MockTribe'); diff --git a/test/unit/tribe/TribeMinter.test.ts b/test/unit/tribe/TribeMinter.test.ts index 759f34fa2..8e00d05ef 100644 --- a/test/unit/tribe/TribeMinter.test.ts +++ b/test/unit/tribe/TribeMinter.test.ts @@ -1,10 +1,9 @@ -import { expectRevert, getAddresses, getCore, getImpersonatedSigner, increaseTime, ZERO_ADDRESS } from '../../helpers'; -import { ethers } from 'hardhat'; -import { expect } from 'chai'; -import { Signer } from 'ethers'; import { Core, Tribe, TribeMinter } from '@custom-types/contracts'; -import chai from 'chai'; +import chai, { expect } from 'chai'; import CBN from 'chai-bn'; +import { BigNumber, Signer } from 'ethers'; +import { ethers } from 'hardhat'; +import { expectRevert, getAddresses, getCore, getImpersonatedSigner, increaseTime, ZERO_ADDRESS } from '../../helpers'; const toBN = ethers.BigNumber.from; before(() => { @@ -83,8 +82,8 @@ describe('TribeMinter', function () { }); describe('Poke', function () { - let mintAmount; - let inflationIncrement; + let mintAmount: BigNumber; + let inflationIncrement: BigNumber; beforeEach(async function () { mintAmount = ethers.constants.WeiPerEther.mul(10_000); @@ -154,7 +153,7 @@ describe('TribeMinter', function () { }); describe('Mint', function () { - let mintAmount; + let mintAmount: BigNumber; beforeEach(async function () { mintAmount = ethers.constants.WeiPerEther.mul(10_000); }); diff --git a/test/unit/tribe/TribeReserveStabilizer.test.ts b/test/unit/tribe/TribeReserveStabilizer.test.ts index d21c6cf42..c118219fa 100644 --- a/test/unit/tribe/TribeReserveStabilizer.test.ts +++ b/test/unit/tribe/TribeReserveStabilizer.test.ts @@ -1,23 +1,23 @@ -import { expectRevert, getAddresses, getCore, increaseTime, getImpersonatedSigner } from '@test/helpers'; -import { ethers } from 'hardhat'; +import { Core, Fei, Tribe, TribeReserveStabilizer } from '@custom-types/contracts'; +import { expectRevert, getAddresses, getCore, getImpersonatedSigner, increaseTime } from '@test/helpers'; import { expect } from 'chai'; -import { Signer } from 'ethers'; -import { Core, Tribe, Fei, TribeReserveStabilizer } from '@custom-types/contracts'; +import { Contract, Signer } from 'ethers'; +import { ethers } from 'hardhat'; const toBN = ethers.BigNumber.from; describe('TribeReserveStabilizer', function () { - let userAddress; - let governorAddress; - let minterAddress; - let pcvControllerAddress; + let userAddress: string; + let governorAddress: string; + let minterAddress: string; + let pcvControllerAddress: string; let reserveStabilizer: TribeReserveStabilizer; let core: Core; let fei: Fei; let tribe: Tribe; - let tribeMinter; - let oracle; - let collateralizationOracle; + let tribeMinter: Contract; + let oracle: Contract; + let collateralizationOracle: Contract; const impersonatedSigners: { [key: string]: Signer } = {}; From 5f4b89ac95dbb1deb716405c5e176211be7c3b61 Mon Sep 17 00:00:00 2001 From: thomas-waite Date: Tue, 7 Jun 2022 15:57:14 +0100 Subject: [PATCH 259/274] refactor: correctly request withdrawal --- proposals/description/tokemak_withdraw.ts | 7 ++++--- protocol-configuration/mainnetAddresses.ts | 10 ++++++++++ test/integration/proposals_config.ts | 18 ++++-------------- 3 files changed, 18 insertions(+), 17 deletions(-) diff --git a/proposals/description/tokemak_withdraw.ts b/proposals/description/tokemak_withdraw.ts index 1fda45409..815d37602 100644 --- a/proposals/description/tokemak_withdraw.ts +++ b/proposals/description/tokemak_withdraw.ts @@ -6,10 +6,11 @@ const tokemak_withdraw: ProposalDescription = { { target: 'ethTokemakPCVDeposit', values: '0', - method: 'requestWithdrawal()', - arguments: [], - description: 'Request to withdraw tWETH from Tokemak in the next cycle' + method: 'requestWithdrawal(uint256)', + arguments: ['10000000000000000000000'], + description: 'Request to withdraw WETH from Tokemak in the next cycle' } + // TODO: Claim TOKE rewards as part of this ], description: `Request to withdraw ETH from Tokemak in the next cycle` }; diff --git a/protocol-configuration/mainnetAddresses.ts b/protocol-configuration/mainnetAddresses.ts index be2665256..d0fcc8482 100644 --- a/protocol-configuration/mainnetAddresses.ts +++ b/protocol-configuration/mainnetAddresses.ts @@ -476,6 +476,16 @@ const MainnetAddresses: MainnetAddresses = { address: '0x0961d2a545e0c1201B313d14C57023682a546b9D', category: AddressCategory.PCV }, + tokemakManagerRollover: { + artifactName: 'unknown', + address: '0x90b6C61B102eA260131aB48377E143D6EB3A9d4B', + category: AddressCategory.External + }, + tokemakManager: { + artifactName: 'unknown', + address: '0xa86e412109f77c45a3bc1c5870b880492fb86a14', + category: AddressCategory.External + }, liquityFusePoolLusdPCVDeposit: { artifactName: 'ERC20CompoundPCVDeposit', address: '0x8C51E4532CC745cF3DFec5CEBd835D07E7BA1002', diff --git a/test/integration/proposals_config.ts b/test/integration/proposals_config.ts index 1147a8f1a..d41ee4cd9 100644 --- a/test/integration/proposals_config.ts +++ b/test/integration/proposals_config.ts @@ -1,20 +1,10 @@ import { ProposalCategory, ProposalsConfigMap } from '@custom-types/types'; import repay_fuse_bad_debt from '@proposals/description/repay_fuse_bad_debt'; -import register_proposal from '@proposals/description/register_proposal'; import end_tribe_incentives from '@proposals/description/end_tribe_incentives'; -import tokemak_withdrawal from '@proposals/description/tokemak_withdraw'; +import tokemak_withdraw from '@proposals/description/tokemak_withdraw'; const proposals: ProposalsConfigMap = { - register_proposal: { - deploy: false, // deploy flag for whether to run deploy action during e2e tests or use mainnet state - totalValue: 0, // amount of ETH to send to DAO execution - proposal: register_proposal, // full proposal file, imported from '@proposals/description/fip_xx.ts' - proposalId: '', - affectedContractSignoff: ['core'], - deprecatedContractSignoff: [], - category: ProposalCategory.TC - }, repay_fuse_bad_debt: { deploy: false, // deploy flag for whether to run deploy action during e2e tests or use mainnet state totalValue: 0, // amount of ETH to send to DAO execution @@ -66,12 +56,12 @@ const proposals: ProposalsConfigMap = { ], category: ProposalCategory.TC }, - tokemak_withdrawal: { + tokemak_withdraw: { deploy: false, // deploy flag for whether to run deploy action during e2e tests or use mainnet state totalValue: 0, // amount of ETH to send to DAO execution - proposal: tokemak_withdrawal, // full proposal file, imported from '@proposals/description/fip_xx.ts' + proposal: tokemak_withdraw, // full proposal file, imported from '@proposals/description/fip_xx.ts' proposalId: '', - affectedContractSignoff: ['core'], + affectedContractSignoff: ['ethTokemakPCVDeposit'], deprecatedContractSignoff: [], category: ProposalCategory.TC } From ecd56f049edd9fbed2e1b3aee9fb5e28333e5fd4 Mon Sep 17 00:00:00 2001 From: thomas-waite Date: Tue, 7 Jun 2022 15:58:29 +0100 Subject: [PATCH 260/274] test: validate withdrawal request works and can withdraw next cycle --- proposals/dao/tokemak_withdraw.ts | 30 +++++++++++++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) diff --git a/proposals/dao/tokemak_withdraw.ts b/proposals/dao/tokemak_withdraw.ts index a957e9cf9..846c01cec 100644 --- a/proposals/dao/tokemak_withdraw.ts +++ b/proposals/dao/tokemak_withdraw.ts @@ -7,6 +7,8 @@ import { TeardownUpgradeFunc, ValidateUpgradeFunc } from '@custom-types/types'; +import { forceEth } from '@test/integration/setup/utils'; +import { getImpersonatedSigner, time } from '@test/helpers'; /* @@ -16,6 +18,8 @@ Withdraw from Tokemak const fipNumber = 'tokemak_withdraw'; +const IPFS_JSON_FILE_HASH = 'QmP4Vzg45jExr3mcNsx9xxV1fNft95uVzgZGeLtkBXgpkx'; + // Do any deployments // This should exclusively include new contract deployments const deploy: DeployUpgradeFunc = async (deployAddress: string, addresses: NamedAddresses, logging: boolean) => { @@ -41,7 +45,31 @@ const teardown: TeardownUpgradeFunc = async (addresses, oldContracts, contracts, // Run any validations required on the fip using mocha or console logging // IE check balances, check state of contracts, etc. const validate: ValidateUpgradeFunc = async (addresses, oldContracts, contracts, logging) => { - console.log(`No actions to complete in validate for fip${fipNumber}`); + const ethTokemakPCVDeposit = contracts.ethTokemakPCVDeposit; + + // Validate that DAO can withdraw funds in the next cycle + // impersonate the rollover signer, and make the Tokemak pool go to next cycle + await forceEth(addresses.tokemakManagerRollover); + const tokemakRolloverSigner = await getImpersonatedSigner(addresses.tokemakManagerRollover); + const tokemakManagerAbi = [ + 'function nextCycleStartTime() view returns (uint256)', + 'function completeRollover(string calldata rewardsIpfsHash)' + ]; + const tokemakManager = new ethers.Contract(addresses.tokemakManager, tokemakManagerAbi, tokemakRolloverSigner); + const cycleEnd = await tokemakManager.nextCycleStartTime(); + await time.increaseTo(cycleEnd + 1); + await tokemakManager.completeRollover(IPFS_JSON_FILE_HASH); + + // Perform withdraw + await ethTokemakPCVDeposit.withdraw(ethTokemakPCVDeposit.address, ethers.constants.WeiPerEther.mul(10_000)); + + // Should end with 0 tWETH, 10k ETH + expect((await contracts.tWETH.balanceOf(ethTokemakPCVDeposit.address)).toString()).to.be.equal( + ethers.utils.parseEther('0') + ); + expect((await ethers.provider.getBalance(ethTokemakPCVDeposit.address)).toString()).to.be.equal( + ethers.utils.parseEther('10000') + ); }; export { deploy, setup, teardown, validate }; From bb73653709e395bb70124cfd7f71969123cda500 Mon Sep 17 00:00:00 2001 From: Caleb Date: Tue, 7 Jun 2022 08:29:07 -0700 Subject: [PATCH 261/274] Fix command --- proposals/description/eth_lbp.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/proposals/description/eth_lbp.ts b/proposals/description/eth_lbp.ts index dc71367f8..52164ff18 100644 --- a/proposals/description/eth_lbp.ts +++ b/proposals/description/eth_lbp.ts @@ -29,8 +29,8 @@ const eth_lbp: TemplatedProposalDescription = { values: '0', method: 'withdrawToSafeAddress(address,address,uint256,bool,bool)', arguments: (addresses) => [ - '{compoundDaiPCVDeposit}', - '{ethToDaiLBPSwapper}', + addresses.compoundDaiPCVDeposit, + addresses.ethToDaiLBPSwapper, '3000000000000000000000000', false, false From 73fc8b4f5fc7b1871abd5ad3acffc186b68dea75 Mon Sep 17 00:00:00 2001 From: thomas-waite Date: Tue, 7 Jun 2022 16:51:42 +0100 Subject: [PATCH 262/274] test: restore e2e test state after fip --- proposals/dao/tokemak_withdraw.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/proposals/dao/tokemak_withdraw.ts b/proposals/dao/tokemak_withdraw.ts index 846c01cec..80ceec584 100644 --- a/proposals/dao/tokemak_withdraw.ts +++ b/proposals/dao/tokemak_withdraw.ts @@ -70,6 +70,9 @@ const validate: ValidateUpgradeFunc = async (addresses, oldContracts, contracts, expect((await ethers.provider.getBalance(ethTokemakPCVDeposit.address)).toString()).to.be.equal( ethers.utils.parseEther('10000') ); + + // Then re-deposit, to clean up state for e2e tests + await ethTokemakPCVDeposit.deposit(); }; export { deploy, setup, teardown, validate }; From df11f9330aff3a07336861f766b1642f6a1c38f0 Mon Sep 17 00:00:00 2001 From: thomas-waite Date: Tue, 7 Jun 2022 16:55:46 +0100 Subject: [PATCH 263/274] docs: improve copy --- proposals/dao/tokemak_withdraw.ts | 4 ++-- proposals/description/tokemak_withdraw.ts | 9 ++++++--- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/proposals/dao/tokemak_withdraw.ts b/proposals/dao/tokemak_withdraw.ts index 80ceec584..fe631ded2 100644 --- a/proposals/dao/tokemak_withdraw.ts +++ b/proposals/dao/tokemak_withdraw.ts @@ -12,11 +12,11 @@ import { getImpersonatedSigner, time } from '@test/helpers'; /* -Withdraw from Tokemak +FIP 111: Withdraw from Tokemak */ -const fipNumber = 'tokemak_withdraw'; +const fipNumber = 'fip_111_tokemak_withdraw'; const IPFS_JSON_FILE_HASH = 'QmP4Vzg45jExr3mcNsx9xxV1fNft95uVzgZGeLtkBXgpkx'; diff --git a/proposals/description/tokemak_withdraw.ts b/proposals/description/tokemak_withdraw.ts index 815d37602..c5c165066 100644 --- a/proposals/description/tokemak_withdraw.ts +++ b/proposals/description/tokemak_withdraw.ts @@ -8,11 +8,14 @@ const tokemak_withdraw: ProposalDescription = { values: '0', method: 'requestWithdrawal(uint256)', arguments: ['10000000000000000000000'], - description: 'Request to withdraw WETH from Tokemak in the next cycle' + description: 'Request to withdraw 10K WETH from Tokemak in the next cycle' } - // TODO: Claim TOKE rewards as part of this ], - description: `Request to withdraw ETH from Tokemak in the next cycle` + description: ` + FIP 111: Request withdrawal from Tokemak + + Request a withdrawal of 10k ETH from Tokemak in the next cycle. + ` }; export default tokemak_withdraw; From 00c4f6d5956f8cecb5fb21c584249afc32308e2d Mon Sep 17 00:00:00 2001 From: thomas-waite Date: Tue, 7 Jun 2022 17:23:05 +0100 Subject: [PATCH 264/274] test: add validation in e2e tests --- proposals/dao/tokemak_withdraw.ts | 30 +-------------- test/integration/tests/fip-38-tokemak.ts | 48 ++++++++++++++++++++---- 2 files changed, 43 insertions(+), 35 deletions(-) diff --git a/proposals/dao/tokemak_withdraw.ts b/proposals/dao/tokemak_withdraw.ts index fe631ded2..f6b2be033 100644 --- a/proposals/dao/tokemak_withdraw.ts +++ b/proposals/dao/tokemak_withdraw.ts @@ -45,34 +45,8 @@ const teardown: TeardownUpgradeFunc = async (addresses, oldContracts, contracts, // Run any validations required on the fip using mocha or console logging // IE check balances, check state of contracts, etc. const validate: ValidateUpgradeFunc = async (addresses, oldContracts, contracts, logging) => { - const ethTokemakPCVDeposit = contracts.ethTokemakPCVDeposit; - - // Validate that DAO can withdraw funds in the next cycle - // impersonate the rollover signer, and make the Tokemak pool go to next cycle - await forceEth(addresses.tokemakManagerRollover); - const tokemakRolloverSigner = await getImpersonatedSigner(addresses.tokemakManagerRollover); - const tokemakManagerAbi = [ - 'function nextCycleStartTime() view returns (uint256)', - 'function completeRollover(string calldata rewardsIpfsHash)' - ]; - const tokemakManager = new ethers.Contract(addresses.tokemakManager, tokemakManagerAbi, tokemakRolloverSigner); - const cycleEnd = await tokemakManager.nextCycleStartTime(); - await time.increaseTo(cycleEnd + 1); - await tokemakManager.completeRollover(IPFS_JSON_FILE_HASH); - - // Perform withdraw - await ethTokemakPCVDeposit.withdraw(ethTokemakPCVDeposit.address, ethers.constants.WeiPerEther.mul(10_000)); - - // Should end with 0 tWETH, 10k ETH - expect((await contracts.tWETH.balanceOf(ethTokemakPCVDeposit.address)).toString()).to.be.equal( - ethers.utils.parseEther('0') - ); - expect((await ethers.provider.getBalance(ethTokemakPCVDeposit.address)).toString()).to.be.equal( - ethers.utils.parseEther('10000') - ); - - // Then re-deposit, to clean up state for e2e tests - await ethTokemakPCVDeposit.deposit(); + console.log(`No actions to complete in validate for fip${fipNumber}`); + // Validation performed in e2e test }; export { deploy, setup, teardown, validate }; diff --git a/test/integration/tests/fip-38-tokemak.ts b/test/integration/tests/fip-38-tokemak.ts index 1f24bd066..45c3c87f0 100644 --- a/test/integration/tests/fip-38-tokemak.ts +++ b/test/integration/tests/fip-38-tokemak.ts @@ -46,22 +46,56 @@ describe('e2e-fip-38-tokemak', function () { doLogging && console.log(`Environment loaded.`); }); - it('should have deposited ETH, and be able to withdraw', async function () { + it('should be able to withdraw ETH', async function () { const { ethTokemakPCVDeposit, tWETH // Tokemak ETH reactor } = contracts; - // we should start with 10k tWETH, 0 ETH - expect((await tWETH.balanceOf(ethTokemakPCVDeposit.address)).toString()).to.be.equal( + // impersonate the rollover signer, and make the Tokemak pool go to next cycle + await forceEth(TOKEMAK_MANAGER_ROLLOVER_ADDRESS); + const tokemakRolloverSigner = await getImpersonatedSigner(TOKEMAK_MANAGER_ROLLOVER_ADDRESS); + const tokemakManagerAbi = [ + 'function nextCycleStartTime() view returns (uint256)', + 'function completeRollover(string calldata rewardsIpfsHash)' + ]; + const tokemakManager = new ethers.Contract(TOKEMAK_MANAGER_ADDRESS, tokemakManagerAbi, tokemakRolloverSigner); + const cycleEnd = await tokemakManager.nextCycleStartTime(); + await time.increaseTo(cycleEnd + 1); + await tokemakManager.completeRollover(IPFS_JSON_FILE_HASH); + + // Perform withdraw + await ethTokemakPCVDeposit.withdraw(ethTokemakPCVDeposit.address, tenPow18.mul(toBN(10_000))); + + // Should end with 0 tWETH, 10k ETH + expect((await tWETH.balanceOf(ethTokemakPCVDeposit.address)).toString()).to.be.equal(ethers.utils.parseEther('0')); + expect((await ethers.provider.getBalance(ethTokemakPCVDeposit.address)).toString()).to.be.equal( ethers.utils.parseEther('10000') ); + }); + + it('should be able to deposit and then withdraw ETH', async function () { + const { + ethTokemakPCVDeposit, + tWETH // Tokemak ETH reactor + } = contracts; + + // Starting state: 10k tETH, 0 WETH + // Want to transfer ETH, and deposit. Then verify deposit and then withdraw + const ethWhaleSigner = await getImpersonatedSigner('0x73BCEb1Cd57C711feaC4224D062b0F6ff338501e'); + await ethWhaleSigner.sendTransaction({ to: ethTokemakPCVDeposit.address, value: ethers.utils.parseEther('10000') }); + await ethTokemakPCVDeposit.deposit(); + + // Now has 20k tETH, 0k WETH + expect((await tWETH.balanceOf(ethTokemakPCVDeposit.address)).toString()).to.be.equal( + ethers.utils.parseEther('20000') + ); expect((await ethers.provider.getBalance(ethTokemakPCVDeposit.address)).toString()).to.be.equal( ethers.utils.parseEther('0') ); - // request to withdraw 10k ETH - await ethTokemakPCVDeposit.requestWithdrawal(tenPow18.mul(toBN(10_000))); + // request to withdraw 20k ETH + await ethTokemakPCVDeposit.requestWithdrawal(tenPow18.mul(toBN(20_000))); // impersonate the rollover signer, and make the Tokemak pool go to next cycle await forceEth(TOKEMAK_MANAGER_ROLLOVER_ADDRESS); @@ -76,12 +110,12 @@ describe('e2e-fip-38-tokemak', function () { await tokemakManager.completeRollover(IPFS_JSON_FILE_HASH); // Perform withdraw - await ethTokemakPCVDeposit.withdraw(ethTokemakPCVDeposit.address, tenPow18.mul(toBN(10_000))); + await ethTokemakPCVDeposit.withdraw(ethTokemakPCVDeposit.address, tenPow18.mul(toBN(20_000))); // Should end with 0 tWETH, 10k ETH expect((await tWETH.balanceOf(ethTokemakPCVDeposit.address)).toString()).to.be.equal(ethers.utils.parseEther('0')); expect((await ethers.provider.getBalance(ethTokemakPCVDeposit.address)).toString()).to.be.equal( - ethers.utils.parseEther('10000') + ethers.utils.parseEther('20000') ); }); }); From a14b0da8e607948589ae0fed85be3d136e83bbe1 Mon Sep 17 00:00:00 2001 From: thomas-waite Date: Tue, 7 Jun 2022 17:29:18 +0100 Subject: [PATCH 265/274] docs: remove unneeded constant --- proposals/dao/tokemak_withdraw.ts | 2 -- 1 file changed, 2 deletions(-) diff --git a/proposals/dao/tokemak_withdraw.ts b/proposals/dao/tokemak_withdraw.ts index f6b2be033..15466feda 100644 --- a/proposals/dao/tokemak_withdraw.ts +++ b/proposals/dao/tokemak_withdraw.ts @@ -18,8 +18,6 @@ FIP 111: Withdraw from Tokemak const fipNumber = 'fip_111_tokemak_withdraw'; -const IPFS_JSON_FILE_HASH = 'QmP4Vzg45jExr3mcNsx9xxV1fNft95uVzgZGeLtkBXgpkx'; - // Do any deployments // This should exclusively include new contract deployments const deploy: DeployUpgradeFunc = async (deployAddress: string, addresses: NamedAddresses, logging: boolean) => { From 2a3a51489653bfcd8387d4684bf3b0282ee01a85 Mon Sep 17 00:00:00 2001 From: Caleb Date: Tue, 7 Jun 2022 15:52:30 -0700 Subject: [PATCH 266/274] Fix tests --- test/helpers.ts | 2 +- .../tests/metagov/GovernorVoter.ts | 2 +- .../tests/metagov/LiquidityGaugeManager.ts | 2 +- .../tests/metagov/VoteEscrowTokenManager.ts | 2 +- .../curve/CurvePCVDepositPlainPool.test.ts | 2 +- .../NamedStaticPCVDepositWrapper.test.ts | 33 ++++++++++++------- 6 files changed, 26 insertions(+), 17 deletions(-) diff --git a/test/helpers.ts b/test/helpers.ts index 7f1cd716c..686ceeda7 100644 --- a/test/helpers.ts +++ b/test/helpers.ts @@ -176,7 +176,7 @@ async function expectApproxAbs( expect(actualBN).to.be.lte(upperBound); } -async function expectEvent(tx: Promise, contract: any, event: string, args: any[]): Promise { +async function expectEvent(tx: any, contract: any, event: string, args: any[]): Promise { await expect(tx) .to.emit(contract, event) .withArgs(...args); diff --git a/test/integration/tests/metagov/GovernorVoter.ts b/test/integration/tests/metagov/GovernorVoter.ts index b01d869a7..a00555833 100644 --- a/test/integration/tests/metagov/GovernorVoter.ts +++ b/test/integration/tests/metagov/GovernorVoter.ts @@ -9,7 +9,7 @@ import { getImpersonatedSigner, expectRevert, time } from '@test/helpers'; import { forceEth } from '@test/integration/setup/utils'; import { MockGovernorVoter } from '@custom-types/contracts'; -const e18 = (x) => ethers.constants.WeiPerEther.mul(x); +const e18 = (x: any) => ethers.constants.WeiPerEther.mul(x); describe('e2e-metagov', function () { let deployAddress: string; diff --git a/test/integration/tests/metagov/LiquidityGaugeManager.ts b/test/integration/tests/metagov/LiquidityGaugeManager.ts index 357ae2e39..cfeacc556 100644 --- a/test/integration/tests/metagov/LiquidityGaugeManager.ts +++ b/test/integration/tests/metagov/LiquidityGaugeManager.ts @@ -9,7 +9,7 @@ import { getImpersonatedSigner, expectRevert } from '@test/helpers'; import { forceEth } from '@test/integration/setup/utils'; import { AngleDelegatorPCVDeposit } from '@custom-types/contracts'; -const e18 = (x) => ethers.constants.WeiPerEther.mul(x); +const e18 = (x: any) => ethers.constants.WeiPerEther.mul(x); describe('e2e-metagov', function () { let deployAddress: string; diff --git a/test/integration/tests/metagov/VoteEscrowTokenManager.ts b/test/integration/tests/metagov/VoteEscrowTokenManager.ts index c648f4e52..c22533f28 100644 --- a/test/integration/tests/metagov/VoteEscrowTokenManager.ts +++ b/test/integration/tests/metagov/VoteEscrowTokenManager.ts @@ -9,7 +9,7 @@ import { getImpersonatedSigner, expectRevert, time } from '@test/helpers'; import { forceEth } from '@test/integration/setup/utils'; import { MockVoteEscrowTokenManager } from '@custom-types/contracts'; -const e18 = (x) => ethers.constants.WeiPerEther.mul(x); +const e18 = (x: any) => ethers.constants.WeiPerEther.mul(x); describe('e2e-metagov', function () { let deployAddress: string; diff --git a/test/unit/pcv/curve/CurvePCVDepositPlainPool.test.ts b/test/unit/pcv/curve/CurvePCVDepositPlainPool.test.ts index ab6b85ca4..aac2174c6 100644 --- a/test/unit/pcv/curve/CurvePCVDepositPlainPool.test.ts +++ b/test/unit/pcv/curve/CurvePCVDepositPlainPool.test.ts @@ -78,7 +78,7 @@ describe('CurvePCVDepositPlainPool', function () { await curvePool.transfer(deposit.address, '5000'); expect(await deposit.balance()).to.be.equal('6666'); // reduce if FEI share of the pool increases - fei.connect(await getImpersonatedSigner(minterAddress)).mint(curvePool.address, '10000'); + await fei.connect(await getImpersonatedSigner(minterAddress)).mint(curvePool.address, '10000'); expect(await deposit.balance()).to.be.equal('3333'); }); }); diff --git a/test/unit/pcv/utils/NamedStaticPCVDepositWrapper.test.ts b/test/unit/pcv/utils/NamedStaticPCVDepositWrapper.test.ts index 3c1c321cb..e86397901 100644 --- a/test/unit/pcv/utils/NamedStaticPCVDepositWrapper.test.ts +++ b/test/unit/pcv/utils/NamedStaticPCVDepositWrapper.test.ts @@ -106,7 +106,7 @@ describe('NamedStaticPCVDepositWrapper', function () { const startingFeiBalance = await deposit.feiReportBalance(); expectEvent( - deposit.connect(impersonatedSigners[governorAddress]).addDeposit({ + await deposit.connect(impersonatedSigners[governorAddress]).addDeposit({ usdAmount: balance, feiAmount: feiBalance, underlyingTokenAmount: 1000, @@ -160,7 +160,7 @@ describe('NamedStaticPCVDepositWrapper', function () { const startingNumDeposits = await deposit.numDeposits(); expectEvent( - deposit.connect(impersonatedSigners[governorAddress]).bulkAddDeposits([ + await deposit.connect(impersonatedSigners[governorAddress]).bulkAddDeposits([ { usdAmount: balance, feiAmount: feiBalance, @@ -230,7 +230,7 @@ describe('NamedStaticPCVDepositWrapper', function () { balance = '100'; expectEvent( - deposit + await deposit .connect(impersonatedSigners[governorAddress]) .editDeposit(0, balance, feiBalance, newUnderlyingAmt, 'Visor Finance USDC/FEI Deposit', await core.fei()), deposit, @@ -303,9 +303,12 @@ describe('NamedStaticPCVDepositWrapper', function () { it('successfully removes existing deposit when governor calls removeDeposit', async function () { const startingNumDeposits = await deposit.numDeposits(); for (let i = 0; i < parseInt(startingNumDeposits.toString()); i++) { - expectEvent(deposit.connect(impersonatedSigners[governorAddress]).removeDeposit(0), deposit, 'DepositRemoved', [ - 0 - ]); + expectEvent( + await deposit.connect(impersonatedSigners[governorAddress]).removeDeposit(0), + deposit, + 'DepositRemoved', + [0] + ); } const endingBalance = await deposit.balance(); @@ -320,9 +323,12 @@ describe('NamedStaticPCVDepositWrapper', function () { it('successfully removes existing deposit when guardian calls removeDeposit', async function () { const startingNumDeposits = await deposit.numDeposits(); for (let i = 0; i < parseInt(startingNumDeposits.toString()); i++) { - expectEvent(deposit.connect(impersonatedSigners[guardianAddress]).removeDeposit(0), deposit, 'DepositRemoved', [ - 0 - ]); + expectEvent( + await deposit.connect(impersonatedSigners[guardianAddress]).removeDeposit(0), + deposit, + 'DepositRemoved', + [0] + ); } const [endingBalance, endingFeiBalance] = await deposit.resistantBalanceAndFei(); @@ -336,9 +342,12 @@ describe('NamedStaticPCVDepositWrapper', function () { it('successfully removes existing deposit when governor calls removeDeposit', async function () { const startingNumDeposits = await deposit.numDeposits(); for (let i = 0; i < parseInt(startingNumDeposits.toString()); i++) { - expectEvent(deposit.connect(impersonatedSigners[governorAddress]).removeDeposit(0), deposit, 'DepositRemoved', [ - 0 - ]); + expectEvent( + await deposit.connect(impersonatedSigners[governorAddress]).removeDeposit(0), + deposit, + 'DepositRemoved', + [0] + ); } const [endingBalance, endingFeiBalance] = await deposit.resistantBalanceAndFei(); From 080dcdd5d6c936531363e6f889ac7b6be212b55e Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 8 Jun 2022 07:28:49 +0000 Subject: [PATCH 267/274] build(deps): bump @gnosis.pm/safe-deployments from 1.14.0 to 1.15.0 Bumps [@gnosis.pm/safe-deployments](https://github.com/gnosis/safe-deployments) from 1.14.0 to 1.15.0. - [Release notes](https://github.com/gnosis/safe-deployments/releases) - [Commits](https://github.com/gnosis/safe-deployments/compare/v1.14.0...v1.15.0) --- updated-dependencies: - dependency-name: "@gnosis.pm/safe-deployments" dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- package-lock.json | 20 +++++++++++++------- package.json | 2 +- 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/package-lock.json b/package-lock.json index 114ef14a2..6a4150088 100644 --- a/package-lock.json +++ b/package-lock.json @@ -12,7 +12,7 @@ "@balancer-labs/v2-pool-weighted": "^2.0.1", "@chainlink/contracts": "^0.1.7", "@gnosis.pm/safe-core-sdk": "^2.1.0", - "@gnosis.pm/safe-deployments": "^1.14.0", + "@gnosis.pm/safe-deployments": "^1.15.0", "@gnosis.pm/safe-ethers-lib": "^1.1.0", "@nomiclabs/hardhat-waffle": "^2.0.3", "@openzeppelin/contracts": "4.6.0", @@ -1581,9 +1581,12 @@ } }, "node_modules/@gnosis.pm/safe-deployments": { - "version": "1.14.0", - "resolved": "https://registry.npmjs.org/@gnosis.pm/safe-deployments/-/safe-deployments-1.14.0.tgz", - "integrity": "sha512-KbuKppBkEAVmnvI9R6212Ne9paBzoDPGb2yye7BSFuhiVTMRSJftZAZXQoENqj+jA5r53d/t0DVjiPx0RE8/IQ==" + "version": "1.15.0", + "resolved": "https://registry.npmjs.org/@gnosis.pm/safe-deployments/-/safe-deployments-1.15.0.tgz", + "integrity": "sha512-twfC5HNuj+TKS2gOowf6A1FGZfOLBHAV2JhYpmOCf2MKsfcG+Fe4TrSRgQg605MhWdwFiaGVpNkcwjvpxhGuew==", + "dependencies": { + "semver": "^7.3.7" + } }, "node_modules/@gnosis.pm/safe-ethers-lib": { "version": "1.1.0", @@ -29864,9 +29867,12 @@ } }, "@gnosis.pm/safe-deployments": { - "version": "1.14.0", - "resolved": "https://registry.npmjs.org/@gnosis.pm/safe-deployments/-/safe-deployments-1.14.0.tgz", - "integrity": "sha512-KbuKppBkEAVmnvI9R6212Ne9paBzoDPGb2yye7BSFuhiVTMRSJftZAZXQoENqj+jA5r53d/t0DVjiPx0RE8/IQ==" + "version": "1.15.0", + "resolved": "https://registry.npmjs.org/@gnosis.pm/safe-deployments/-/safe-deployments-1.15.0.tgz", + "integrity": "sha512-twfC5HNuj+TKS2gOowf6A1FGZfOLBHAV2JhYpmOCf2MKsfcG+Fe4TrSRgQg605MhWdwFiaGVpNkcwjvpxhGuew==", + "requires": { + "semver": "^7.3.7" + } }, "@gnosis.pm/safe-ethers-lib": { "version": "1.1.0", diff --git a/package.json b/package.json index 621c1566a..a55f43dd3 100644 --- a/package.json +++ b/package.json @@ -52,7 +52,7 @@ "@balancer-labs/v2-pool-weighted": "^2.0.1", "@chainlink/contracts": "^0.1.7", "@gnosis.pm/safe-core-sdk": "^2.1.0", - "@gnosis.pm/safe-deployments": "^1.14.0", + "@gnosis.pm/safe-deployments": "^1.15.0", "@gnosis.pm/safe-ethers-lib": "^1.1.0", "@nomiclabs/hardhat-waffle": "^2.0.3", "@openzeppelin/contracts": "4.6.0", From d10453c73a8ecc85badef226f3f4c216003c7f3a Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 8 Jun 2022 07:29:19 +0000 Subject: [PATCH 268/274] build(deps-dev): bump @types/node from 17.0.40 to 17.0.41 Bumps [@types/node](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/node) from 17.0.40 to 17.0.41. - [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases) - [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/node) --- updated-dependencies: - dependency-name: "@types/node" dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- package-lock.json | 14 +++++++------- package.json | 2 +- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/package-lock.json b/package-lock.json index 114ef14a2..f37f8df97 100644 --- a/package-lock.json +++ b/package-lock.json @@ -39,7 +39,7 @@ "@typechain/hardhat": "^2.3.0", "@types/chai": "^4.3.1", "@types/mocha": "^9.1.1", - "@types/node": "^17.0.40", + "@types/node": "^17.0.41", "@typescript-eslint/eslint-plugin": "^4.31.2", "@typescript-eslint/parser": "^4.31.2", "chai-bn": "^0.3.1", @@ -4478,9 +4478,9 @@ "dev": true }, "node_modules/@types/node": { - "version": "17.0.40", - "resolved": "https://registry.npmjs.org/@types/node/-/node-17.0.40.tgz", - "integrity": "sha512-UXdBxNGqTMtm7hCwh9HtncFVLrXoqA3oJW30j6XWp5BH/wu3mVeaxo7cq5benFdBw34HB3XDT2TRPI7rXZ+mDg==" + "version": "17.0.41", + "resolved": "https://registry.npmjs.org/@types/node/-/node-17.0.41.tgz", + "integrity": "sha512-xA6drNNeqb5YyV5fO3OAEsnXLfO7uF0whiOfPTz5AeDo8KeZFmODKnvwPymMNO8qE/an8pVY/O50tig2SQCrGw==" }, "node_modules/@types/node-fetch": { "version": "2.6.1", @@ -32435,9 +32435,9 @@ "dev": true }, "@types/node": { - "version": "17.0.40", - "resolved": "https://registry.npmjs.org/@types/node/-/node-17.0.40.tgz", - "integrity": "sha512-UXdBxNGqTMtm7hCwh9HtncFVLrXoqA3oJW30j6XWp5BH/wu3mVeaxo7cq5benFdBw34HB3XDT2TRPI7rXZ+mDg==" + "version": "17.0.41", + "resolved": "https://registry.npmjs.org/@types/node/-/node-17.0.41.tgz", + "integrity": "sha512-xA6drNNeqb5YyV5fO3OAEsnXLfO7uF0whiOfPTz5AeDo8KeZFmODKnvwPymMNO8qE/an8pVY/O50tig2SQCrGw==" }, "@types/node-fetch": { "version": "2.6.1", diff --git a/package.json b/package.json index 621c1566a..7bad94abb 100644 --- a/package.json +++ b/package.json @@ -79,7 +79,7 @@ "@typechain/hardhat": "^2.3.0", "@types/chai": "^4.3.1", "@types/mocha": "^9.1.1", - "@types/node": "^17.0.40", + "@types/node": "^17.0.41", "@typescript-eslint/eslint-plugin": "^4.31.2", "@typescript-eslint/parser": "^4.31.2", "chai-bn": "^0.3.1", From c336506053b32ba8f1e901abe91285701ed7efd2 Mon Sep 17 00:00:00 2001 From: thomas-waite Date: Thu, 9 Jun 2022 15:09:27 +0100 Subject: [PATCH 269/274] refactor: migrate to new proposal template --- proposals/description/tokemak_withdraw.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/proposals/description/tokemak_withdraw.ts b/proposals/description/tokemak_withdraw.ts index c5c165066..0a8640f55 100644 --- a/proposals/description/tokemak_withdraw.ts +++ b/proposals/description/tokemak_withdraw.ts @@ -1,13 +1,13 @@ -import { ProposalDescription } from '@custom-types/types'; +import { TemplatedProposalDescription } from '@custom-types/types'; -const tokemak_withdraw: ProposalDescription = { +const tokemak_withdraw: TemplatedProposalDescription = { title: 'Withdraw from Tokemak', commands: [ { target: 'ethTokemakPCVDeposit', values: '0', method: 'requestWithdrawal(uint256)', - arguments: ['10000000000000000000000'], + arguments: (addresses) => ['10000000000000000000000'], description: 'Request to withdraw 10K WETH from Tokemak in the next cycle' } ], From 9aa198ffaf574642f6f9083514d2c87ed2e82531 Mon Sep 17 00:00:00 2001 From: Erwan Beauvois Date: Fri, 10 Jun 2022 17:08:42 +0200 Subject: [PATCH 270/274] Update block (10 june 2022) --- block.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/block.txt b/block.txt index e539c50d3..261f961d7 100644 --- a/block.txt +++ b/block.txt @@ -1 +1 @@ -14920337 +14939000 From fa452fc1aa8ed061610ed97bc09fc3058fc39798 Mon Sep 17 00:00:00 2001 From: Erwan Beauvois Date: Fri, 10 Jun 2022 17:39:33 +0200 Subject: [PATCH 271/274] clear proposalsConfig --- protocol-configuration/proposalsConfig.ts | 93 +---------------------- 1 file changed, 2 insertions(+), 91 deletions(-) diff --git a/protocol-configuration/proposalsConfig.ts b/protocol-configuration/proposalsConfig.ts index ec1a5e219..595a785d4 100644 --- a/protocol-configuration/proposalsConfig.ts +++ b/protocol-configuration/proposalsConfig.ts @@ -1,94 +1,5 @@ -import { ProposalCategory, TemplatedProposalsConfigMap } from '@custom-types/types'; -import repay_fuse_bad_debt from '@proposals/description/repay_fuse_bad_debt'; -import end_tribe_incentives from '@proposals/description/end_tribe_incentives'; -import tokemak_withdraw from '@proposals/description/tokemak_withdraw'; -import eth_lbp from '@proposals/description/eth_lbp'; -import fip_104b from '@proposals/description/fip_104b'; +import { TemplatedProposalsConfigMap } from '@custom-types/types'; -const proposals: TemplatedProposalsConfigMap = { - eth_lbp: { - deploy: false, // deploy flag for whether to run deploy action during e2e tests or use mainnet state - totalValue: 0, // amount of ETH to send to DAO execution - proposal: eth_lbp, // full proposal file, imported from '@proposals/description/fip_xx.ts' - proposalId: '', - affectedContractSignoff: [], - deprecatedContractSignoff: [], - category: ProposalCategory.TC - }, - repay_fuse_bad_debt: { - deploy: false, // deploy flag for whether to run deploy action during e2e tests or use mainnet state - totalValue: 0, // amount of ETH to send to DAO execution - proposal: repay_fuse_bad_debt, // full proposal file, imported from '@proposals/description/fip_xx.ts' - proposalId: '', - affectedContractSignoff: ['core', 'fuseFixer', 'pcvGuardianNew'], - deprecatedContractSignoff: [], - category: ProposalCategory.TC - }, - end_tribe_incentives: { - deploy: false, // deploy flag for whether to run deploy action during e2e tests or use mainnet state - totalValue: 0, // amount of ETH to send to DAO execution - proposal: end_tribe_incentives, // full proposal file, imported from '@proposals/description/fip_xx.ts' - proposalId: '', - affectedContractSignoff: [ - 'core', - 'tribalChief', - 'tribalCouncilTimelock', - 'collateralizationOracle', - 'opsOptimisticTimelock' - ], - deprecatedContractSignoff: [ - 'creamDepositWrapper', - 'fei3CrvAutoRewardsDistributor', - 'd3AutoRewardsDistributor', - 'autoRewardsDistributor', - 'feiDaiAutoRewardsDistributor', - 'feiUsdcAutoRewardsDistributor', - 'stakingTokenWrapperRari', - 'stakingTokenWrapperFOXLaaS', - 'stakingTokenWrapperGROLaaS', - 'stakingTokenWrapperKYLINLaaS', - 'stakingTokenWrapperMStableLaaS', - 'stakingTokenWrapperNEARLaaS', - 'stakingTokenWrapperPoolTogetherLaaS', - 'stakingTokenWrapperUMALaaS', - 'stakingTokenWrapperSYNLaaS', - 'rewardsDistributorAdmin', - 'stwBulkHarvest', - 'stakingTokenWrapperBribeD3pool', - 'fei3CrvStakingtokenWrapper', - 'feiDaiStakingTokenWrapper', - 'feiUsdcStakingTokenWrapper', - 'stakingTokenWrapperBribe3Crvpool', - 'tribalChiefSyncV2', - 'tribalChiefSyncExtension', - 'd3StakingTokenWrapper', - 'votiumBriberD3pool' - ], - category: ProposalCategory.TC - }, - fip_104b: { - deploy: false, // deploy flag for whether to run deploy action during e2e tests or use mainnet state - totalValue: 0, // amount of ETH to send to DAO execution - proposal: fip_104b, // full proposal file, imported from '@proposals/description/fip_xx.ts' - proposalId: '', - affectedContractSignoff: [ - 'dpiToDaiLBPSwapper', - 'compoundDaiPCVDeposit', - 'tribalCouncilSafe', - 'ratioPCVControllerV2' - ], - deprecatedContractSignoff: [], - category: ProposalCategory.DAO - }, - tokemak_withdraw: { - deploy: false, // deploy flag for whether to run deploy action during e2e tests or use mainnet state - totalValue: 0, // amount of ETH to send to DAO execution - proposal: tokemak_withdraw, // full proposal file, imported from '@proposals/description/fip_xx.ts' - proposalId: '', - affectedContractSignoff: ['ethTokemakPCVDeposit'], - deprecatedContractSignoff: [], - category: ProposalCategory.TC - } -}; +const proposals: TemplatedProposalsConfigMap = {}; export default proposals; From b20309ff8c63286994337e4531d993ee40a067b8 Mon Sep 17 00:00:00 2001 From: Erwan Beauvois Date: Fri, 10 Jun 2022 17:57:15 +0200 Subject: [PATCH 272/274] update protocol config to match unexecuted proposals --- .../collateralizationOracle.ts | 5 +- protocol-configuration/mainnetAddresses.ts | 4 +- test/integration/tests/fip-38-tokemak.ts | 121 --------------- test/integration/tests/tribeIncentivesEnd.ts | 140 ------------------ 4 files changed, 4 insertions(+), 266 deletions(-) delete mode 100644 test/integration/tests/fip-38-tokemak.ts delete mode 100644 test/integration/tests/tribeIncentivesEnd.ts diff --git a/protocol-configuration/collateralizationOracle.ts b/protocol-configuration/collateralizationOracle.ts index 4563a3f77..1f1ac50e3 100644 --- a/protocol-configuration/collateralizationOracle.ts +++ b/protocol-configuration/collateralizationOracle.ts @@ -13,7 +13,7 @@ const collateralizationAddresses: CollateralizationAddressType = { 'turboFusePCVDeposit' ], lusd: ['rariPool7LusdPCVDeposit', 'bammDeposit', 'lusdPSM'], - dai: ['compoundDaiPCVDepositWrapper', 'daiFixedPricePSM', 'dpiToDaiLensDai', 'ethToDaiLensDai'], + dai: ['compoundDaiPCVDepositWrapper', 'daiFixedPricePSM', 'dpiToDaiLensDai'], usd: ['namedStaticPCVDepositWrapper', 'd3poolCurvePCVDeposit', 'd3poolConvexPCVDeposit'], bal: ['balancerDepositBalWeth', 'balancerLensVeBalBal', 'balancerGaugeStaker'], weth: [ @@ -26,8 +26,7 @@ const collateralizationAddresses: CollateralizationAddressType = { 'wethDepositWrapper', 'balancerDepositFeiWeth', 'balancerLensBpt30Fei70Weth', - 'balancerLensVeBalWeth', - 'ethToDaiLensEth' + 'balancerLensVeBalWeth' ], dpi: ['dpiToDaiLensDpi'], rai: ['raiPriceBoundPSM'], diff --git a/protocol-configuration/mainnetAddresses.ts b/protocol-configuration/mainnetAddresses.ts index e6eb4f456..d82877d98 100644 --- a/protocol-configuration/mainnetAddresses.ts +++ b/protocol-configuration/mainnetAddresses.ts @@ -204,12 +204,12 @@ const MainnetContractsConfig: MainnetContractsConfig = { ethToDaiLensDai: { artifactName: 'BPTLens', address: '0xdF9Ff5c077d9F3427ade67AC2d27a864Be6F3187', - category: AddressCategory.PCV + category: AddressCategory.TBD }, ethToDaiLensEth: { artifactName: 'BPTLens', address: '0xf24401F6992FaEAcbc5d6C6991db15B5F8364A1B', - category: AddressCategory.PCV + category: AddressCategory.TBD }, ethToDaiLBPPool: { artifactName: 'IWeightedPool', diff --git a/test/integration/tests/fip-38-tokemak.ts b/test/integration/tests/fip-38-tokemak.ts deleted file mode 100644 index 01753442e..000000000 --- a/test/integration/tests/fip-38-tokemak.ts +++ /dev/null @@ -1,121 +0,0 @@ -import { NamedContracts } from '@custom-types/types'; -import proposals from '@protocol/proposalsConfig'; -import { getImpersonatedSigner, time } from '@test/helpers'; -import { TestEndtoEndCoordinator } from '@test/integration/setup'; -import { forceEth } from '@test/integration/setup/utils'; -import chai, { expect } from 'chai'; -import CBN from 'chai-bn'; -import { solidity } from 'ethereum-waffle'; -import { ethers } from 'hardhat'; -const toBN = ethers.BigNumber.from; -const tenPow18 = toBN('1000000000000000000'); - -const TOKEMAK_MANAGER_ROLLOVER_ADDRESS = '0x90b6C61B102eA260131aB48377E143D6EB3A9d4B'; // has the rollover role -const TOKEMAK_MANAGER_ADDRESS = '0xa86e412109f77c45a3bc1c5870b880492fb86a14'; // tokemak manager -const IPFS_JSON_FILE_HASH = 'QmP4Vzg45jExr3mcNsx9xxV1fNft95uVzgZGeLtkBXgpkx'; - -describe('e2e-fip-38-tokemak', function () { - let contracts: NamedContracts; - let deployAddress: string; - let e2eCoord: TestEndtoEndCoordinator; - let doLogging: boolean; - - before(async () => { - chai.use(CBN(ethers.BigNumber)); - chai.use(solidity); - }); - - before(async function () { - // Setup test environment and get contracts - const version = 1; - deployAddress = (await ethers.getSigners())[0].address; - if (!deployAddress) throw new Error(`No deploy address!`); - - doLogging = Boolean(process.env.LOGGING); - - const config = { - logging: doLogging, - deployAddress: deployAddress, - version: version - }; - - e2eCoord = new TestEndtoEndCoordinator(config, proposals); - - doLogging && console.log(`Loading environment...`); - ({ contracts } = await e2eCoord.loadEnvironment()); - doLogging && console.log(`Environment loaded.`); - }); - - it('should be able to withdraw ETH', async function () { - const { - ethTokemakPCVDeposit, - tWETH // Tokemak ETH reactor - } = contracts; - - // impersonate the rollover signer, and make the Tokemak pool go to next cycle - await forceEth(TOKEMAK_MANAGER_ROLLOVER_ADDRESS); - const tokemakRolloverSigner = await getImpersonatedSigner(TOKEMAK_MANAGER_ROLLOVER_ADDRESS); - const tokemakManagerAbi = [ - 'function nextCycleStartTime() view returns (uint256)', - 'function completeRollover(string calldata rewardsIpfsHash)' - ]; - const tokemakManager = new ethers.Contract(TOKEMAK_MANAGER_ADDRESS, tokemakManagerAbi, tokemakRolloverSigner); - const cycleEnd = await tokemakManager.nextCycleStartTime(); - await time.increaseTo(cycleEnd + 1); - await tokemakManager.completeRollover(IPFS_JSON_FILE_HASH); - - // Perform withdraw - await ethTokemakPCVDeposit.withdraw(ethTokemakPCVDeposit.address, tenPow18.mul(toBN(10_000))); - - // Should end with 0 tWETH, 10k ETH - expect((await tWETH.balanceOf(ethTokemakPCVDeposit.address)).toString()).to.be.equal(ethers.utils.parseEther('0')); - expect((await ethers.provider.getBalance(ethTokemakPCVDeposit.address)).toString()).to.be.equal( - ethers.utils.parseEther('10000') - ); - }); - - it('should be able to deposit and then withdraw ETH', async function () { - const { - ethTokemakPCVDeposit, - tWETH // Tokemak ETH reactor - } = contracts; - - // Starting state: 10k tETH, 0 WETH - // Want to transfer ETH, and deposit. Then verify deposit and then withdraw - const ethWhaleSigner = await getImpersonatedSigner('0x73BCEb1Cd57C711feaC4224D062b0F6ff338501e'); - await ethWhaleSigner.sendTransaction({ to: ethTokemakPCVDeposit.address, value: ethers.utils.parseEther('10000') }); - await ethTokemakPCVDeposit.deposit(); - - // Now has 20k tETH, 0k WETH - expect((await tWETH.balanceOf(ethTokemakPCVDeposit.address)).toString()).to.be.equal( - ethers.utils.parseEther('20000') - ); - expect((await ethers.provider.getBalance(ethTokemakPCVDeposit.address)).toString()).to.be.equal( - ethers.utils.parseEther('0') - ); - - // request to withdraw 20k ETH - await ethTokemakPCVDeposit.requestWithdrawal(tenPow18.mul(toBN(20_000))); - - // impersonate the rollover signer, and make the Tokemak pool go to next cycle - await forceEth(TOKEMAK_MANAGER_ROLLOVER_ADDRESS); - const tokemakRolloverSigner = await getImpersonatedSigner(TOKEMAK_MANAGER_ROLLOVER_ADDRESS); - const tokemakManagerAbi = [ - 'function nextCycleStartTime() view returns (uint256)', - 'function completeRollover(string calldata rewardsIpfsHash)' - ]; - const tokemakManager = new ethers.Contract(TOKEMAK_MANAGER_ADDRESS, tokemakManagerAbi, tokemakRolloverSigner); - const cycleEnd = await tokemakManager.nextCycleStartTime(); - await time.increaseTo(cycleEnd + 1); - await tokemakManager.completeRollover(IPFS_JSON_FILE_HASH); - - // Perform withdraw - await ethTokemakPCVDeposit.withdraw(ethTokemakPCVDeposit.address, tenPow18.mul(toBN(20_000))); - - // Should end with 0 tWETH, 10k ETH - expect((await tWETH.balanceOf(ethTokemakPCVDeposit.address)).toString()).to.be.equal(ethers.utils.parseEther('0')); - expect((await ethers.provider.getBalance(ethTokemakPCVDeposit.address)).toString()).to.be.equal( - ethers.utils.parseEther('20000') - ); - }); -}); diff --git a/test/integration/tests/tribeIncentivesEnd.ts b/test/integration/tests/tribeIncentivesEnd.ts deleted file mode 100644 index ea5c8ae74..000000000 --- a/test/integration/tests/tribeIncentivesEnd.ts +++ /dev/null @@ -1,140 +0,0 @@ -import { TribalChief, Tribe } from '@custom-types/contracts'; -import { NamedAddresses, NamedContracts } from '@custom-types/types'; -import { SignerWithAddress } from '@nomiclabs/hardhat-ethers/signers'; -import proposals from '@protocol/proposalsConfig'; -import { getImpersonatedSigner, resetFork, time } from '@test/helpers'; -import { forceEth } from '@test/integration/setup/utils'; -import chai, { expect } from 'chai'; -import CBN from 'chai-bn'; -import { solidity } from 'ethereum-waffle'; -import { ethers } from 'hardhat'; -import { TestEndtoEndCoordinator } from '../setup'; - -const toBN = ethers.BigNumber.from; -chai.use(CBN(ethers.BigNumber)); -chai.use(solidity); - -describe('e2e-end-tribe-incentives', function () { - let contracts: NamedContracts; - let contractAddresses: NamedAddresses; - let deployAddress: string; - let e2eCoord: TestEndtoEndCoordinator; - let doLogging: boolean; - let tribe: Tribe; - let tribalChief: TribalChief; - let curveLPStaker: SignerWithAddress; - - const receiver = '0xbEA4B2357e8ec53AF60BbcA4bc570332a7C7E232'; - const curvePoolId = 1; - const curve3Metapool = '0x06cb22615BA53E60D67Bf6C341a0fD5E718E1655'; - const curve3LPWhale = '0xdc69d4cb5b86388fff0b51885677e258883534ae'; - const pool8User = '0x9544A83A8cB74062c836AA11565d4BB4A54fe40D'; - - beforeEach(async function () { - await resetFork(); - - // Setup test environment and get contracts - const version = 1; - deployAddress = (await ethers.getSigners())[0].address; - if (!deployAddress) throw new Error(`No deploy address!`); - - doLogging = Boolean(process.env.LOGGING); - - const config = { - logging: doLogging, - deployAddress: deployAddress, - version: version - }; - - e2eCoord = new TestEndtoEndCoordinator(config, proposals); - - doLogging && console.log(`Loading environment...`); - ({ contracts, contractAddresses } = await e2eCoord.loadEnvironment()); - doLogging && console.log(`Environment loaded.`); - - tribe = contracts.tribe as Tribe; - tribalChief = contracts.tribalChief as TribalChief; - - curveLPStaker = await getImpersonatedSigner(curve3LPWhale); - await forceEth(curve3LPWhale); - }); - - it('should be able to harvest existing TRIBE rewards and withdraw principle from an LP pool', async () => { - const initialBalance = await tribe.balanceOf(receiver); - const curveLPToken = await ethers.getContractAt('ERC20', curve3Metapool); - - // Harvest already earnt TRIBE rewards - await tribalChief.connect(curveLPStaker).harvest(curvePoolId, receiver); - const finalBalance = await tribe.balanceOf(receiver); - const harvestedTribe = finalBalance.sub(initialBalance); - expect(harvestedTribe).to.be.bignumber.at.least(toBN(1)); - - // Withdraw principle from staked pool - const receiverBalanceBefore = await curveLPToken.balanceOf(receiver); - await tribalChief.connect(curveLPStaker).withdrawAllAndHarvest(curvePoolId, receiver); - const receiverBalanceAfter = await curveLPToken.balanceOf(receiver); - const withdrawnPrinciple = receiverBalanceAfter.sub(receiverBalanceBefore); - expect(withdrawnPrinciple).to.be.bignumber.at.least(toBN(1)); - }); - - it('should NOT be able to harvest future TRIBE rewards from an LP pool', async () => { - // Harvest, to zero out already earned rewards - const firstHarvestInitial = await tribe.balanceOf(receiver); - await tribalChief.connect(curveLPStaker).harvest(curvePoolId, receiver); - const firstHarvestFinal = await tribe.balanceOf(receiver); - expect(firstHarvestFinal.sub(firstHarvestInitial)).to.be.bignumber.greaterThan(toBN(1)); - - // Advance time, to check that rewards aren't accruing - await time.increase(86400); - - // Attempt to harvest again. As rewards have been stopped, it should not harvest any Tribe - const balanceBeforeHarvest = await tribe.balanceOf(receiver); - await tribalChief.connect(curveLPStaker).harvest(curvePoolId, receiver); - const balanceAfterHarvest = await tribe.balanceOf(receiver); - - const harvestedTribe = balanceAfterHarvest.sub(balanceBeforeHarvest); - expect(harvestedTribe).to.equal(0); - }); - - it('should be able to harvest existing TRIBE rewards from an AutoRewardDistributor in a Fuse pool', async () => { - const { rariRewardsDistributorDelegator, stakingTokenWrapperRari, tribe } = contracts; - - // 1. Harvest Rari staking token wrapper - const delegatorBalanceBeforeHarvest = await tribe.balanceOf(rariRewardsDistributorDelegator.address); - await stakingTokenWrapperRari.harvest(); - const delegatorBalanceAfterHarvest = await tribe.balanceOf(rariRewardsDistributorDelegator.address); - expect(delegatorBalanceAfterHarvest.sub(delegatorBalanceBeforeHarvest)).to.be.bignumber.at.least(toBN(1)); - - // 2. Market participant claims TRIBE rewards - const userBalanceBefore = await tribe.balanceOf(pool8User); - await rariRewardsDistributorDelegator['claimRewards(address)'](pool8User); - const userBalanceAfter = await tribe.balanceOf(pool8User); - const userHarvestedTribe = userBalanceAfter.sub(userBalanceBefore); - expect(userHarvestedTribe).to.be.bignumber.at.least(toBN(1)); - }); - - it('should NOT be able to harvest future TRIBE rewards from an AutoRewardDistributor in a Fuse pool', async () => { - const { rariRewardsDistributorDelegator, stakingTokenWrapperRari, tribe } = contracts; - - // 1. Harvest staking token wrapper to clear out all earned rewards. User also harvests their rewards - await stakingTokenWrapperRari.harvest(); - await rariRewardsDistributorDelegator['claimRewards(address)'](pool8User); - - // Fast forward time by a few blocks - await time.increase(86400 * 7); - - // 2. Attempt to harvest more rewards for ARD from Staking Token wrapper. Should harvest 0, as rewards have stopped - const ardBalanceBefore = await tribe.balanceOf(rariRewardsDistributorDelegator.address); - await stakingTokenWrapperRari.harvest(); - const ardBalanceAfter = await tribe.balanceOf(rariRewardsDistributorDelegator.address); - const ardHarvestedTribe = ardBalanceAfter.sub(ardBalanceBefore); - expect(ardHarvestedTribe).to.equal(0); - - // 3. Have user attempt to harvest TRIBE rewards, should harvest 0 TRIBE - const userBalanceBefore = await tribe.balanceOf(pool8User); - await rariRewardsDistributorDelegator['claimRewards(address)'](pool8User); - const userBalanceAfter = await tribe.balanceOf(pool8User); - const userHarvestedTribe = userBalanceAfter.sub(userBalanceBefore); - expect(userHarvestedTribe).to.equal(0); - }); -}); From a61264e4169644f20616434688707239b9f2c529 Mon Sep 17 00:00:00 2001 From: Erwan Beauvois Date: Fri, 10 Jun 2022 18:30:32 +0200 Subject: [PATCH 273/274] replace unexisting contract (mainnetAddresses updated) --- test/integration/tests/metagov/BalancerGaugeStaker.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/integration/tests/metagov/BalancerGaugeStaker.ts b/test/integration/tests/metagov/BalancerGaugeStaker.ts index d4fd44911..ebdc05e52 100644 --- a/test/integration/tests/metagov/BalancerGaugeStaker.ts +++ b/test/integration/tests/metagov/BalancerGaugeStaker.ts @@ -56,7 +56,7 @@ describe('e2e-metagov', function () { const lpTokenHolder = '0x4f9463405f5bc7b4c1304222c1df76efbd81a407'; const lpTokenSigner = await getImpersonatedSigner(lpTokenHolder); await forceEth(lpTokenHolder); - await contracts.balancerFeiWethPool.connect(lpTokenSigner).transfer(staker.address, `1000${e18}`); + await contracts.bpt30Fei70Weth.connect(lpTokenSigner).transfer(staker.address, `1000${e18}`); // also airdrop some BAL so that balance is not zero const balTokenHolder = '0xBA12222222228d8Ba445958a75a0704d566BF2C8'; From 28e5a056ba49404eb0a1307297452420cdf7e9ae Mon Sep 17 00:00:00 2001 From: Erwan Beauvois Date: Sat, 11 Jun 2022 16:25:30 +0200 Subject: [PATCH 274/274] fix balancergaugestaker test (missing await) --- test/integration/tests/metagov/BalancerGaugeStaker.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/integration/tests/metagov/BalancerGaugeStaker.ts b/test/integration/tests/metagov/BalancerGaugeStaker.ts index ebdc05e52..db60f65fd 100644 --- a/test/integration/tests/metagov/BalancerGaugeStaker.ts +++ b/test/integration/tests/metagov/BalancerGaugeStaker.ts @@ -154,7 +154,7 @@ describe('e2e-metagov', function () { it('should work if user has PCV_CONTROLLER_ROLE role', async function () { const balanceBefore = await contracts.bal.balanceOf(daoSigner.address); - expectEvent( + await expectEvent( staker.connect(daoSigner).withdrawERC20(contracts.bal.address, daoSigner.address, '10'), staker, 'WithdrawERC20',