-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement task to deploy FxStateChildTunnel contract
- Loading branch information
Showing
7 changed files
with
101 additions
and
2 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
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,7 @@ | ||
# Deployment Information | ||
|
||
## Amoy Testnet | ||
|
||
### Fx Child | ||
|
||
- Address: [0xE5930336866d0388f0f745A2d9207C7781047C0f](https://amoy.polygonscan.com/address/0xE5930336866d0388f0f745A2d9207C7781047C0f) |
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
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
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
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,51 @@ | ||
import { TASK_CLEAN, TASK_COMPILE } from "hardhat/builtin-tasks/task-names"; | ||
import { task, types } from "hardhat/config"; | ||
import { getSigner } from "../utils/account"; | ||
import { isLocalNetwork, Network } from "../utils/network"; | ||
|
||
interface TaskParams { | ||
fxChild: string; | ||
} | ||
|
||
task("deploy:fx-state-child-tunnel") | ||
.setDescription("Deploy the FxStateChildTunnel contract") | ||
.addParam<string>( | ||
"fxChild", | ||
"Address of the FxChild contract", | ||
undefined, | ||
types.string | ||
) | ||
.setAction( | ||
async ( | ||
{ fxChild: fxChildAddress }: TaskParams, | ||
{ ethers, network, run } | ||
) => { | ||
if (!ethers.utils.isAddress(fxChildAddress)) { | ||
throw new Error("Invalid FxChildAddress address"); | ||
} | ||
|
||
const networkName = network.name as Network; | ||
console.log(`Network name: ${networkName}`); | ||
if (!isLocalNetwork(networkName)) { | ||
await run(TASK_CLEAN); | ||
} | ||
await run(TASK_COMPILE); | ||
|
||
const signer = await getSigner( | ||
ethers, | ||
network.provider, | ||
network.config.from | ||
); | ||
const FxStateChildTunnel = await ethers.getContractFactory( | ||
"FxStateChildTunnel", | ||
signer | ||
); | ||
|
||
const fxStateChildTunnel = | ||
await FxStateChildTunnel.deploy(fxChildAddress); | ||
await fxStateChildTunnel.deployed(); | ||
console.log( | ||
`fxStateChildTunnel deployed at ${fxStateChildTunnel.address}` | ||
); | ||
} | ||
); |
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