import { DeployFunction } from "hardhat-deploy/types" ; import { HardhatRuntimeEnvironment } from "hardhat/types" ; import { MULTISIG_ADDRESS } from "../../utils/accounts" ; const func = async function ( hre ) { const { deployments , getNamedAccounts } = hre ; const { execute , deploy , get , getOrNull , log , read , save } = deployments ; const { deployer } = await getNamedAccounts ( ) ; const saddleWCUSDMetaPool = await getOrNull ( "SaddleWCUSDMetaPool" ) ; if ( saddleWCUSDMetaPool ) { log ( `reusing "SaddleWCUSDMetaPool" at ${ saddleWCUSDMetaPool . address }` ) ; } else { const TOKEN_ADDRESSES = [ ( await get ( "WCUSD" ) ) . address , ( await get ( "SaddleUSDPoolV2LPToken" ) ) . address , ] ; const TOKEN_DECIMALS = [ 18 , 18 ] ; const LP_TOKEN_NAME = "Saddle wCUSD/saddleUSD-V2" ; const LP_TOKEN_SYMBOL = "saddleWCUSD" ; const INITIAL_A = 100 ; const SWAP_FEE = 4e6 ; const ADMIN_FEE = 0 ; await deploy ( "SaddleWCUSDMetaPool" , { from : deployer , log : true , contract : "MetaSwap" , skipIfAlreadyDeployed : true , libraries : { SwapUtils : ( await get ( "SwapUtils" ) ) . address , MetaSwapUtils : ( await get ( "MetaSwapUtils" ) ) . address , AmplificationUtils : ( await get ( "AmplificationUtils" ) ) . address , } , } ) ; await execute ( "SaddleWCUSDMetaPool" , { from : deployer , log : true , } , "initializeMetaSwap" , TOKEN_ADDRESSES , TOKEN_DECIMALS , LP_TOKEN_NAME , LP_TOKEN_SYMBOL , INITIAL_A , SWAP_FEE , ADMIN_FEE , ( await get ( "LPToken" ) ) . address , ( await get ( "SaddleUSDPoolV2" ) ) . address ) ; await execute ( "SaddleWCUSDMetaPool" , { from : deployer , log : true } , "transferOwnership" , MULTISIG_ADDRESS ) ; } const lpTokenAddress = ( await read ( "SaddleWCUSDMetaPool" , "swapStorage" ) ) . lpToken ; log ( `Saddle wCUSD MetaSwap LP Token at ${ lpTokenAddress }` ) ; await save ( "SaddleWCUSDMetaPoolLPToken" , { abi : ( await get ( "LPToken" ) ) . abi , address : lpTokenAddress , } ) ; } ; export default func ; func . tags = [ "WCUSDMetaPool" ] ; func . dependencies = [ "WCUSDMetaPoolTokens" , "USDPoolV2" , "MetaSwapUtils" , "AmplificationUtils" , ] ;