Skip to content

Commit

Permalink
Deployed and verified the contracts on Base (#1170)
Browse files Browse the repository at this point in the history
  • Loading branch information
jalextowle authored Sep 13, 2024
1 parent f872a8e commit 8e32d2f
Show file tree
Hide file tree
Showing 3 changed files with 134 additions and 29 deletions.
89 changes: 88 additions & 1 deletion deployments.json
Original file line number Diff line number Diff line change
Expand Up @@ -1236,5 +1236,92 @@
"address": "0xB56e0Bf37c4747AbbC3aA9B8084B0d9b9A336777",
"timestamp": "2024-09-09T20:34:07.406Z"
}
},
"base": {
"DELV Hyperdrive Registry": {
"contract": "HyperdriveRegistry",
"address": "0x6668310631Ad5a5ac92dC9549353a5BaaE16C666",
"timestamp": "2024-09-13T18:28:20.323Z"
},
"ElementDAO ERC20 Factory Forwarder": {
"contract": "ERC20ForwarderFactory",
"address": "0xfbabc73b6241df6453d88ac13b556ba643f9a6ad",
"timestamp": "2024-09-13T18:28:24.781Z"
},
"ElementDAO Hyperdrive Factory": {
"contract": "HyperdriveFactory",
"address": "0x33ae0193a175bde2ac9309c05329e6c7727e6fa7",
"timestamp": "2024-09-13T18:28:29.313Z"
},
"ElementDAO Chainlink Hyperdrive Deployer Coordinator_ChainlinkHyperdriveCoreDeployer": {
"contract": "ChainlinkHyperdriveCoreDeployer",
"address": "0xd53123342fd44e3b8073a0c3d1ed5992ad26a0d8",
"timestamp": "2024-09-13T18:28:32.204Z"
},
"LPMath": {
"contract": "LPMath",
"address": "0xe61fb0f6a265f614ca6bf2ee83bbc463cb34da38",
"timestamp": "2024-09-13T18:28:36.491Z"
},
"ElementDAO Chainlink Hyperdrive Deployer Coordinator_ChainlinkTarget0Deployer": {
"contract": "ChainlinkTarget0Deployer",
"address": "0xd9400ab142b4ad18c181538b76522334e0cd8d37",
"timestamp": "2024-09-13T18:28:40.836Z"
},
"ElementDAO Chainlink Hyperdrive Deployer Coordinator_ChainlinkTarget1Deployer": {
"contract": "ChainlinkTarget1Deployer",
"address": "0xbe082293b646cb619a638d29e8eff7cf2f46aa3a",
"timestamp": "2024-09-13T18:28:45.071Z"
},
"ElementDAO Chainlink Hyperdrive Deployer Coordinator_ChainlinkTarget2Deployer": {
"contract": "ChainlinkTarget2Deployer",
"address": "0x08b40647714ac1e5742633fc2d83c20d61a199d2",
"timestamp": "2024-09-13T18:28:49.476Z"
},
"ElementDAO Chainlink Hyperdrive Deployer Coordinator_ChainlinkTarget3Deployer": {
"contract": "ChainlinkTarget3Deployer",
"address": "0xf95b98256edb861be389b9807f6656e8be2dc488",
"timestamp": "2024-09-13T18:28:52.111Z"
},
"ElementDAO Chainlink Hyperdrive Deployer Coordinator_ChainlinkTarget4Deployer": {
"contract": "ChainlinkTarget4Deployer",
"address": "0xdf5d682404b0611f46f2626d9d5a37eb6a6fd27d",
"timestamp": "2024-09-13T18:28:56.386Z"
},
"ElementDAO Chainlink Hyperdrive Deployer Coordinator": {
"contract": "ChainlinkHyperdriveDeployerCoordinator",
"address": "0xd9bdabb0f87e46af44063d251eb07edfe260d9f1",
"timestamp": "2024-09-13T18:29:00.654Z"
},
"ElementDAO 182 Day cbETH Hyperdrive_ChainlinkTarget0": {
"contract": "ChainlinkTarget0",
"address": "0xde08a8213E957d149F4D4402cbCEf2570EC64b54",
"timestamp": "2024-09-13T18:29:33.526Z"
},
"ElementDAO 182 Day cbETH Hyperdrive_ChainlinkTarget1": {
"contract": "ChainlinkTarget1",
"address": "0xfEbF749775877B2Df0038c3a8E4087924b607306",
"timestamp": "2024-09-13T18:29:19.532Z"
},
"ElementDAO 182 Day cbETH Hyperdrive_ChainlinkTarget2": {
"contract": "ChainlinkTarget2",
"address": "0x27169F09769747c055d79458179D850bfDCCFBf2",
"timestamp": "2024-09-13T18:29:22.096Z"
},
"ElementDAO 182 Day cbETH Hyperdrive_ChainlinkTarget3": {
"contract": "ChainlinkTarget3",
"address": "0x04d7B653ed41b2d16C4f82B28792F8b58511FAfe",
"timestamp": "2024-09-13T18:29:24.682Z"
},
"ElementDAO 182 Day cbETH Hyperdrive_ChainlinkTarget4": {
"contract": "ChainlinkTarget4",
"address": "0xF205aB2cb616D71b082D4D6694b241caA1d725C2",
"timestamp": "2024-09-13T18:29:29.000Z"
},
"ElementDAO 182 Day cbETH Hyperdrive": {
"contract": "ChainlinkHyperdrive",
"address": "0x2a1ca35Ded36C531F77c614b5AAA0d4F86edbB06",
"timestamp": "2024-09-13T18:29:33.434Z"
}
}
}
}
6 changes: 1 addition & 5 deletions hardhat.config.base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import {
BASE_CBETH_182DAY,
BASE_CHAINLINK_COORDINATOR,
BASE_FACTORY,
BASE_MORPHO_BLUE_COORDINATOR,
} from "./tasks/deploy/config/base";

const { env } = process;
Expand All @@ -24,10 +23,7 @@ const config: HardhatUserConfig = {
accounts: [env.DEPLOYER_PRIVATE_KEY!, env.PAUSER_PRIVATE_KEY!],
hyperdriveDeploy: {
factories: [BASE_FACTORY],
coordinators: [
BASE_CHAINLINK_COORDINATOR,
BASE_MORPHO_BLUE_COORDINATOR,
],
coordinators: [BASE_CHAINLINK_COORDINATOR],
instances: [BASE_CBETH_182DAY],
checkpointRewarders: [],
checkpointSubrewarders: [],
Expand Down
68 changes: 45 additions & 23 deletions tasks/deploy/verify.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { task, types } from "hardhat/config";
import { Address } from "viem";
import { Address, decodeAbiParameters, parseAbiParameters } from "viem";
import { evaluateValueOrHREFn } from "./lib";

export type VerifyParams = {};
Expand Down Expand Up @@ -162,10 +162,12 @@ task(
}

// loop through all instances
for (let i of hyperdriveConfig.instances ?? []) {
for (let instanceConfig of hyperdriveConfig.instances ?? []) {
await sleep(1000);

let instance = hre.hyperdriveDeploy.deployments.byName(i.name);
let instance = hre.hyperdriveDeploy.deployments.byName(
instanceConfig.name,
);
let instanceContract = await hre.viem.getContractAt(
"IHyperdriveRead",
instance.address,
Expand All @@ -176,7 +178,11 @@ task(
// constructor arguments are necessary
let coordinatorDeployment =
hre.hyperdriveDeploy.deployments.byAddress(
await evaluateValueOrHREFn(i.coordinatorAddress, hre, {}),
await evaluateValueOrHREFn(
instanceConfig.coordinatorAddress,
hre,
{},
),
);
let coordinatorConfig = hyperdriveConfig.coordinators.find(
(c) => c.name == coordinatorDeployment.name,
Expand All @@ -195,6 +201,7 @@ task(
let targetArgs:
| [typeof poolConfig, `0x${string}`]
| [typeof poolConfig, `0x${string}`, `0x${string}`]
| [typeof poolConfig, `0x${string}`, `0x${string}`, bigint]
| [
typeof poolConfig,
{
Expand All @@ -213,11 +220,8 @@ task(
hre,
{},
);
let isMorpho =
(await instanceContract.read.kind()) == "MorphoBlueHyperdrive";
if (extras) {
targetArgs = [poolConfig, factoryAddress, ...extras];
} else if (isMorpho) {
const kind = await instanceContract.read.kind();
if (kind == "MorphoBlueHyperdrive") {
let morphoInstanceContract = await hre.viem.getContractAt(
"IMorphoBlueHyperdrive",
instance.address,
Expand All @@ -234,6 +238,19 @@ task(
},
factoryAddress,
];
} else if (kind == "ChainlinkHyperdrive") {
const [aggregator, decimals] = decodeAbiParameters(
parseAbiParameters("address, uint8"),
instanceConfig.extraData,
);
targetArgs = [
poolConfig,
factoryAddress,
aggregator,
BigInt(decimals),
];
} else if (extras) {
targetArgs = [poolConfig, factoryAddress, ...extras];
}

// verify the targets
Expand All @@ -242,7 +259,7 @@ task(
await coordinatorContract.read.getNumberOfTargets();
for (let j = 0; j < targetCount; j++) {
await sleep(1000);
let targetName = `${i.name}_${i.prefix}Target${j}`;
let targetName = `${instanceConfig.name}_${instanceConfig.prefix}Target${j}`;
let targetAddress =
hre.hyperdriveDeploy.deployments.byName(targetName).address;
console.log(targetAddress);
Expand All @@ -259,13 +276,13 @@ task(
}

// verify the instance
console.log(`verifying ${i.name}...`);
console.log(`verifying ${instanceConfig.name}...`);
let ihyperdrive = await hre.viem.getContractAt(
"IHyperdrive",
instance.address,
);
let args = [
i.name,
instanceConfig.name,
poolConfig,
factoryAddress,
await ihyperdrive.read.target0(),
Expand All @@ -274,12 +291,7 @@ task(
await ihyperdrive.read.target3(),
await ihyperdrive.read.target4(),
];
console.log("args", ...args.slice(1));
console.log("targets", ...targets);
if (extras) {
args.push(...extras);
}
if (isMorpho) {
if (kind == "MorphoBlueHyperdrive") {
let morphoInstanceContract = await hre.viem.getContractAt(
"IMorphoBlueHyperdrive",
instance.address,
Expand All @@ -292,8 +304,17 @@ task(
irm: await morphoInstanceContract.read.irm(),
lltv: await morphoInstanceContract.read.lltv(),
});
} else if (kind == "ChainlinkHyperdrive") {
const [aggregator, decimals] = decodeAbiParameters(
parseAbiParameters("address, uint8"),
instanceConfig.extraData,
);
args.push(...[aggregator, BigInt(decimals)]);
} else if (extras) {
args.push(...extras);
}
const kind = await instanceContract.read.kind();
console.log("args", ...args.slice(1));
console.log("targets", ...targets);
let pathName;
if (kind == "MorphoBlueHyperdrive") {
pathName = "morpho-blue";
Expand All @@ -302,13 +323,14 @@ task(
} else if (kind == "RsETHLineaHyperdrive") {
pathName = "rseth-linea";
} else {
pathName = i.prefix.toLowerCase();
pathName = instanceConfig.prefix.toLowerCase();
}
let contract = `contracts/src/instances/${pathName}/${i.prefix}Hyperdrive.sol:${i.prefix}Hyperdrive`;
let contract = `contracts/src/instances/${pathName}/${instanceConfig.prefix}Hyperdrive.sol:${instanceConfig.prefix}Hyperdrive`;
await sleep(1000);
await run("verify:verify", {
address: hre.hyperdriveDeploy.deployments.byName(i.name)
.address,
address: hre.hyperdriveDeploy.deployments.byName(
instanceConfig.name,
).address,
constructorArguments: args,
contract,
});
Expand Down

0 comments on commit 8e32d2f

Please sign in to comment.