generated from PaulRBerg/hardhat-template
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add tasks for adding/removing ciphernodes (#66)
- Loading branch information
Showing
4 changed files
with
55 additions
and
1 deletion.
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
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,38 @@ | ||
import { task } from "hardhat/config"; | ||
import type { TaskArguments } from "hardhat/types"; | ||
|
||
task("ciphernode:add", "Register a ciphernode to the registry") | ||
.addParam("ciphernodeAddress", "address of ciphernode to register") | ||
.setAction(async function (taskArguments: TaskArguments, hre) { | ||
const registry = await hre.deployments.get("CyphernodeRegistryOwnable"); | ||
|
||
const registryContract = await hre.ethers.getContractAt( | ||
"CyphernodeRegistryOwnable", | ||
registry.address, | ||
); | ||
|
||
const tx = await registryContract.addCyphernode( | ||
taskArguments.ciphernodeAddress, | ||
); | ||
await tx.wait(); | ||
|
||
console.log(`Ciphernode ${taskArguments.ciphernodeAddress} registered`); | ||
}); | ||
|
||
task("ciphernode:remove", "Remove a ciphernode from the registry") | ||
.addParam("ciphernodeAddress", "address of ciphernode to remove") | ||
.setAction(async function (taskArguments: TaskArguments, hre) { | ||
const registry = await hre.deployments.get("CyphernodeRegistryOwnable"); | ||
|
||
const registryContract = await hre.ethers.getContractAt( | ||
"CyphernodeRegistryOwnable", | ||
registry.address, | ||
); | ||
|
||
const tx = await registryContract.removeCyphernode( | ||
taskArguments.ciphernodeAddress, | ||
); | ||
await tx.wait(); | ||
|
||
console.log(`Ciphernode ${taskArguments.ciphernodeAddress} removed`); | ||
}); |