|
| 1 | +import { |
| 2 | + Address, |
| 3 | + encodeAbiParameters, |
| 4 | + keccak256, |
| 5 | + parseAbiParameters, |
| 6 | + parseEther, |
| 7 | + toBytes, |
| 8 | + zeroAddress, |
| 9 | +} from "viem"; |
| 10 | +import { |
| 11 | + HyperdriveInstanceConfig, |
| 12 | + getLinkerDetails, |
| 13 | + normalizeFee, |
| 14 | + parseDuration, |
| 15 | + toBytes32, |
| 16 | +} from "../../lib"; |
| 17 | +import { |
| 18 | + CHAINLINK_AGGREGATOR_WSTETH_ETH_PROXY_GNOSIS, |
| 19 | + SIX_MONTHS, |
| 20 | + WSTETH_ADDRESS_GNOSIS, |
| 21 | +} from "../../lib/constants"; |
| 22 | +import { GNOSIS_CHAINLINK_COORDINATOR_NAME } from "./chainlink-coordinator"; |
| 23 | +import { GNOSIS_FACTORY_NAME } from "./factory"; |
| 24 | + |
| 25 | +// The name of the pool. |
| 26 | +export const GNOSIS_WSTETH_182DAY_NAME = "ElementDAO 182 Day wstETH Hyperdrive"; |
| 27 | + |
| 28 | +// The initial contribution of the pool. |
| 29 | +const CONTRIBUTION = parseEther("0.01"); |
| 30 | + |
| 31 | +export const GNOSIS_WSTETH_182DAY: HyperdriveInstanceConfig<"Chainlink"> = { |
| 32 | + name: GNOSIS_WSTETH_182DAY_NAME, |
| 33 | + prefix: "Chainlink", |
| 34 | + coordinatorAddress: async (hre) => |
| 35 | + hre.hyperdriveDeploy.deployments.byName( |
| 36 | + GNOSIS_CHAINLINK_COORDINATOR_NAME, |
| 37 | + ).address, |
| 38 | + deploymentId: keccak256(toBytes(GNOSIS_WSTETH_182DAY_NAME)), |
| 39 | + salt: toBytes32("0xababe"), |
| 40 | + extraData: encodeAbiParameters(parseAbiParameters("address, uint8"), [ |
| 41 | + CHAINLINK_AGGREGATOR_WSTETH_ETH_PROXY_GNOSIS, |
| 42 | + 18, |
| 43 | + ]), |
| 44 | + contribution: CONTRIBUTION, |
| 45 | + fixedAPR: parseEther("0.029"), |
| 46 | + timestretchAPR: parseEther("0.035"), |
| 47 | + options: async (hre) => ({ |
| 48 | + extraData: encodeAbiParameters(parseAbiParameters("address, uint8"), [ |
| 49 | + CHAINLINK_AGGREGATOR_WSTETH_ETH_PROXY_GNOSIS, |
| 50 | + 18, |
| 51 | + ]), |
| 52 | + asBase: false, |
| 53 | + destination: (await hre.getNamedAccounts())["deployer"] as Address, |
| 54 | + }), |
| 55 | + // Prepare to deploy the contract by setting approvals. |
| 56 | + prepare: async (hre) => { |
| 57 | + let vaultSharesToken = await hre.viem.getContractAt( |
| 58 | + "contracts/src/interfaces/IERC20.sol:IERC20", |
| 59 | + WSTETH_ADDRESS_GNOSIS, |
| 60 | + ); |
| 61 | + let tx = await vaultSharesToken.write.approve([ |
| 62 | + hre.hyperdriveDeploy.deployments.byName( |
| 63 | + GNOSIS_CHAINLINK_COORDINATOR_NAME, |
| 64 | + ).address, |
| 65 | + CONTRIBUTION, |
| 66 | + ]); |
| 67 | + let pc = await hre.viem.getPublicClient(); |
| 68 | + await pc.waitForTransactionReceipt({ hash: tx }); |
| 69 | + }, |
| 70 | + poolDeployConfig: async (hre) => { |
| 71 | + return { |
| 72 | + baseToken: zeroAddress, |
| 73 | + vaultSharesToken: WSTETH_ADDRESS_GNOSIS, |
| 74 | + circuitBreakerDelta: parseEther("0.035"), |
| 75 | + minimumShareReserves: parseEther("0.001"), |
| 76 | + minimumTransactionAmount: parseEther("0.001"), |
| 77 | + positionDuration: parseDuration(SIX_MONTHS), |
| 78 | + checkpointDuration: parseDuration("1 day"), |
| 79 | + timeStretch: 0n, |
| 80 | + // TODO: Read from the factory. |
| 81 | + governance: (await hre.getNamedAccounts())["deployer"] as Address, |
| 82 | + feeCollector: zeroAddress, |
| 83 | + sweepCollector: zeroAddress, |
| 84 | + checkpointRewarder: zeroAddress, |
| 85 | + ...(await getLinkerDetails( |
| 86 | + hre, |
| 87 | + hre.hyperdriveDeploy.deployments.byName(GNOSIS_FACTORY_NAME) |
| 88 | + .address, |
| 89 | + )), |
| 90 | + fees: { |
| 91 | + curve: parseEther("0.01"), |
| 92 | + flat: normalizeFee(parseEther("0.0005"), SIX_MONTHS), |
| 93 | + governanceLP: parseEther("0.15"), |
| 94 | + governanceZombie: parseEther("0.03"), |
| 95 | + }, |
| 96 | + }; |
| 97 | + }, |
| 98 | +}; |
0 commit comments