import { Signer } from "ethers" ; import { AaveLeverageModule , AirdropModule , AmmModule , BasicIssuanceModule , ClaimModule , CompoundLeverageModule , CustomOracleNavIssuanceModule , DebtIssuanceModule , GeneralIndexModule , GovernanceModule , IssuanceModule , NavIssuanceModule , PerpV2LeverageModule , SingleIndexModule , SlippageIssuanceModule , StakingModule , StreamingFeeModule , TradeModule , WrapModule , WrapModuleV2 } from "../contracts" ; import { Address } from "../types" ; import { AaveLeverageModule__factory } from "../../typechain/factories/AaveLeverageModule__factory" ; import { AirdropModule__factory } from "../../typechain/factories/AirdropModule__factory" ; import { AmmModule__factory } from "../../typechain/factories/AmmModule__factory" ; import { BasicIssuanceModule__factory } from "../../typechain/factories/BasicIssuanceModule__factory" ; import { ClaimModule__factory } from "../../typechain/factories/ClaimModule__factory" ; import { CompoundLeverageModule__factory } from "../../typechain/factories/CompoundLeverageModule__factory" ; import { CustomOracleNavIssuanceModule__factory } from "../../typechain/factories/CustomOracleNavIssuanceModule__factory" ; import { DebtIssuanceModule__factory } from "../../typechain/factories/DebtIssuanceModule__factory" ; import { DebtIssuanceModuleV2__factory } from "../../typechain/factories/DebtIssuanceModuleV2__factory" ; import { SlippageIssuanceModule__factory } from "../../typechain/factories/SlippageIssuanceModule__factory" ; import { GeneralIndexModule__factory } from "../../typechain/factories/GeneralIndexModule__factory" ; import { GovernanceModule__factory } from "../../typechain/factories/GovernanceModule__factory" ; import { IssuanceModule__factory } from "../../typechain/factories/IssuanceModule__factory" ; import { NavIssuanceModule__factory } from "../../typechain/factories/NavIssuanceModule__factory" ; import { PerpV2LeverageModule__factory } from "../../typechain/factories/PerpV2LeverageModule__factory" ; import { SingleIndexModule__factory } from "../../typechain/factories/SingleIndexModule__factory" ; import { StakingModule__factory } from "../../typechain/factories/StakingModule__factory" ; import { StreamingFeeModule__factory } from "../../typechain/factories/StreamingFeeModule__factory" ; import { TradeModule__factory } from "../../typechain/factories/TradeModule__factory" ; import { WrapModule__factory } from "../../typechain/factories/WrapModule__factory" ; import { WrapModuleV2__factory } from "../../typechain/factories/WrapModuleV2__factory" ; export default class DeployModules { private _deployerSigner : Signer ; constructor ( deployerSigner ) { this . _deployerSigner = deployerSigner ; } public async deployBasicIssuanceModule ( controller ) { return await new BasicIssuanceModule__factory ( this . _deployerSigner ) . deploy ( controller ) ; } public async deployIssuanceModule ( controller ) { return await new IssuanceModule__factory ( this . _deployerSigner ) . deploy ( controller ) ; } public async deployDebtIssuanceModule ( controller ) { return await new DebtIssuanceModule__factory ( this . _deployerSigner ) . deploy ( controller ) ; } public async deployDebtIssuanceModuleV2 ( controller ) { return await new DebtIssuanceModuleV2__factory ( this . _deployerSigner ) . deploy ( controller ) ; } public async deploySlippageIssuanceModule ( controller ) { return await new SlippageIssuanceModule__factory ( this . _deployerSigner ) . deploy ( controller ) ; } public async deployAmmModule ( controller ) { return await new AmmModule__factory ( this . _deployerSigner ) . deploy ( controller ) ; } public async getBasicIssuanceModule ( basicIssuanceModule ) { return await new BasicIssuanceModule__factory ( this . _deployerSigner ) . attach ( basicIssuanceModule ) ; } public async deployStreamingFeeModule ( controller ) { return await new StreamingFeeModule__factory ( this . _deployerSigner ) . deploy ( controller ) ; } public async getStreamingFeeModule ( streamingFeeModule ) { return await new StreamingFeeModule__factory ( this . _deployerSigner ) . attach ( streamingFeeModule ) ; } public async deployAirdropModule ( controller ) { return await new AirdropModule__factory ( this . _deployerSigner ) . deploy ( controller ) ; } public async deployNavIssuanceModule ( controller , weth ) { return await new NavIssuanceModule__factory ( this . _deployerSigner ) . deploy ( controller , weth ) ; } public async deployTradeModule ( controller ) { return await new TradeModule__factory ( this . _deployerSigner ) . deploy ( controller ) ; } public async deployWrapModule ( controller , weth ) { return await new WrapModule__factory ( this . _deployerSigner ) . deploy ( controller , weth ) ; } public async deployClaimModule ( controller ) { return await new ClaimModule__factory ( this . _deployerSigner ) . deploy ( controller ) ; } public async deployStakingModule ( controller ) { return await new StakingModule__factory ( this . _deployerSigner ) . deploy ( controller ) ; } public async deployCustomOracleNavIssuanceModule ( controller , weth ) { return await new CustomOracleNavIssuanceModule__factory ( this . _deployerSigner ) . deploy ( controller , weth ) ; } public async getNavIssuanceModule ( navIssuanceModule ) { return await new NavIssuanceModule__factory ( this . _deployerSigner ) . attach ( navIssuanceModule ) ; } public async deploySingleIndexModule ( controller , weth , uniswapRouter , sushiswapRouter , balancerProxy ) { return await new SingleIndexModule__factory ( this . _deployerSigner ) . deploy ( controller , weth , uniswapRouter , sushiswapRouter , balancerProxy ) ; } public async deployGeneralIndexModule ( controller , weth ) { return await new GeneralIndexModule__factory ( this . _deployerSigner ) . deploy ( controller , weth ) ; } public async deployGovernanceModule ( controller ) { return await new GovernanceModule__factory ( this . _deployerSigner ) . deploy ( controller ) ; } public async deployCompoundLeverageModule ( controller , compToken , comptroller , cEth , weth , libraryName , libraryAddress ) { return await new CompoundLeverageModule__factory ( { [ libraryName ] : libraryAddress , } , this . _deployerSigner ) . deploy ( controller , compToken , comptroller , cEth , weth ) ; } public async deployAaveLeverageModule ( controller , lendingPoolAddressesProvider , libraryName , libraryAddress ) { return await new AaveLeverageModule__factory ( { [ libraryName ] : libraryAddress , } , this . _deployerSigner ) . deploy ( controller , lendingPoolAddressesProvider ) ; } public async deployWrapModuleV2 ( controller , weth ) { return await new WrapModuleV2__factory ( this . _deployerSigner ) . deploy ( controller , weth ) ; } public async deployPerpV2LeverageModule ( controller , perpVault , perpQuoter , perpMarketRegistry , libraryName , libraryAddress ) { return await new PerpV2LeverageModule__factory ( { [ libraryName ] : libraryAddress , } , this . _deployerSigner ) . deploy ( controller , perpVault , perpQuoter , perpMarketRegistry ) ; } }