Skip to content

Commit b17aac0

Browse files
committed
add deployment config for gnosis wsteth sxdai
1 parent c0f48a7 commit b17aac0

9 files changed

+358
-1
lines changed

hardhat.config.gnosis.ts

+43
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
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+
GNOSIS_CHAINLINK_COORDINATOR,
11+
GNOSIS_ERC4626_COORDINATOR,
12+
GNOSIS_FACTORY,
13+
GNOSIS_SXDAI_182DAY,
14+
GNOSIS_WSTETH_182DAY,
15+
} from "./tasks/deploy/config/gnosis";
16+
17+
const { env } = process;
18+
19+
const config: HardhatUserConfig = {
20+
...baseConfig,
21+
networks: {
22+
gnosis: {
23+
live: true,
24+
url: env.HYPERDRIVE_ETHEREUM_URL!,
25+
accounts: [env.DEPLOYER_PRIVATE_KEY!, env.PAUSER_PRIVATE_KEY!],
26+
hyperdriveDeploy: {
27+
factories: [GNOSIS_FACTORY],
28+
coordinators: [
29+
GNOSIS_CHAINLINK_COORDINATOR,
30+
GNOSIS_ERC4626_COORDINATOR,
31+
],
32+
instances: [GNOSIS_WSTETH_182DAY, GNOSIS_SXDAI_182DAY],
33+
checkpointRewarders: [],
34+
checkpointSubrewarders: [],
35+
},
36+
},
37+
},
38+
etherscan: {
39+
apiKey: env.GNOSISSCAN_API_KEY ?? "",
40+
},
41+
};
42+
43+
export default config;

hardhat.config.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ const config: HardhatUserConfig = {
1313
viaIR: false,
1414
optimizer: {
1515
enabled: true,
16-
runs: 10000000,
16+
runs: 13000,
1717
},
1818
evmVersion: "paris",
1919
metadata: {
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
import { HyperdriveCoordinatorConfig } from "../../lib";
2+
import { GNOSIS_FACTORY_NAME } from "./factory";
3+
4+
export const GNOSIS_CHAINLINK_COORDINATOR_NAME =
5+
"ElementDAO Chainlink Hyperdrive Deployer Coordinator";
6+
export const GNOSIS_CHAINLINK_COORDINATOR: HyperdriveCoordinatorConfig<"Chainlink"> =
7+
{
8+
name: GNOSIS_CHAINLINK_COORDINATOR_NAME,
9+
prefix: "Chainlink",
10+
targetCount: 5,
11+
factoryAddress: async (hre) =>
12+
hre.hyperdriveDeploy.deployments.byName(GNOSIS_FACTORY_NAME)
13+
.address,
14+
};
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
import { HyperdriveCoordinatorConfig } from "../../lib";
2+
import { GNOSIS_FACTORY_NAME } from "./factory";
3+
4+
export const GNOSIS_ERC4626_COORDINATOR_NAME =
5+
"ElementDAO ERC4626 Hyperdrive Deployer Coordinator";
6+
export const GNOSIS_ERC4626_COORDINATOR: HyperdriveCoordinatorConfig<"ERC4626"> =
7+
{
8+
name: GNOSIS_ERC4626_COORDINATOR_NAME,
9+
prefix: "ERC4626",
10+
targetCount: 5,
11+
factoryAddress: async (hre) =>
12+
hre.hyperdriveDeploy.deployments.byName(GNOSIS_FACTORY_NAME)
13+
.address,
14+
};

tasks/deploy/config/gnosis/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 GNOSIS_FACTORY_NAME = "ElementDAO Hyperdrive Factory";
6+
7+
// The name of the forwarder factory.
8+
export const GNOSIS_FACTORY_FORWARDER_NAME =
9+
"ElementDAO ERC20 Factory Forwarder";
10+
11+
export const GNOSIS_FACTORY: HyperdriveFactoryConfig = {
12+
name: GNOSIS_FACTORY_NAME,
13+
prepare: async (hre, options) => {
14+
await hre.hyperdriveDeploy.ensureDeployed(
15+
GNOSIS_FACTORY_FORWARDER_NAME,
16+
"ERC20ForwarderFactory",
17+
[GNOSIS_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+
GNOSIS_FACTORY_FORWARDER_NAME,
62+
).address,
63+
linkerCodeHash: await (
64+
await hre.viem.getContractAt(
65+
"ERC20ForwarderFactory",
66+
hre.hyperdriveDeploy.deployments.byName(
67+
GNOSIS_FACTORY_FORWARDER_NAME,
68+
).address,
69+
)
70+
).read.ERC20LINK_HASH(),
71+
},
72+
GNOSIS_FACTORY_NAME,
73+
],
74+
};

tasks/deploy/config/gnosis/index.ts

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
export * from "./chainlink-coordinator";
2+
export * from "./erc4626-coordinator";
3+
export * from "./factory";
4+
export * from "./sxdai-182day";
5+
export * from "./wsteth-182day";
+83
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
import { Address, keccak256, parseEther, toBytes, zeroAddress } from "viem";
2+
import {
3+
HyperdriveInstanceConfig,
4+
getLinkerDetails,
5+
normalizeFee,
6+
parseDuration,
7+
toBytes32,
8+
} from "../../lib";
9+
import {
10+
SIX_MONTHS,
11+
SXDAI_ADDRESS_GNOSIS,
12+
WXDAI_ADDRESS_GNOSIS,
13+
} from "../../lib/constants";
14+
import { GNOSIS_ERC4626_COORDINATOR_NAME } from "./erc4626-coordinator";
15+
import { GNOSIS_FACTORY_NAME } from "./factory";
16+
17+
// The name of the pool.
18+
export const GNOSIS_SXDAI_182DAY_NAME = "ElementDAO 182 Day sxDAI Hyperdrive";
19+
20+
// The initial contribution of the pool.
21+
const CONTRIBUTION = parseEther("100");
22+
23+
export const GNOSIS_SXDAI_182DAY: HyperdriveInstanceConfig<"ERC4626"> = {
24+
name: GNOSIS_SXDAI_182DAY_NAME,
25+
prefix: "ERC4626",
26+
coordinatorAddress: async (hre) =>
27+
hre.hyperdriveDeploy.deployments.byName(GNOSIS_ERC4626_COORDINATOR_NAME)
28+
.address,
29+
deploymentId: keccak256(toBytes(GNOSIS_SXDAI_182DAY_NAME)),
30+
salt: toBytes32("0x69420"),
31+
extraData: "0x",
32+
contribution: CONTRIBUTION,
33+
fixedAPR: parseEther("0.06"),
34+
timestretchAPR: parseEther("0.05"),
35+
options: async (hre) => ({
36+
extraData: "0x",
37+
asBase: true,
38+
destination: (await hre.getNamedAccounts())["deployer"] as Address,
39+
}),
40+
// Prepare to deploy the contract by setting approvals.
41+
prepare: async (hre) => {
42+
let baseToken = await hre.viem.getContractAt(
43+
"contracts/src/interfaces/IERC20.sol:IERC20",
44+
WXDAI_ADDRESS_GNOSIS,
45+
);
46+
let tx = await baseToken.write.approve([
47+
hre.hyperdriveDeploy.deployments.byName(
48+
GNOSIS_ERC4626_COORDINATOR_NAME,
49+
).address,
50+
CONTRIBUTION,
51+
]);
52+
let pc = await hre.viem.getPublicClient();
53+
await pc.waitForTransactionReceipt({ hash: tx });
54+
},
55+
poolDeployConfig: async (hre) => {
56+
return {
57+
baseToken: WXDAI_ADDRESS_GNOSIS,
58+
vaultSharesToken: SXDAI_ADDRESS_GNOSIS,
59+
circuitBreakerDelta: parseEther("0.05"),
60+
minimumShareReserves: parseEther("10"),
61+
minimumTransactionAmount: parseEther("0.001"),
62+
positionDuration: parseDuration(SIX_MONTHS),
63+
checkpointDuration: parseDuration("1 day"),
64+
timeStretch: 0n,
65+
// TODO: Read from the factory.
66+
governance: (await hre.getNamedAccounts())["deployer"] as Address,
67+
feeCollector: zeroAddress,
68+
sweepCollector: zeroAddress,
69+
checkpointRewarder: zeroAddress,
70+
...(await getLinkerDetails(
71+
hre,
72+
hre.hyperdriveDeploy.deployments.byName(GNOSIS_FACTORY_NAME)
73+
.address,
74+
)),
75+
fees: {
76+
curve: parseEther("0.01"),
77+
flat: normalizeFee(parseEther("0.0005"), SIX_MONTHS),
78+
governanceLP: parseEther("0.15"),
79+
governanceZombie: parseEther("0.03"),
80+
},
81+
};
82+
},
83+
};
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
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+
};

tasks/deploy/lib/constants.ts

+26
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,32 @@ export const WSTETH_WHALE_MAINNET =
9191
export const SEPOLIA_USDE_ADDRESS =
9292
"0x9458CaACa74249AbBE9E964b3Ce155B98EC88EF2" as Address;
9393

94+
// ╭─────────────────────────────────────────────────────────╮
95+
// │ Gnosis Addresses │
96+
// ╰─────────────────────────────────────────────────────────╯
97+
98+
export const CHAINLINK_AGGREGATOR_ADDRESS_GNOSIS =
99+
"0x6dcF8CE1982Fc71E7128407c7c6Ce4B0C1722F55" as Address;
100+
101+
export const CHAINLINK_AGGREGATOR_WSTETH_ETH_PROXY_GNOSIS =
102+
"0x0064AC007fF665CF8D0D3Af5E0AD1c26a3f853eA" as Address;
103+
104+
export const SXDAI_ADDRESS_GNOSIS =
105+
"0xaf204776c7245bF4147c2612BF6e5972Ee483701" as Address;
106+
107+
export const WXDAI_ADDRESS_GNOSIS =
108+
"0xe91D153E0b41518A2Ce8Dd3D7944Fa863463a97d" as Address;
109+
110+
export const WSTETH_ADDRESS_GNOSIS =
111+
"0x6C76971f98945AE98dD7d4DFcA8711ebea946eA6" as Address;
112+
113+
// ╭─────────────────────────────────────────────────────────╮
114+
// │ Gnosis Whales │
115+
// ╰─────────────────────────────────────────────────────────╯
116+
117+
export const WSTETH_WHALE_GNOSIS =
118+
"0x458cD345B4C05e8DF39d0A07220feb4Ec19F5e6f" as Address;
119+
94120
// ╭─────────────────────────────────────────────────────────╮
95121
// │ Durations │
96122
// ╰─────────────────────────────────────────────────────────╯

0 commit comments

Comments
 (0)