mirror of
https://github.com/luxfhe/example-blind-auction.git
synced 2026-10-30 18:13:37 +00:00
- Update to unified FHE decryption API - Update dependencies to @luxfi/contracts
42 lines
1.1 KiB
TypeScript
42 lines
1.1 KiB
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 ethers.provider.getBalance(signer.address)) <
|
|
ethers.parseEther("1.0")
|
|
) {
|
|
await luxfhe.getFunds(signer.address);
|
|
}
|
|
}
|
|
|
|
let encrypted_mint = await luxfhe.encrypt(10000000);
|
|
|
|
const token = await deploy("ExampleToken", {
|
|
from: signer.address,
|
|
args: ["token", "FHE", 10000000, encrypted_mint],
|
|
log: true,
|
|
skipIfAlreadyDeployed: true,
|
|
});
|
|
|
|
console.log(`auction fherc20 contract: `, token.address);
|
|
|
|
const voting = await deploy("Auction", {
|
|
from: signer.address,
|
|
args: [token.address, 3600],
|
|
log: true,
|
|
skipIfAlreadyDeployed: false,
|
|
});
|
|
|
|
console.log(`Auction contract: `, voting.address);
|
|
};
|
|
|
|
export default func;
|
|
func.id = "deploy_auction";
|
|
func.tags = ["Auction", "FHERC20-Auction"];
|