mirror of
https://github.com/luxfhe/example-playground.git
synced 2026-10-30 18:13:21 +00:00
36 lines
1.5 KiB
TypeScript
36 lines
1.5 KiB
TypeScript
// TODO: Enable when @luxfhe/sdk is available
|
|
// import { task } from "hardhat/config";
|
|
// import type { ArgumentType, TaskArguments } from "hardhat/types";
|
|
// import {Voting} from "../../typechain-types";
|
|
//
|
|
// task("task:vote")
|
|
// .addParam("option", "Option to choose")
|
|
// .addOptionalParam("account", "Specify which account [0, 9]", "0")
|
|
// .setAction(async function (taskArguments: TaskArguments, hre) {
|
|
// const { ethers, deployments } = hre;
|
|
// const luxfhe = await import("@luxfhe/sdk/node");
|
|
//
|
|
// const Voting = await deployments.get("Voting");
|
|
//
|
|
// const signers = await ethers.getSigners();
|
|
// const signer = signers[Number(taskArguments.account)];
|
|
//
|
|
// const voting = await ethers.getContractAt("Voting", Voting.address);
|
|
//
|
|
// console.log(`contract at: ${Voting.address}, for signer: ${signer.address}`);
|
|
//
|
|
// if (hre.network.name === "localluxfhe") {
|
|
// if (await signer.getBalance() < ethers.utils.parseEther("1.0")) {
|
|
// await luxfhe.getFunds(signer.address);
|
|
// }
|
|
// }
|
|
//
|
|
// const eOption = await luxfhe.encrypt_uint8(Number(taskArguments.option));
|
|
// let contractWithSigner = voting.connect(signer) as unknown as Voting;
|
|
//
|
|
// console.time("voteDuration");
|
|
// const tx = await contractWithSigner.vote(eOption);
|
|
// console.timeEnd("voteDuration");
|
|
// console.log(`Voted for option ${taskArguments.option}!`);
|
|
// });
|