Files
self/contracts/ignition/modules/scripts/updateRegistryCscaRoot.ts
Nesopie cd897752a6 Feat/new common (#1799)
* feat: common refactor (WIP)

* finish the rest of new-common and use new-common in circuits + contracts tests

* fix: prettier

* fix: yarn.lock

* fix: formatting

* fix: use prod urls for websocket

* fix: websocket url

* fix: remove the ||el flag
2026-03-03 11:17:56 +05:30

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/new-common/src/trees/proof";
import serialized_csca_tree from "@selfxyz/new-common/src/data/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 };
});