Files
DLE/backend/scripts/check-modules.js
2025-10-15 21:43:18 +03:00

67 lines
2.4 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/**
* Copyright (c) 2024-2025 Тарабанов Александр Викторович
* All rights reserved.
*
* This software is proprietary and confidential.
* Unauthorized copying, modification, or distribution is prohibited.
*
* For licensing inquiries: info@hb3-accelerator.com
* Website: https://hb3-accelerator.com
* GitHub: https://github.com/HB3-ACCELERATOR
*/
const { ethers } = require('ethers');
async function checkModules() {
try {
// Адрес DLE контракта
const dleAddress = '0xCaa85e96a6929F0373442e31FD9888d985869EcE';
// RPC URL для Sepolia
// Получаем RPC URL из базы данных
const rpcService = require('../services/rpcProviderService');
const rpcUrl = await rpcService.getRpcUrlByChainId(11155111);
const provider = new ethers.JsonRpcProvider(await rpcService.getRpcUrlByChainId(11155111));
// ABI для DLE контракта
const dleAbi = [
"function initializer() external view returns (address)",
"function isModuleActive(bytes32 _moduleId) external view returns (bool)",
"function getModuleAddress(bytes32 _moduleId) external view returns (address)"
];
const dle = new ethers.Contract(dleAddress, dleAbi, provider);
// Модули теперь инициализируются только через governance
console.log('Модули инициализируются только через governance предложения');
// Получаем initializer адрес
const initializer = await dle.initializer();
console.log('Initializer адрес:', initializer);
// Проверяем модули
const moduleIds = {
treasury: ethers.keccak256(ethers.toUtf8Bytes("TREASURY")),
timelock: ethers.keccak256(ethers.toUtf8Bytes("TIMELOCK")),
reader: ethers.keccak256(ethers.toUtf8Bytes("READER"))
};
console.log('\nПроверка модулей:');
for (const [name, moduleId] of Object.entries(moduleIds)) {
try {
const isActive = await dle.isModuleActive(moduleId);
const address = await dle.getModuleAddress(moduleId);
console.log(`${name}: активен=${isActive}, адрес=${address}`);
} catch (error) {
console.log(`${name}: ошибка - ${error.message}`);
}
}
} catch (error) {
console.error('Ошибка:', error);
}
}
checkModules();