```\nfunction freezeSchains(uint nodeIndex) external allow("SkaleManager") {\n    SchainsInternal schainsInternal = SchainsInternal(contractManager.getContract("SchainsInternal"));\n    bytes32[] memory schains = schainsInternal.getActiveSchains(nodeIndex);\n    for (uint i = 0; i < schains.length; i++) {\n        Rotation memory rotation = rotations[schains[i]];\n        if (rotation.nodeIndex == nodeIndex && now < rotation.freezeUntil) {\n            continue;\n        }\n        string memory schainName = schainsInternal.getSchainName(schains[i]);\n        string memory revertMessage = "Node cannot rotate on Schain ";\n        revertMessage = revertMessage.strConcat(schainName);\n        revertMessage = revertMessage.strConcat(", occupied by Node ");\n        revertMessage = revertMessage.strConcat(rotation.nodeIndex.uint2str());\n        string memory dkgRevert = "DKG process did not finish on schain ";\n        ISkaleDKG skaleDKG = ISkaleDKG(contractManager.getContract("SkaleDKG"));\n        require(\n            skaleDKG.isLastDKGSuccessful(keccak256(abi.encodePacked(schainName))),\n            dkgRevert.strConcat(schainName));\n        require(rotation.freezeUntil < now, revertMessage);\n        \_startRotation(schains[i], nodeIndex);\n    }\n}\n```\n