Files
self/contracts/ignition/modules/deployRegistry.ts
turboblitz 6d4c211c51 New OFAC updates (#47)
Co-authored-by: nicoshark <i.am.nicoshark@gmail.com>
2025-02-12 22:21:01 +01:00

36 lines
1.1 KiB
TypeScript

import { buildModule } from "@nomicfoundation/hardhat-ignition/modules";
import { artifacts } from "hardhat";
import { ethers } from "ethers";
export default buildModule("DeployRegistryModule", (m) => {
// Deploy PoseidonT3
const poseidonT3 = m.library("PoseidonT3");
// Deploy IdentityRegistryImplV1
const identityRegistryImpl = m.contract("IdentityRegistryImplV1", [], {
libraries: { PoseidonT3: poseidonT3 },
});
// Deploy registry with temporary hub address
const registryInterface = getRegistryInitializeData();
const registryInitData = registryInterface.encodeFunctionData("initialize", [
"0x0000000000000000000000000000000000000000"
]);
const registry = m.contract("IdentityRegistry", [
identityRegistryImpl,
registryInitData
]);
// Return deployed contracts
return {
poseidonT3,
identityRegistryImpl,
registry
};
});
function getRegistryInitializeData() {
const registryArtifact = artifacts.readArtifactSync("IdentityRegistryImplV1");
const registryInterface = new ethers.Interface(registryArtifact.abi);
return registryInterface;
}