waku-rlnv1-contract/deploy/003_deploy_rln_registry.ts
2024-08-26 15:49:58 -04:00

43 lines
1.2 KiB
TypeScript

import { HardhatRuntimeEnvironment } from "hardhat/types";
import { DeployFunction, DeploymentSubmission } from "hardhat-deploy/types";
const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
const { deployments, getUnnamedAccounts } = hre;
const { deploy } = deployments;
const [deployer] = await getUnnamedAccounts();
const poseidonHasherAddress = (await deployments.get("PoseidonHasher"))
.address;
const priceCalculatorAddress = (
await deployments.get("WakuSimplePriceCalculator")
).address;
const implRes = await deploy("WakuRlnRegistry_Implementation", {
contract: "WakuRlnRegistry",
from: deployer,
log: true,
});
let initializeAbi = [
"function initialize(address _poseidonHasher, address _priceCalculator)",
];
let iface = new hre.ethers.utils.Interface(initializeAbi);
const data = iface.encodeFunctionData("initialize", [
poseidonHasherAddress,
priceCalculatorAddress,
]);
await deploy("WakuRlnRegistry_Proxy", {
contract: "ERC1967Proxy",
from: deployer,
log: true,
args: [implRes.address, data],
});
};
export default func;
func.tags = ["WakuRlnRegistry"];
func.dependencies = ["PoseidonHasher", "WakuSimplePriceCalculator"];