ваше сообщение коммита

This commit is contained in:
2025-09-24 14:46:54 +03:00
parent 76cde4b53d
commit 792282cd75
17 changed files with 631 additions and 330 deletions

View File

@@ -289,7 +289,10 @@
<span>{{ chain.name }} ({{ chain.chainId }})</span>
</label>
</div>
<small class="text-muted">Для offchainдействий целевые сети не требуются.</small>
<small class="text-muted">Выберите хотя бы одну целевую сеть для исполнения операции.</small>
<div v-if="showTargetChains && newProposal.targetChains.length === 0" class="form-error">
<small class="text-danger"> Необходимо выбрать хотя бы одну целевую сеть</small>
</div>
</div>
@@ -958,7 +961,8 @@ const isFormValid = computed(() => {
newProposal.value.governanceChainId &&
newProposal.value.operationType &&
newProposal.value.timelockHours >= 0 &&
validateOperationParams()
validateOperationParams() &&
validateTargetChains()
);
});
@@ -1069,6 +1073,14 @@ function validateOperationParams() {
}
}
function validateTargetChains() {
// Если показываем целевые сети, то должна быть выбрана хотя бы одна
if (showTargetChains.value) {
return newProposal.value.targetChains.length > 0;
}
return true;
}
function validateAddress(address) {
if (!address) return false;
// Проверяем формат Ethereum адреса
@@ -1582,22 +1594,22 @@ function encodeBurnOperation(from, amount) {
}
function encodeUpdateDLEInfoOperation(name, symbol, location, coordinates, jurisdiction, oktmo, kpp) {
// Селектор для updateDLEInfo(string,string,string,string,uint256,uint256,string[],uint256)
const selector = '0x' + ethers.keccak256(ethers.toUtf8Bytes('updateDLEInfo(string,string,string,string,uint256,uint256,string[],uint256)')).slice(0, 10);
// Селектор для _updateDLEInfo(string,string,string,string,uint256,string[],uint256)
const selector = '0x' + ethers.keccak256(ethers.toUtf8Bytes('_updateDLEInfo(string,string,string,string,uint256,string[],uint256)')).slice(0, 10);
// Кодируем параметры
const abiCoder = new ethers.AbiCoder();
const encodedData = abiCoder.encode(
['string', 'string', 'string', 'string', 'uint256', 'uint256', 'string[]', 'uint256'],
[name, symbol, location, coordinates, jurisdiction, oktmo, [], kpp] // okvedCodes пока пустой массив
['string', 'string', 'string', 'string', 'uint256', 'string[]', 'uint256'],
[name, symbol, location, coordinates, jurisdiction, [], kpp] // okvedCodes пока пустой массив
);
return selector + encodedData.slice(2);
}
function encodeUpdateQuorumOperation(quorumPercentage) {
// Селектор для updateQuorumPercentage(uint256)
const selector = '0x' + ethers.keccak256(ethers.toUtf8Bytes('updateQuorumPercentage(uint256)')).slice(0, 10);
// Селектор для _updateQuorumPercentage(uint256)
const selector = '0x' + ethers.keccak256(ethers.toUtf8Bytes('_updateQuorumPercentage(uint256)')).slice(0, 10);
// Кодируем параметр
const abiCoder = new ethers.AbiCoder();
@@ -1607,8 +1619,8 @@ function encodeUpdateQuorumOperation(quorumPercentage) {
}
function encodeUpdateChainOperation(chainId) {
// Селектор для updateCurrentChainId(uint256)
const selector = '0x' + ethers.keccak256(ethers.toUtf8Bytes('updateCurrentChainId(uint256)')).slice(0, 10);
// Селектор для _updateCurrentChainId(uint256)
const selector = '0x' + ethers.keccak256(ethers.toUtf8Bytes('_updateCurrentChainId(uint256)')).slice(0, 10);
// Кодируем параметр
const abiCoder = new ethers.AbiCoder();
@@ -2656,4 +2668,43 @@ onUnmounted(() => {
color: #28a745;
font-weight: 500;
}
/* Стили для ошибок валидации */
.form-error {
margin-top: 0.5rem;
padding: 0.5rem;
background-color: #f8d7da;
border: 1px solid #f5c6cb;
border-radius: 4px;
}
.text-danger {
color: #dc3545 !important;
}
.targets-grid {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
gap: 0.5rem;
margin-bottom: 1rem;
}
.target-item {
display: flex;
align-items: center;
gap: 0.5rem;
padding: 0.5rem;
border: 1px solid #e9ecef;
border-radius: 4px;
cursor: pointer;
transition: all 0.2s;
}
.target-item:hover {
background-color: #f8f9fa;
}
.target-item input[type="checkbox"] {
margin: 0;
}
</style>

View File

@@ -840,14 +840,14 @@ async function loadModules() {
active: m.isActive,
id: m.moduleId
})),
modulesInitialized: modulesResponse.data.modulesInitialized,
requiresGovernance: modulesResponse.data.requiresGovernance,
totalModules: modulesResponse.data.totalModules,
activeModules: modulesResponse.data.activeModules
});
// Обновляем счетчики
if (modulesResponse.data.modulesInitialized === false) {
console.log('[ModulesView] Модули для DLE не инициализированы');
if (modulesResponse.data.requiresGovernance === true) {
console.log('[ModulesView] Модули требуют инициализации через governance');
}
// Обновляем время последнего обновления