mirror of
https://github.com/luxfhe/example-playground.git
synced 2026-10-30 18:13:21 +00:00
30 lines
855 B
TypeScript
30 lines
855 B
TypeScript
import { DeployFunction } from "hardhat-deploy/types";
|
|
import { HardhatRuntimeEnvironment } from "hardhat/types";
|
|
|
|
const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
|
|
const { luxfhe, ethers } = hre;
|
|
const { deploy } = hre.deployments;
|
|
const [signer] = await ethers.getSigners();
|
|
|
|
if (hre.network.name === "localluxfhe") {
|
|
if (await signer.getBalance() < ethers.utils.parseEther("1.0")) {
|
|
await luxfhe.getFunds(signer.address);
|
|
}
|
|
}
|
|
|
|
let encryptedBalance = await luxfhe.encrypt(100);
|
|
|
|
const counter = await deploy("ExampleToken", {
|
|
from: signer.address,
|
|
args: ["Test Token", "FHE", 1000, encryptedBalance],
|
|
log: true,
|
|
skipIfAlreadyDeployed: true,
|
|
});
|
|
|
|
console.log(`fherc20 contract: `, counter.address);
|
|
};
|
|
|
|
export default func;
|
|
func.id = "deploy_fherc20";
|
|
func.tags = ["FHERC20"];
|