Online Smart Contract Review Assistant

Online Smart Contract Review Assistant

Contract Name Vulnerabilities Found Review Date Actions

Submit Smart Contract for Review

Manual Data Input

Load your review dataset in JSON format. This will overwrite existing data.

Type: ${v.type} (${v.severity})

Line: ${v.line}

Suggestion: ${v.description}

`; }); } else { bodyHtml += `

No common vulnerabilities were automatically detected.

`; } modalBody.innerHTML = bodyHtml; reviewModal.style.display = 'block'; } } // --- Event Listeners --- tabs.forEach(button => { button.addEventListener('click', () => showTab(button.dataset.tab)); }); searchInput.addEventListener('input', filterAndRender); reviewForm.addEventListener('submit', function(e) { e.preventDefault(); const name = document.getElementById('contractName').value; const code = document.getElementById('contractCode').value; const vulnerabilities = analyzeContract(code); const newReview = { id: Date.now(), name: name, date: new Date().toISOString().split('T')[0], code: code, vulnerabilities: vulnerabilities }; reviewData.push(newReview); filterAndRender(); reviewForm.reset(); showTab('tab1'); showReviewModal(newReview.id); }); tableBody.addEventListener('click', function(e) { if (e.target.classList.contains('view-btn')) { const id = parseInt(e.target.dataset.id); showReviewModal(id); } }); downloadPdfButton.addEventListener('click', function() { if (typeof window.jspdf === 'undefined') return; const { jsPDF } = window.jspdf; const doc = new jsPDF(); doc.setFont("helvetica", "bold"); doc.setFontSize(20); doc.text("Smart Contract Review Dashboard", 105, 20, { align: 'center' }); const dataToExport = reviewData.map(item => [ item.name, item.vulnerabilities.map(v => v.type).join(', ') || 'None', item.date ]); doc.autoTable({ startY: 30, head: [['Contract Name', 'Vulnerabilities', 'Date']], body: dataToExport, theme: 'grid', headStyles: { fillColor: [41, 128, 185] } }); doc.save('contract_review_dashboard.pdf'); }); loadJsonButton.addEventListener('click', function() { try { const data = JSON.parse(jsonDataInput.value); if (Array.isArray(data)) { reviewData = data; filterAndRender(); showTab('tab1'); } } catch (e) { alert('Invalid JSON format.'); } }); loadSampleButton.addEventListener('click', function() { reviewData = JSON.parse(JSON.stringify(sampleData)); filterAndRender(); showTab('tab1'); }); clearDataButton.addEventListener('click', () => { reviewData = []; filterAndRender(); }); modalClose.addEventListener('click', () => { reviewModal.style.display = 'none'; }); window.addEventListener('click', (event) => { if (event.target == reviewModal) { reviewModal.style.display = 'none'; } }); // Initial Load loadSampleButton.click(); });
Scroll to Top