import { providers } from "ethers" ; import { Address } from "../types" ; import DeployHelper from "../deploys" ; import { Signer } from "ethers" ; import { CurvePoolERC20 } from "../../typechain/CurvePoolERC20" ; import { Stableswap } from "../../typechain/Stableswap" ; import { CurveDeposit } from "../../typechain/CurveDeposit" ; import { CRVToken } from "../../typechain/CRVToken" ; import { GaugeController } from "../../typechain/GaugeController" ; import { Minter } from "../../typechain/Minter" ; import { LiquidityGaugeReward } from "../../typechain/LiquidityGaugeReward" ; import { LiquidityGauge } from "../../typechain/LiquidityGauge" ; import { ether } from "../common" ; export class CurveFixture { private _deployer : DeployHelper ; private _ownerSigner : Signer ; public poolToken : CurvePoolERC20 ; public stableSwap : Stableswap ; public deposit : CurveDeposit ; public crvToken : CRVToken ; public gaugeController : GaugeController ; public minter : Minter ; constructor ( provider , ownerAddress ) { this . _ownerSigner = provider . getSigner ( ownerAddress ) ; this . _deployer = new DeployHelper ( this . _ownerSigner ) ; } param _tokens public async initializePool ( _tokens ) { this . poolToken = await this . _deployer . external . deployCurvePoolERC20 ( "Curve.fi DAI/USDC/USDT/sUSD" , "crvUSD" , 18 , 0 ) ; this . stableSwap = await this . _deployer . external . deployStableswap ( _tokens , _tokens , this . poolToken . address ) ; this . deposit = await this . _deployer . external . deployCurveDeposit ( _tokens , _tokens , this . stableSwap . address , this . poolToken . address ) ; await this . poolToken . set_minter ( this . stableSwap . address ) ; } /**
     * Initializes contracts for staking LP tokens and generate CRV token.
     */ public async initializeDAO ( ) { this . crvToken = await this . _deployer . external . deployCrvToken ( "Curve DAO Token" , "CRV" ) ; this . gaugeController = await this . _deployer . external . deployGaugeController ( this . crvToken . address , this . crvToken . address ) ; await this . gaugeController [ "add_type(string,uint256)" ] ( "Liquidity" , ether ( 0.5 ) ) ; this . minter = await this . _deployer . external . deployMinter ( this . crvToken . address , this . gaugeController . address ) ; await this . crvToken . set_minter ( this . minter . address ) ; } /**
     * Initializes a gauge.
     */ public async initializeGauge ( _lpToken ) { const gauge = await this . _deployer . external . deployLiquidityGauge ( _lpToken , this . minter . address ) ; await this . gaugeController . functions [ "add_gauge(address,int128,uint256)" ] ( gauge . address , 0 , ether ( 1 ) ) ; return gauge ; } /**
     * Initializes a gauge with rewards for a LP token on external protocol contracts.
     */ public async initializeGaugeRewards ( _lpToken , _rewardContract , _rewardedToken ) { const gauge = await this . _deployer . external . deployLiquidityGaugeReward ( _lpToken , this . minter . address , _rewardContract , _rewardedToken ) ; await this . gaugeController [ "add_gauge(address,int128,uint256)" ] ( gauge . address , 0 , ether ( 1 ) ) ; return gauge ; } }