Files
self/contracts/ignition/modules/scripts/updateRegistryCscaRoot.ts
Justin Hernandez fc472915e6 refactor: remove namespace imports (#969)
* refactor: remove namespace imports

* refactor: use named fs imports

* refactor(app): replace path and fs namespace imports

* format

* format
2025-08-27 20:59:26 -07:00

23 lines
1.1 KiB
TypeScript

import { buildModule } from "@nomicfoundation/hardhat-ignition/modules";
import hre from "hardhat";
import { readFileSync } from "fs";
import path from "path";
import { getCscaTreeRoot } from "@selfxyz/common/utils/trees";
import serialized_csca_tree from "../../../../common/pubkeys/serialized_csca_tree.json";
module.exports = buildModule("UpdateRegistryCscaRoot", (m) => {
const networkName = hre.network.config.chainId;
const deployedAddressesPath = path.join(__dirname, `../../deployments/chain-${networkName}/deployed_addresses.json`);
const deployedAddresses = JSON.parse(readFileSync(deployedAddressesPath, "utf8"));
const registryAddress = deployedAddresses["DeployRegistryModule#IdentityRegistry"];
const deployedRegistryInstance = m.contractAt("IdentityRegistryImplV1", registryAddress);
console.log("Deployed registry instance", deployedRegistryInstance);
const merkleRoot = getCscaTreeRoot(serialized_csca_tree);
console.log("Merkle root", merkleRoot);
m.call(deployedRegistryInstance, "updateCscaRoot", [merkleRoot]);
return { deployedRegistryInstance };
});