From e3edf08102837525f4b805be206120b9ee96510a Mon Sep 17 00:00:00 2001 From: Alex Towle Date: Mon, 30 Sep 2024 16:13:14 -0500 Subject: [PATCH] Added the deployment configurations --- hardhat.config.mainnet.ts | 4 + ...corn-sdai-91days.ts => corn-sdai-91day.ts} | 0 tasks/deploy/config/mainnet/index.ts | 4 +- .../mainnet/staking-usds-coordinator.ts | 15 ++++ .../config/mainnet/staking-usds-sky-182day.ts | 87 +++++++++++++++++++ 5 files changed, 109 insertions(+), 1 deletion(-) rename tasks/deploy/config/mainnet/{corn-sdai-91days.ts => corn-sdai-91day.ts} (100%) create mode 100644 tasks/deploy/config/mainnet/staking-usds-coordinator.ts create mode 100644 tasks/deploy/config/mainnet/staking-usds-sky-182day.ts diff --git a/hardhat.config.mainnet.ts b/hardhat.config.mainnet.ts index e8e29942e..cfd7cefb4 100644 --- a/hardhat.config.mainnet.ts +++ b/hardhat.config.mainnet.ts @@ -20,6 +20,8 @@ import { MAINNET_MORPHO_BLUE_WSTETH_USDA_182DAY, MAINNET_RETH_182DAY, MAINNET_RETH_COORDINATOR, + MAINNET_STAKING_USDS_COORDINATOR, + MAINNET_STAKING_USDS_SKY_182DAY, MAINNET_STUSD_182DAY, } from "./tasks/deploy/config/mainnet"; @@ -40,6 +42,7 @@ const config: HardhatUserConfig = { MAINNET_RETH_COORDINATOR, MAINNET_MORPHO_BLUE_COORDINATOR, MAINNET_CORN_COORDINATOR, + MAINNET_STAKING_USDS_COORDINATOR, ], instances: [ MAINNET_EZETH_182DAY, @@ -50,6 +53,7 @@ const config: HardhatUserConfig = { MAINNET_STUSD_182DAY, MAINNET_CORN_LBTC_91DAY, MAINNET_CORN_SDAI_91DAY, + MAINNET_STAKING_USDS_SKY_182DAY, ], checkpointRewarders: [], checkpointSubrewarders: [], diff --git a/tasks/deploy/config/mainnet/corn-sdai-91days.ts b/tasks/deploy/config/mainnet/corn-sdai-91day.ts similarity index 100% rename from tasks/deploy/config/mainnet/corn-sdai-91days.ts rename to tasks/deploy/config/mainnet/corn-sdai-91day.ts diff --git a/tasks/deploy/config/mainnet/index.ts b/tasks/deploy/config/mainnet/index.ts index 6dc9f7aba..cda1cb9bf 100644 --- a/tasks/deploy/config/mainnet/index.ts +++ b/tasks/deploy/config/mainnet/index.ts @@ -1,6 +1,6 @@ export * from "./corn-coordinator"; export * from "./corn-lbtc-91day"; -export * from "./corn-sdai-91days"; +export * from "./corn-sdai-91day"; export * from "./dai-182day"; export * from "./eeth-182day"; export * from "./eeth-coordinator"; @@ -15,6 +15,8 @@ export * from "./morpho-blue-wsteth-usda-182day"; export * from "./morpho-blue-wsteth-usdc-182day"; export * from "./reth-182day"; export * from "./reth-coordinator"; +export * from "./staking-usds-coordinator"; +export * from "./staking-usds-sky-182day"; export * from "./steth-182day"; export * from "./steth-coordinator"; export * from "./stusd-182day"; diff --git a/tasks/deploy/config/mainnet/staking-usds-coordinator.ts b/tasks/deploy/config/mainnet/staking-usds-coordinator.ts new file mode 100644 index 000000000..c33aa3eb5 --- /dev/null +++ b/tasks/deploy/config/mainnet/staking-usds-coordinator.ts @@ -0,0 +1,15 @@ +import { HyperdriveCoordinatorConfig } from "../../lib"; +import { MAINNET_FACTORY_NAME } from "./factory"; + +export const MAINNET_STAKING_USDS_COORDINATOR_NAME = + "ElementDAO Staking USDS Hyperdrive Deployer Coordinator"; +export const MAINNET_STAKING_USDS_COORDINATOR: HyperdriveCoordinatorConfig<"StakingUSDS"> = + { + name: MAINNET_STAKING_USDS_COORDINATOR_NAME, + prefix: "StakingUSDS", + targetCount: 5, + extraConstructorArgs: [], + factoryAddress: async (hre) => + hre.hyperdriveDeploy.deployments.byName(MAINNET_FACTORY_NAME) + .address, + }; diff --git a/tasks/deploy/config/mainnet/staking-usds-sky-182day.ts b/tasks/deploy/config/mainnet/staking-usds-sky-182day.ts new file mode 100644 index 000000000..e322f76db --- /dev/null +++ b/tasks/deploy/config/mainnet/staking-usds-sky-182day.ts @@ -0,0 +1,87 @@ +import { Address, keccak256, parseEther, toBytes, zeroAddress } from "viem"; +import { + HyperdriveInstanceConfig, + getLinkerDetails, + normalizeFee, + parseDuration, + toBytes32, +} from "../../lib"; +import { SIX_MONTHS, USDS_ADDRESS_MAINNET } from "../../lib/constants"; +import { MAINNET_FACTORY_NAME } from "./factory"; +import { MAINNET_STAKING_USDS_COORDINATOR_NAME } from "./staking-usds-coordinator"; + +// The name of the pool. +export const MAINNET_STAKING_USDS_SKY_182DAY_NAME = + "ElementDAO 182 Day Staking USDS Sky Hyperdrive"; + +const CONTRIBUTION = parseEther("100"); // 100e18 + +export const MAINNET_STAKING_USDS_SKY_182DAY: HyperdriveInstanceConfig<"StakingUSDS"> = + { + name: MAINNET_STAKING_USDS_SKY_182DAY_NAME, + prefix: "StakingUSDS", + coordinatorAddress: async (hre) => + hre.hyperdriveDeploy.deployments.byName( + MAINNET_STAKING_USDS_COORDINATOR_NAME, + ).address, + deploymentId: keccak256(toBytes(MAINNET_STAKING_USDS_SKY_182DAY_NAME)), + salt: toBytes32("0x69420"), + extraData: "0x", + contribution: CONTRIBUTION, + fixedAPR: parseEther("0.085"), + timestretchAPR: parseEther("0.05"), + options: async (hre) => ({ + extraData: "0x", + asBase: true, + destination: (await hre.getNamedAccounts())["deployer"] as Address, + }), + // Prepare to deploy the contract by setting approvals. + prepare: async (hre) => { + let baseToken = await hre.viem.getContractAt( + "contracts/src/interfaces/IERC20.sol:IERC20", + USDS_ADDRESS_MAINNET, + ); + let tx = await baseToken.write.approve([ + hre.hyperdriveDeploy.deployments.byName( + MAINNET_STAKING_USDS_COORDINATOR_NAME, + ).address, + CONTRIBUTION, + ]); + let pc = await hre.viem.getPublicClient(); + await pc.waitForTransactionReceipt({ hash: tx }); + }, + poolDeployConfig: async (hre) => { + let factoryContract = await hre.viem.getContractAt( + "HyperdriveFactory", + hre.hyperdriveDeploy.deployments.byName(MAINNET_FACTORY_NAME) + .address, + ); + return { + baseToken: USDS_ADDRESS_MAINNET, + vaultSharesToken: zeroAddress, + circuitBreakerDelta: parseEther("0.05"), + minimumShareReserves: parseEther("0.001"), // 1e15 + minimumTransactionAmount: parseEther("0.001"), // 1e15 + positionDuration: parseDuration(SIX_MONTHS), + checkpointDuration: parseDuration("1 day"), + timeStretch: 0n, + governance: await factoryContract.read.hyperdriveGovernance(), + feeCollector: await factoryContract.read.feeCollector(), + sweepCollector: await factoryContract.read.sweepCollector(), + checkpointRewarder: + await factoryContract.read.checkpointRewarder(), + ...(await getLinkerDetails( + hre, + hre.hyperdriveDeploy.deployments.byName( + MAINNET_FACTORY_NAME, + ).address, + )), + fees: { + curve: parseEther("0.01"), + flat: normalizeFee(parseEther("0.0005"), SIX_MONTHS), + governanceLP: parseEther("0.15"), + governanceZombie: parseEther("0.03"), + }, + }; + }, + };