mirror of
https://github.com/luxfhe/example-playground.git
synced 2026-10-30 18:13:21 +00:00
19 lines
675 B
TypeScript
19 lines
675 B
TypeScript
import { task } from "hardhat/config";
|
|
import type { TaskArguments } from "hardhat/types";
|
|
|
|
task("task:getWin")
|
|
.addOptionalParam("account", "Specify which account [0, 9]", "0")
|
|
.setAction(async function (taskArguments: TaskArguments, hre) {
|
|
const { ethers, deployments } = hre;
|
|
|
|
const Voting = await deployments.get("Voting");
|
|
|
|
const signers = await ethers.getSigners();
|
|
|
|
const voting = await ethers.getContractAt("Voting", Voting.address);
|
|
|
|
const [winOption, winTally] = await voting.connect(signers[taskArguments.account]).winning();
|
|
|
|
console.log(`Winning option: ${winOption}\nWinning tally: ${winTally}`);
|
|
});
|