Skip to content

Commit

Permalink
feat(evm): adds debridge reporter & adapter deployment tasks
Browse files Browse the repository at this point in the history
  • Loading branch information
allemanfredi committed May 9, 2024
1 parent ccc83d1 commit 2380b6b
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 0 deletions.
47 changes: 47 additions & 0 deletions packages/evm/tasks/deploy/adapters/debridge.ts
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)
})
1 change: 1 addition & 0 deletions packages/evm/tasks/deploy/adapters/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import "./axiom"
import "./ccip"
import "./celer"
import "./connext"
import "./debridge"
import "./dendreth"
import "./electron"
import "./hyperlane"
Expand Down

0 comments on commit 2380b6b

Please sign in to comment.