|
| 1 | +import '@nomiclabs/hardhat-ethers'; |
| 2 | +import { task } from 'hardhat/config'; |
| 3 | +import { HardhatRuntimeEnvironment } from 'hardhat/types'; |
| 4 | +import { deployWithVerify } from '../../helpers/utils'; |
| 5 | +import { ERC4626FeeCollectModule__factory, LensHub__factory } from '../../../typechain'; |
| 6 | + |
| 7 | +export let runtimeHRE: HardhatRuntimeEnvironment; |
| 8 | + |
| 9 | +task( |
| 10 | + 'deploy-ERC4626-fee-collect-module', |
| 11 | + 'Deploys, verifies and whitelists the ERC4626 fee collect module' |
| 12 | +) |
| 13 | + .addParam('hub') |
| 14 | + .addParam('globals') |
| 15 | + .setAction(async ({ hub, globals }, hre) => { |
| 16 | + runtimeHRE = hre; |
| 17 | + const ethers = hre.ethers; |
| 18 | + const accounts = await ethers.getSigners(); |
| 19 | + const deployer = accounts[0]; |
| 20 | + const governance = accounts[1]; |
| 21 | + |
| 22 | + console.log('\n\n- - - - - - - - Deploying ERC4626 fee collect module\n\n'); |
| 23 | + const erc4626FeeCollectModule = await deployWithVerify( |
| 24 | + new ERC4626FeeCollectModule__factory(deployer).deploy(hub, globals), |
| 25 | + [hub, globals], |
| 26 | + 'contracts/collect/ERC4626FeeCollectModule.sol:ERC4626FeeCollectModule' |
| 27 | + ); |
| 28 | + |
| 29 | + if (process.env.HARDHAT_NETWORK !== 'matic') { |
| 30 | + console.log('\n\n- - - - - - - - Whitelisting ERC4626 fee collect module\n\n'); |
| 31 | + await LensHub__factory.connect(hub, governance).whitelistCollectModule( |
| 32 | + erc4626FeeCollectModule.address, |
| 33 | + true |
| 34 | + ); |
| 35 | + } |
| 36 | + }); |
0 commit comments