2023-03-29 11:58:09 +05:30
|
|
|
import { HardhatRuntimeEnvironment } from "hardhat/types";
|
2023-09-11 09:31:16 +05:30
|
|
|
import { DeployFunction, DeploymentSubmission } from "hardhat-deploy/types";
|
2023-03-29 11:58:09 +05:30
|
|
|
|
|
|
|
|
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;
|
|
|
|
|
|
2023-09-11 09:31:16 +05:30
|
|
|
const implRes = await deploy("WakuRlnRegistry_Implementation", {
|
|
|
|
|
contract: "WakuRlnRegistry",
|
2023-03-29 11:58:09 +05:30
|
|
|
from: deployer,
|
|
|
|
|
log: true,
|
2023-09-11 09:31:16 +05:30
|
|
|
});
|
|
|
|
|
|
2024-04-22 14:34:28 -04:00
|
|
|
let initializeAbi = [
|
|
|
|
|
"function initialize(address _poseidonHasher, uint40 _ttl)",
|
|
|
|
|
];
|
2023-09-11 09:31:16 +05:30
|
|
|
let iface = new hre.ethers.utils.Interface(initializeAbi);
|
2024-04-22 14:34:28 -04:00
|
|
|
const data = iface.encodeFunctionData("initialize", [
|
|
|
|
|
poseidonHasherAddress,
|
|
|
|
|
0,
|
|
|
|
|
]);
|
2023-09-11 09:31:16 +05:30
|
|
|
|
|
|
|
|
await deploy("WakuRlnRegistry_Proxy", {
|
|
|
|
|
contract: "ERC1967Proxy",
|
|
|
|
|
from: deployer,
|
|
|
|
|
log: true,
|
|
|
|
|
args: [implRes.address, data],
|
2023-03-29 11:58:09 +05:30
|
|
|
});
|
|
|
|
|
};
|
2023-07-03 18:15:38 +05:30
|
|
|
|
2023-03-29 11:58:09 +05:30
|
|
|
export default func;
|
2023-08-03 17:20:25 +05:30
|
|
|
func.tags = ["WakuRlnRegistry"];
|
2023-07-03 18:15:38 +05:30
|
|
|
func.dependencies = ["PoseidonHasher"];
|