generated from PaulRBerg/hardhat-template
-
Notifications
You must be signed in to change notification settings - Fork 52
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(evm): adds debridge reporter & adapter deployment tasks
- Loading branch information
1 parent
ccc83d1
commit 2380b6b
Showing
2 changed files
with
48 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
import type { SignerWithAddress } from "@nomiclabs/hardhat-ethers/signers" | ||
import { task } from "hardhat/config" | ||
import type { TaskArguments } from "hardhat/types" | ||
|
||
import type { DeBridgeAdapter } from "../../../types/contracts/adapters/DeBridge/DeBridgeAdapter" | ||
import type { DeBridgeReporter } from "../../../types/contracts/adapters/DeBridge/DeBridgeReporter" | ||
import type { DeBridgeAdapter__factory } from "../../../types/factories/contracts/adapters/DeBridge/DeBridgeAdapter__factory" | ||
import type { DeBridgeReporter__factory } from "../../../types/factories/contracts/adapters/DeBridge/DeBridgeReporter__factory" | ||
import { verify } from "../index" | ||
|
||
task("deploy:DeBridgeAdapter") | ||
.addParam("deBridgeGate", "address of the DeBridge gate contract") | ||
.addFlag("verify", "whether to verify the contract on Etherscan") | ||
.setAction(async function (taskArguments: TaskArguments, hre) { | ||
console.log("Deploying DeBridgeAdapter...") | ||
const signers: SignerWithAddress[] = await hre.ethers.getSigners() | ||
const deBridgeAdapterFactory: DeBridgeAdapter__factory = <DeBridgeAdapter__factory>( | ||
await hre.ethers.getContractFactory("DeBridgeAdapter") | ||
) | ||
const constructorArguments = [taskArguments.deBridgeGate] as const | ||
const deBridgeAdapter: DeBridgeAdapter = <DeBridgeAdapter>( | ||
await deBridgeAdapterFactory.connect(signers[0]).deploy(...constructorArguments) | ||
) | ||
await deBridgeAdapter.deployed() | ||
console.log("DeBridgeAdapter deployed to:", deBridgeAdapter.address) | ||
if (taskArguments.verify) await verify(hre, deBridgeAdapter, constructorArguments) | ||
}) | ||
|
||
task("deploy:DeBridgeReporter") | ||
.addParam("headerStorage", "address of the header storage contract") | ||
.addParam("yaho", "address of the Yaho contract") | ||
.addParam("deBridgeGate", "address of the DeBridge gate contract") | ||
.addFlag("verify", "whether to verify the contract on Etherscan") | ||
.setAction(async function (taskArguments: TaskArguments, hre) { | ||
console.log("Deploying DeBridgeReporter...") | ||
const signers: SignerWithAddress[] = await hre.ethers.getSigners() | ||
const deBridgeReporterFactory: DeBridgeReporter__factory = <DeBridgeReporter__factory>( | ||
await hre.ethers.getContractFactory("DeBridgeReporter") | ||
) | ||
const constructorArguments = [taskArguments.headerStorage, taskArguments.yaho, taskArguments.deBridgeGate] as const | ||
const deBridgeReporter: DeBridgeReporter = <DeBridgeReporter>( | ||
await deBridgeReporterFactory.connect(signers[0]).deploy(...constructorArguments) | ||
) | ||
await deBridgeReporter.deployed() | ||
console.log("DeBridgeReporter deployed to:", deBridgeReporter.address) | ||
if (taskArguments.verify) await verify(hre, deBridgeReporter, constructorArguments) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters