Skip to content

Commit 8e52ca7

Browse files
committed
Added deployment tools for Linea EzETH
1 parent 19113cb commit 8e52ca7

File tree

6 files changed

+214
-0
lines changed

6 files changed

+214
-0
lines changed

hardhat.config.linea.ts

+35
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
import "@nomicfoundation/hardhat-foundry";
2+
import "@nomicfoundation/hardhat-toolbox-viem";
3+
import "@nomicfoundation/hardhat-viem";
4+
import "dotenv/config";
5+
import "hardhat-deploy";
6+
import { HardhatUserConfig } from "hardhat/config";
7+
import baseConfig from "./hardhat.config";
8+
import "./tasks";
9+
import {
10+
LINEA_EZETH_182DAY,
11+
LINEA_EZETH_COORDINATOR,
12+
LINEA_FACTORY,
13+
} from "./tasks/deploy/config/linea";
14+
15+
const { env } = process;
16+
17+
const config: HardhatUserConfig = {
18+
...baseConfig,
19+
networks: {
20+
linea: {
21+
live: true,
22+
url: env.HYPERDRIVE_ETHEREUM_URL!,
23+
accounts: [env.DEPLOYER_PRIVATE_KEY!, env.PAUSER_PRIVATE_KEY!],
24+
hyperdriveDeploy: {
25+
factories: [LINEA_FACTORY],
26+
coordinators: [LINEA_EZETH_COORDINATOR],
27+
instances: [LINEA_EZETH_182DAY],
28+
checkpointRewarders: [],
29+
checkpointSubrewarders: [],
30+
},
31+
},
32+
},
33+
};
34+
35+
export default config;
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
import { Address, keccak256, parseEther, toBytes, zeroAddress } from "viem";
2+
import {
3+
ETH_ADDRESS,
4+
HyperdriveInstanceConfig,
5+
LINEA_EZETH_ADDRESS,
6+
SIX_MONTHS,
7+
getLinkerDetails,
8+
normalizeFee,
9+
parseDuration,
10+
toBytes32,
11+
} from "../../lib";
12+
import { LINEA_EZETH_COORDINATOR_NAME } from "./ezeth-linea-coordinator";
13+
import { LINEA_FACTORY_NAME } from "./factory";
14+
15+
// The name of the pool.
16+
export const LINEA_EZETH_182DAY_NAME =
17+
"ElementDAO 182 Day Renzo xezETH Hyperdrive";
18+
19+
// The initial contribution of the pool.
20+
const CONTRIBUTION = parseEther("0.01");
21+
22+
export const LINEA_EZETH_182DAY: HyperdriveInstanceConfig<"EzETHLinea"> = {
23+
name: LINEA_EZETH_182DAY_NAME,
24+
prefix: "EzETHLinea",
25+
coordinatorAddress: async (hre) =>
26+
hre.hyperdriveDeploy.deployments.byName(LINEA_EZETH_COORDINATOR_NAME)
27+
.address,
28+
deploymentId: keccak256(toBytes(LINEA_EZETH_182DAY_NAME)),
29+
salt: toBytes32("0xababe"),
30+
extraData: "0x",
31+
contribution: CONTRIBUTION,
32+
fixedAPR: parseEther("0.031"),
33+
timestretchAPR: parseEther("0.1"),
34+
options: async (hre) => ({
35+
asBase: false,
36+
extraData: "0x",
37+
destination: (await hre.getNamedAccounts())["deployer"] as Address,
38+
}),
39+
prepare: async (hre) => {
40+
// approve the coordinator
41+
let vaultSharesToken = await hre.viem.getContractAt(
42+
"openzeppelin/token/ERC20/IERC20.sol:IERC20",
43+
LINEA_EZETH_ADDRESS,
44+
);
45+
let pc = await hre.viem.getPublicClient();
46+
let tx = await vaultSharesToken.write.approve([
47+
hre.hyperdriveDeploy.deployments.byName(
48+
LINEA_EZETH_COORDINATOR_NAME,
49+
).address,
50+
CONTRIBUTION,
51+
]);
52+
await pc.waitForTransactionReceipt({ hash: tx });
53+
},
54+
poolDeployConfig: async (hre) => {
55+
return {
56+
baseToken: ETH_ADDRESS,
57+
vaultSharesToken: LINEA_EZETH_ADDRESS,
58+
circuitBreakerDelta: parseEther("0.075"),
59+
minimumShareReserves: parseEther("0.001"),
60+
minimumTransactionAmount: parseEther("0.001"),
61+
positionDuration: parseDuration(SIX_MONTHS),
62+
checkpointDuration: parseDuration("1 day"),
63+
timeStretch: 0n,
64+
governance: (await hre.getNamedAccounts())["deployer"] as Address,
65+
feeCollector: zeroAddress,
66+
sweepCollector: zeroAddress,
67+
checkpointRewarder: zeroAddress,
68+
...(await getLinkerDetails(
69+
hre,
70+
hre.hyperdriveDeploy.deployments.byName(LINEA_FACTORY_NAME)
71+
.address,
72+
)),
73+
fees: {
74+
curve: parseEther("0.01"),
75+
flat: normalizeFee(parseEther("0.0005"), SIX_MONTHS),
76+
governanceLP: parseEther("0.15"),
77+
governanceZombie: parseEther("0.03"),
78+
},
79+
};
80+
},
81+
};
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
import { HyperdriveCoordinatorConfig, LINEA_X_RENZO_DEPOSIT } from "../../lib";
2+
import { LINEA_FACTORY_NAME } from "./factory";
3+
4+
export const LINEA_EZETH_COORDINATOR_NAME =
5+
"ElementDAO Renzo xezETH Hyperdrive Deployer Coordinator";
6+
export const LINEA_EZETH_COORDINATOR: HyperdriveCoordinatorConfig<"EzETHLinea"> =
7+
{
8+
name: LINEA_EZETH_COORDINATOR_NAME,
9+
prefix: "EzETHLinea",
10+
targetCount: 5,
11+
extraConstructorArgs: [LINEA_X_RENZO_DEPOSIT],
12+
factoryAddress: async (hre) =>
13+
hre.hyperdriveDeploy.deployments.byName(LINEA_FACTORY_NAME).address,
14+
token: LINEA_X_RENZO_DEPOSIT,
15+
};

tasks/deploy/config/linea/factory.ts

+74
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
import { Address, parseEther, zeroAddress } from "viem";
2+
import { HyperdriveFactoryConfig, parseDuration } from "../../lib";
3+
4+
// The name of the factory.
5+
export const LINEA_FACTORY_NAME = "ElementDAO Hyperdrive Factory";
6+
7+
// The name of the forwarder factory.
8+
export const LINEA_FACTORY_FORWARDER_NAME =
9+
"ElementDAO ERC20 Factory Forwarder";
10+
11+
export const LINEA_FACTORY: HyperdriveFactoryConfig = {
12+
name: LINEA_FACTORY_NAME,
13+
prepare: async (hre, options) => {
14+
await hre.hyperdriveDeploy.ensureDeployed(
15+
LINEA_FACTORY_FORWARDER_NAME,
16+
"ERC20ForwarderFactory",
17+
[LINEA_FACTORY_FORWARDER_NAME],
18+
options,
19+
);
20+
},
21+
constructorArguments: async (hre) => [
22+
{
23+
governance: (await hre.getNamedAccounts())["deployer"] as Address,
24+
deployerCoordinatorManager: (await hre.getNamedAccounts())[
25+
"deployer"
26+
] as Address,
27+
hyperdriveGovernance: (await hre.getNamedAccounts())[
28+
"deployer"
29+
] as Address,
30+
defaultPausers: [
31+
(await hre.getNamedAccounts())["deployer"] as Address,
32+
(await hre.getNamedAccounts())["pauser"] as Address,
33+
],
34+
feeCollector: zeroAddress,
35+
sweepCollector: zeroAddress,
36+
checkpointRewarder: zeroAddress,
37+
checkpointDurationResolution: parseDuration("1 hours"),
38+
minCheckpointDuration: parseDuration("24 hours"),
39+
maxCheckpointDuration: parseDuration("24 hours"),
40+
minPositionDuration: parseDuration("7 days"),
41+
maxPositionDuration: parseDuration("730 days"),
42+
minFixedAPR: parseEther("0.005"),
43+
maxFixedAPR: parseEther("0.1"),
44+
minTimeStretchAPR: parseEther("0.005"),
45+
maxTimeStretchAPR: parseEther("0.1"),
46+
minCircuitBreakerDelta: parseEther("0.01"),
47+
maxCircuitBreakerDelta: parseEther("0.2"),
48+
minFees: {
49+
curve: parseEther("0.001"),
50+
flat: parseEther("0.0001"),
51+
governanceLP: parseEther("0.15"),
52+
governanceZombie: parseEther("0.03"),
53+
},
54+
maxFees: {
55+
curve: parseEther("0.05"),
56+
flat: parseEther("0.005"),
57+
governanceLP: parseEther("0.15"),
58+
governanceZombie: parseEther("0.03"),
59+
},
60+
linkerFactory: hre.hyperdriveDeploy.deployments.byName(
61+
LINEA_FACTORY_FORWARDER_NAME,
62+
).address,
63+
linkerCodeHash: await (
64+
await hre.viem.getContractAt(
65+
"ERC20ForwarderFactory",
66+
hre.hyperdriveDeploy.deployments.byName(
67+
LINEA_FACTORY_FORWARDER_NAME,
68+
).address,
69+
)
70+
).read.ERC20LINK_HASH(),
71+
},
72+
LINEA_FACTORY_NAME,
73+
],
74+
};

tasks/deploy/config/linea/index.ts

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
export * from "./ezeth-linea-182day";
2+
export * from "./ezeth-linea-coordinator";
3+
export * from "./factory";

tasks/deploy/lib/constants.ts

+6
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,12 @@ import { Address } from "viem";
33
export const ETH_ADDRESS =
44
"0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE" as Address;
55

6+
export const LINEA_EZETH_ADDRESS =
7+
"0x2416092f143378750bb29b79eD961ab195CcEea5" as Address;
8+
9+
export const LINEA_X_RENZO_DEPOSIT =
10+
"0x4D7572040B84b41a6AA2efE4A93eFFF182388F88" as Address;
11+
612
export const MAINNET_DAI_ADDRESS =
713
"0x6b175474e89094c44da98b954eedeac495271d0f" as Address;
814

0 commit comments

Comments
 (0)