waku-rlnv1-contract/deploy/002_deploy_rln_registry.ts
Aaryamann Challani 19fded82bc
feat(WakuRlnRegistry): uups proxy (#9)
* feat(WakuRlnRegistry): uups proxy

* feat: deployments
2023-09-11 09:31:16 +05:30

34 lines
1.0 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 implRes = await deploy("WakuRlnRegistry_Implementation", {
contract: "WakuRlnRegistry",
from: deployer,
log: true,
});
let initializeAbi = ["function initialize(address _poseidonHasher)"];
let iface = new hre.ethers.utils.Interface(initializeAbi);
const data = iface.encodeFunctionData("initialize", [poseidonHasherAddress]);
await deploy("WakuRlnRegistry_Proxy", {
contract: "ERC1967Proxy",
from: deployer,
log: true,
args: [implRes.address, data],
});
};
export default func;
func.tags = ["WakuRlnRegistry"];
func.dependencies = ["PoseidonHasher"];