Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

morpho blue sepolia config + generic library resolution/deployment #1113

Merged
merged 10 commits into from
Jul 24, 2024
102 changes: 101 additions & 1 deletion deployments.json
Original file line number Diff line number Diff line change
Expand Up @@ -374,6 +374,106 @@
"contract": "StETHHyperdrive",
"address": "0x51C054F75b2c4b53E8E5114430C3ded4572473D8",
"timestamp": "2024-06-19T02:08:03.413Z"
},
"MORPHO_BLUE_COORDINATOR_MorphoBlueHyperdriveCoreDeployer": {
"contract": "MorphoBlueHyperdriveCoreDeployer",
"address": "0x942de6161dce6b216eab2b0fb07a4cab01e75b25",
"timestamp": "2024-07-19T22:01:41.154Z"
},
"MorphoBlueConversions": {
"contract": "MorphoBlueConversions",
"address": "0xcdb48bb065c12aea6aa7693b718fc2d1d8e95d36",
"timestamp": "2024-07-19T22:01:50.043Z"
},
"MORPHO_BLUE_COORDINATOR_MorphoBlueTarget0Deployer": {
"contract": "MorphoBlueTarget0Deployer",
"address": "0x340b785817ba1180a9b89eace04552dbd5a17f26",
"timestamp": "2024-07-19T22:02:03.051Z"
},
"MORPHO_BLUE_COORDINATOR_MorphoBlueTarget1Deployer": {
"contract": "MorphoBlueTarget1Deployer",
"address": "0x6b2e8de070c4aaa9abbb6153daceeb4ef5a7408d",
"timestamp": "2024-07-19T22:02:16.149Z"
},
"MORPHO_BLUE_COORDINATOR_MorphoBlueTarget2Deployer": {
"contract": "MorphoBlueTarget2Deployer",
"address": "0x7111675bed3a26025cc01b1fb780a0bd0aeda52a",
"timestamp": "2024-07-19T22:02:37.230Z"
},
"MORPHO_BLUE_COORDINATOR_MorphoBlueTarget3Deployer": {
"contract": "MorphoBlueTarget3Deployer",
"address": "0xe98e41c06764cc7338a3a2c32785666c4e4cb2eb",
"timestamp": "2024-07-19T22:02:50.227Z"
},
"MORPHO_BLUE_COORDINATOR_MorphoBlueTarget4Deployer": {
"contract": "MorphoBlueTarget4Deployer",
"address": "0x2e1f6df541c57c5f87e29af81be30de07182247e",
"timestamp": "2024-07-19T22:03:03.133Z"
},
"MORPHO_BLUE_COORDINATOR": {
"contract": "MorphoBlueHyperdriveDeployerCoordinator",
"address": "0xb8f9876f10524c7b5cbdbbfac0409a77a518d876",
"timestamp": "2024-07-19T22:03:16.138Z"
},
"MORPHO_BLUE_DAI_14_DAY_MorphoBlueTarget0": {
"contract": "MorphoBlueTarget0",
"address": "0x90598C248110CB0bf413883751392E5B97e22D49",
"timestamp": "2024-07-19T22:06:03.670Z"
},
"MORPHO_BLUE_DAI_14_DAY_MorphoBlueTarget1": {
"contract": "MorphoBlueTarget1",
"address": "0x29A09380BE010f9b4321cd09B640Fc2390c23754",
"timestamp": "2024-07-19T22:05:15.590Z"
},
"MORPHO_BLUE_DAI_14_DAY_MorphoBlueTarget2": {
"contract": "MorphoBlueTarget2",
"address": "0x2C1100Be8d1a00731feE91bb2672f3f9a9f52Acb",
"timestamp": "2024-07-19T22:05:28.618Z"
},
"MORPHO_BLUE_DAI_14_DAY_MorphoBlueTarget3": {
"contract": "MorphoBlueTarget3",
"address": "0xB2A1F3703ba511dCCF12445f161397eD7c437252",
"timestamp": "2024-07-19T22:05:37.484Z"
},
"MORPHO_BLUE_DAI_14_DAY_MorphoBlueTarget4": {
"contract": "MorphoBlueTarget4",
"address": "0xf17392948E48C45bd6664db0AEe397FB80C4A9F4",
"timestamp": "2024-07-19T22:05:50.558Z"
},
"MORPHO_BLUE_DAI_14_DAY": {
"contract": "MorphoBlueHyperdrive",
"address": "0xE352F4D16C7Ee4162d1aa54b77A15d4DA8f35f4b",
"timestamp": "2024-07-19T22:06:03.574Z"
},
"MORPHO_BLUE_DAI_30_DAY_MorphoBlueTarget0": {
"contract": "MorphoBlueTarget0",
"address": "0x7f90dc0Dd4258FeBA19122F8B24CF398d938F762",
"timestamp": "2024-07-19T22:08:12.937Z"
},
"MORPHO_BLUE_DAI_30_DAY_MorphoBlueTarget1": {
"contract": "MorphoBlueTarget1",
"address": "0xa95a24160b29925035c0e76c34caA1C177bbbA9D",
"timestamp": "2024-07-19T22:06:52.218Z"
},
"MORPHO_BLUE_DAI_30_DAY_MorphoBlueTarget2": {
"contract": "MorphoBlueTarget2",
"address": "0x63f5084182194E3C7477E6041681Ee75661a3fb6",
"timestamp": "2024-07-19T22:07:25.542Z"
},
"MORPHO_BLUE_DAI_30_DAY_MorphoBlueTarget3": {
"contract": "MorphoBlueTarget3",
"address": "0xB160a49c99c8e579F761b20654Ef6B490E32C3BB",
"timestamp": "2024-07-19T22:07:38.596Z"
},
"MORPHO_BLUE_DAI_30_DAY_MorphoBlueTarget4": {
"contract": "MorphoBlueTarget4",
"address": "0x6511a69918DAe90aFf82994B952C97c6FffEE0c9",
"timestamp": "2024-07-19T22:07:51.696Z"
},
"MORPHO_BLUE_DAI_30_DAY": {
"contract": "MorphoBlueHyperdrive",
"address": "0x82089FDfdbDEB89F208fEc03C1cA5122D6862bDc",
"timestamp": "2024-07-19T22:08:12.841Z"
}
},
"mainnet": {
Expand Down Expand Up @@ -638,4 +738,4 @@
"timestamp": "2024-07-16T23:41:53.768Z"
}
}
}
}
1 change: 1 addition & 0 deletions foundry.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ cache_path = 'forge-cache'
remappings = [
'aave=lib/aave-v3-core/contracts',
'forge-std=lib/forge-std/src',
'morpho-blue=lib/morpho-blue',
'nomad=lib/ExcessivelySafeCall/src',
'openzeppelin=lib/openzeppelin-contracts/contracts',
'solmate=lib/solmate/src',
Expand Down
8 changes: 6 additions & 2 deletions hardhat.config.sepolia.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ import {
SEPOLIA_EZETH_30DAY,
SEPOLIA_EZETH_COORDINATOR,
SEPOLIA_FACTORY,
SEPOLIA_MORPHO_BLUE_COORDINATOR,
SEPOLIA_MORPHO_BLUE_DAI_14DAY,
SEPOLIA_MORPHO_BLUE_DAI_30DAY,
SEPOLIA_RETH_14DAY,
SEPOLIA_RETH_30DAY,
SEPOLIA_RETH_COORDINATOR,
Expand Down Expand Up @@ -51,18 +54,19 @@ const config: HardhatUserConfig = {
SEPOLIA_STETH_COORDINATOR,
SEPOLIA_RETH_COORDINATOR,
SEPOLIA_EZETH_COORDINATOR,
SEPOLIA_MORPHO_BLUE_COORDINATOR,
],
instances: [
SEPOLIA_DAI_14DAY,
SEPOLIA_DAI_30DAY,
SEPOLIA_EZETH_14DAY,
SEPOLIA_EZETH_30DAY,
// SEPOLIA_MORPHO_DAI_14DAY,
// SEPOLIA_MORPHO_DAI_30DAY,
SEPOLIA_RETH_14DAY,
SEPOLIA_RETH_30DAY,
SEPOLIA_STETH_14DAY,
SEPOLIA_STETH_30DAY,
SEPOLIA_MORPHO_BLUE_DAI_14DAY,
SEPOLIA_MORPHO_BLUE_DAI_30DAY,
],
},
},
Expand Down
4 changes: 4 additions & 0 deletions hardhat.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ import {
SEPOLIA_EZETH_30DAY,
SEPOLIA_EZETH_COORDINATOR,
SEPOLIA_FACTORY,
SEPOLIA_MORPHO_BLUE_COORDINATOR,
SEPOLIA_MORPHO_BLUE_DAI_14DAY,
SEPOLIA_RETH_14DAY,
SEPOLIA_RETH_30DAY,
SEPOLIA_RETH_COORDINATOR,
Expand Down Expand Up @@ -70,6 +72,7 @@ const config: HardhatUserConfig = {
SEPOLIA_STETH_COORDINATOR,
SEPOLIA_RETH_COORDINATOR,
SEPOLIA_EZETH_COORDINATOR,
SEPOLIA_MORPHO_BLUE_COORDINATOR,
],
instances: [
SEPOLIA_DAI_14DAY,
Expand All @@ -80,6 +83,7 @@ const config: HardhatUserConfig = {
SEPOLIA_RETH_30DAY,
SEPOLIA_STETH_14DAY,
SEPOLIA_STETH_30DAY,
SEPOLIA_MORPHO_BLUE_DAI_14DAY,
jalextowle marked this conversation as resolved.
Show resolved Hide resolved
],
},
},
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
"@nomicfoundation/hardhat-network-helpers": "^1.0.0",
"@nomicfoundation/hardhat-toolbox-viem": "^3.0.0",
"@nomicfoundation/hardhat-verify": "^2.0.0",
"@nomicfoundation/hardhat-viem": "^2.0.1",
"@nomicfoundation/hardhat-viem": "^2.0.3",
"@nomicfoundation/ignition-core": "^0.15.1",
"@typechain/ethers-v6": "^0.5.1",
"@typechain/hardhat": "^9.1.0",
Expand Down
10 changes: 8 additions & 2 deletions scripts/deploy.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#!/bin/sh

set -e

# Ensure that the network variable is defined
if [[ -z "${NETWORK}" ]]; then
echo 'Error: $NETWORK must be set'
Expand All @@ -20,5 +22,9 @@ if [[ "${NETWORK}" != "anvil" && "${NETWORK}" != "hardhat" && "${NETWORK}" != "m
fi
fi

npx hardhat deploy:hyperdrive --show-stack-traces --network ${NETWORK} --config hardhat.config.${NETWORK}.ts
npx hardhat deploy:verify --show-stack-traces --network ${NETWORK} --config hardhat.config.${NETWORK}.ts
config_filename="hardhat.config.${NETWORK}.ts"
if [[ "${NETWORK}" == "hardhat" ]]; then
config_filename="hardhat.config.ts"
jalextowle marked this conversation as resolved.
Show resolved Hide resolved
fi
npx hardhat deploy:hyperdrive --show-stack-traces --network ${NETWORK} --config "$config_filename"
npx hardhat deploy:verify --show-stack-traces --network ${NETWORK} --config "$config_filename"
3 changes: 3 additions & 0 deletions tasks/deploy/config/sepolia/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ export * from "./ezeth-14day";
export * from "./ezeth-30day";
export * from "./ezeth-coordinator";
export * from "./factory";
export * from "./morpho-blue-coordinator";
export * from "./morpho-blue-dai-14day";
export * from "./morpho-blue-dai-30day";
export * from "./morpho-dai-14day";
export * from "./morpho-dai-30day";
export * from "./reth-14day";
Expand Down
14 changes: 14 additions & 0 deletions tasks/deploy/config/sepolia/morpho-blue-coordinator.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import { HyperdriveCoordinatorConfig } from "../../lib";
import { SEPOLIA_FACTORY_NAME } from "./factory";

export const SEPOLIA_MORPHO_BLUE_COORDINATOR_NAME = "MORPHO_BLUE_COORDINATOR";

export const SEPOLIA_MORPHO_BLUE_COORDINATOR: HyperdriveCoordinatorConfig<"MorphoBlue"> =
{
name: SEPOLIA_MORPHO_BLUE_COORDINATOR_NAME,
prefix: "MorphoBlue",
targetCount: 5,
factoryAddress: async (hre) =>
hre.hyperdriveDeploy.deployments.byName(SEPOLIA_FACTORY_NAME)
.address,
};
140 changes: 140 additions & 0 deletions tasks/deploy/config/sepolia/morpho-blue-dai-14day.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,140 @@
import { Address, encodeAbiParameters, parseEther, zeroAddress } from "viem";
import {
HyperdriveInstanceConfig,
getLinkerDetails,
normalizeFee,
parseDuration,
toBytes32,
} from "../../lib";
import { SEPOLIA_CHECKPOINT_REWARDER_NAME } from "./checkpoint-rewarder";
import {
SEPOLIA_FACTORY_GOVERNANCE_ADDRESS,
SEPOLIA_FACTORY_NAME,
} from "./factory";
import { SEPOLIA_MORPHO_BLUE_COORDINATOR_NAME } from "./morpho-blue-coordinator";

export const SEPOLIA_MORPHO_BLUE_DAI_14DAY_NAME = "MORPHO_BLUE_DAI_14_DAY";

const CONTRIBUTION = parseEther("10000");

const enc = encodeAbiParameters(
[
{
components: [
{
name: "morpho",
type: "address",
},
{
name: "collateralToken",
type: "address",
},
{
name: "oracle",
type: "address",
},
{
name: "irm",
type: "address",
},
{
name: "lltv",
type: "uint256",
},
],
name: "MorphoBlueParams",
type: "tuple",
},
],
[
{
morpho: "0x927A9E3C4B897eF5135e6B2C7689637fA8E2E0Bd" as `0x${string}`,
collateralToken:
"0xFF8AFe6bb92eB9D8e80c607bbe5bbb78BF1201Df" as `0x${string}`, // Hyperdrive Sepolia sDAI
oracle: "0x23F3A48121861b78f66BbE3DF60AD24A21c4DDad" as `0x${string}`,
irm: "0x0fB591F09ab2eB967c0EFB9eE0EF6642c2abe6Ab" as `0x${string}`,
lltv: BigInt("980000000000000000"),
},
],
);
jalextowle marked this conversation as resolved.
Show resolved Hide resolved

export const SEPOLIA_MORPHO_BLUE_DAI_14DAY: HyperdriveInstanceConfig<"MorphoBlue"> =
{
name: SEPOLIA_MORPHO_BLUE_DAI_14DAY_NAME,
prefix: "MorphoBlue",
coordinatorAddress: async (hre) =>
hre.hyperdriveDeploy.deployments.byName(
SEPOLIA_MORPHO_BLUE_COORDINATOR_NAME,
).address,
deploymentId: toBytes32(SEPOLIA_MORPHO_BLUE_DAI_14DAY_NAME),
salt: toBytes32("0x420"),
extraData: enc,
contribution: CONTRIBUTION,
fixedAPR: parseEther("0.10"),
timestretchAPR: parseEther("0.10"),
mcclurejt marked this conversation as resolved.
Show resolved Hide resolved
options: async (hre) => ({
extraData: "0x",
asBase: true,
destination: (await hre.getNamedAccounts())["deployer"] as Address,
}),
prepare: async (hre, options) => {
let pc = await hre.viem.getPublicClient();
let baseToken = await hre.hyperdriveDeploy.ensureDeployed(
"DAI",
"ERC20Mintable",
[
"DAI",
"DAI",
18,
(await hre.getNamedAccounts())["deployer"] as Address,
true,
parseEther("10000"),
],
options,
);

// approve the coordinator for the contribution
let tx = await baseToken.write.approve([
hre.hyperdriveDeploy.deployments.byName(
SEPOLIA_MORPHO_BLUE_COORDINATOR_NAME,
).address,
CONTRIBUTION,
]);
await pc.waitForTransactionReceipt({ hash: tx });

// mint some tokens for the contribution
tx = await baseToken.write.mint([CONTRIBUTION]);
await pc.waitForTransactionReceipt({ hash: tx });
},
poolDeployConfig: async (hre) => {
return {
baseToken:
hre.hyperdriveDeploy.deployments.byName("DAI").address,
vaultSharesToken: zeroAddress,
circuitBreakerDelta: parseEther("0.6"),
mcclurejt marked this conversation as resolved.
Show resolved Hide resolved
minimumShareReserves: parseEther("10"),
minimumTransactionAmount: parseEther("0.001"),
positionDuration: parseDuration("14 days"),
checkpointDuration: parseDuration("1 day"),
timeStretch: 0n,
governance: SEPOLIA_FACTORY_GOVERNANCE_ADDRESS,
feeCollector: SEPOLIA_FACTORY_GOVERNANCE_ADDRESS,
sweepCollector: SEPOLIA_FACTORY_GOVERNANCE_ADDRESS,
checkpointRewarder: hre.hyperdriveDeploy.deployments.byName(
SEPOLIA_CHECKPOINT_REWARDER_NAME,
).address,
...(await getLinkerDetails(
hre,
hre.hyperdriveDeploy.deployments.byName(
SEPOLIA_FACTORY_NAME,
).address,
)),
fees: {
curve: parseEther("0.01"),
flat: normalizeFee(parseEther("0.0005"), "14 days"),
mcclurejt marked this conversation as resolved.
Show resolved Hide resolved
governanceLP: parseEther("0.15"),
governanceZombie: parseEther("0.03"),
},
};
},
};
Loading
Loading