SC CODE: Function InitializePrivate() Uint64
10 IF init() == 0 THEN GOTO 30
20 RETURN 1
30 STORE("nameHdr", "smartcontracts.js")
31 STORE("descrHdr", "Smart contract explorer module")
32 STORE("iconURLHdr", "")
33 STORE("dURL", "explorer.tela")
34 STORE("docType", "TELA-JS-1")
35 STORE("subDir", "")
36 STORE("fileCheckC", "2d667803b35a25943b7f2a071094d4b1d48a22b8d562539a42c8623ee6fa361a")
37 STORE("fileCheckS", "2a7b5af6ed0d0e65801b8c3a84e8875741f66a6e1303dea3b9cd2c9f96a73865")
100 RETURN 0
End Function
Function init() Uint64
10 IF EXISTS("owner") == 0 THEN GOTO 30
20 RETURN 1
30 STORE("owner", address())
50 STORE("docVersion", "1.0.0")
60 STORE("hash", HEX(TXID()))
70 STORE("likes", 0)
80 STORE("dislikes", 0)
100 RETURN 0
End Function
Function address() String
10 DIM s as String
20 LET s = SIGNER()
30 IF IS_ADDRESS_VALID(s) THEN GOTO 50
40 RETURN "anon"
50 RETURN ADDRESS_STRING(s)
End Function
Function Rate(r Uint64) Uint64
10 DIM addr as String
15 LET addr = address()
16 IF r < 100 && EXISTS(addr) == 0 && addr != "anon" THEN GOTO 30
20 RETURN 1
30 STORE(addr, ""+r+"_"+BLOCK_HEIGHT())
40 IF r < 50 THEN GOTO 70
50 STORE("likes", LOAD("likes")+1)
60 RETURN 0
70 STORE("dislikes", LOAD("dislikes")+1)
100 RETURN 0
End Function
/*
({
name: 'smartcontracts',
version: '1.0.0',
renderSmartContracts: function(xswdCall) {
const html = `
<div class="enhanced-card">
<div class="card-header">
<h2 style="color: #fff; font-size: 1.6rem; font-weight: 700; margin: 0;">Smart Contract Explorer</h2>
<div class="section-info" style="color: #b3b3b3; font-size: 0.9rem; margin-top: 0.5rem;">Explore DERO smart contracts</div>
</div>
<div class="card-content">
<h3 style="color: #52c8db; margin-bottom: 1rem; font-size: 1.2rem; font-weight: 600;">Search Smart Contract</h3>
<div class="search-bar" style="margin: 1.5rem 0; display: flex; gap: 0.75rem; align-items: stretch;">
<input type="text" id="scid-input" placeholder="Enter Smart Contract ID (SCID) - 64 character hash..." maxlength="64"
style="flex: 1; padding: 0.85rem 1rem; border: 1px solid rgba(82,200,219,0.3); background: rgba(0,0,0,0.4); color: #fff; border-radius: 8px; font-family: monospace; font-size: 0.9rem;"
onkeydown="if(event.key==='Enter')window.searchSC()" />
<button onclick="window.searchSC()" style="background: rgba(82,200,219,0.15); border: 1px solid #52c8db; color: #52c8db; padding: 0.85rem 1.5rem; border-radius: 8px; cursor: pointer;">Search Contract</button>
</div>
<div style="background:rgba(185,89,182,0.05);border:1px solid rgba(185,89,182,0.2);border-radius:8px;padding:1rem;margin-bottom:1.5rem;border-left:4px solid #b959b6;">
<div style="color:#b959b6;font-weight:600;margin-bottom:0.5rem;">Quick Discovery</div>
<div style="display:flex;gap:0.5rem;flex-wrap:wrap;">
<button onclick="window.quickSearchSC('0000000000000000000000000000000000000000000000000000000000000001')"
style="background:rgba(185,89,182,0.1);border:1px solid #b959b6;color:#b959b6;padding:0.25rem 0.5rem;border-radius:4px;cursor:pointer;font-size:0.8rem;">Genesis SC</button>
<button onclick="window.discoverActiveSC()"
style="background:rgba(82,200,219,0.1);border:1px solid #52c8db;color:#52c8db;padding:0.25rem 0.5rem;border-radius:4px;cursor:pointer;font-size:0.8rem;">Discover Active</button>
</div>
</div>
<div class="how-to-section">
<h3 style="color: #52c8db; margin-bottom: 1rem; font-size: 1.2rem; font-weight: 600;">How to Find Smart Contracts</h3>
<div class="info-card" style="background: rgba(82,200,219,0.05); border: 1px solid rgba(82,200,219,0.2); border-radius: 8px; padding: 1.5rem; border-left: 4px solid #52c8db;">
<p style="margin-bottom: 1rem; color: #fff; line-height: 1.5;">Smart contracts require specific SCIDs to search. Here are ways to find them:</p>
<ul style="color: #b3b3b3; margin-left: 1.5rem; line-height: 1.6;">
<li style="margin-bottom: 0.5rem;">Look for SC transactions in the transaction explorer</li>
<li style="margin-bottom: 0.5rem;">Check recent blocks for smart contract deployments</li>
<li style="margin-bottom: 0.5rem;">Use the "Discover Active" button to scan recent blocks</li>
<li style="margin-bottom: 0.5rem; color: #52c8db; font-family: monospace; font-size: 0.85rem;">Example SCID: 813b020791998dbefafb72e89c812f8cb0b9c04efbe11963a1ca140e2da72eb9</li>
</ul>
</div>
</div>
<div id="sc-discovery-results" style="margin-top:1.5rem;"></div>
</div>
</div>`;
return Promise.resolve(html);
},
quickSearch: function(scid) {
console.log('QuickSearch called with SCID:', scid);
var input = document.getElementById('scid-input');
if (input) {
input.value = scid;
if (window.searchSC) {
window.searchSC();
} else {
console.log('searchSC function not available');
}
} else {
console.log('SCID input field not found');
}
},
discoverActive: function() {
console.log('DiscoverActive called');
var container = document.getElementById('sc-discovery-results');
if (container) {
container.innerHTML = '<div style="color: #4ade80;">Scanning recent blocks for smart contract activity...</div>';
}
},
searchSC: function() {
console.log('SearchSC called');
var input = document.getElementById('scid-input');
if (input && input.value.length === 64) {
window.location.hash = 'sc/' + input.value;
} else {
alert('Smart Contract ID must be exactly 64 characters');
}
},
renderSCDetails: function(scid, xswdCall) {
console.log('Rendering SC details for:', scid);
if (!scid || scid.length !== 64) {
return Promise.resolve(`
<div class="enhanced-card">
<div class="card-header">
<h2 style="color: #ef4444; font-size: 1.6rem; font-weight: 700; margin: 0;">Invalid SCID Format</h2>
</div>
<div class="card-content">
<div class="error-card" style="background: rgba(239,68,68,0.1); border: 1px solid rgba(239,68,68,0.3); border-radius: 8px; padding: 1.5rem; text-align: center;">
<h3 style="color: #ef4444; margin-bottom: 1rem;">Invalid Smart Contract ID</h3>
<p style="color: #fff; margin-bottom: 1rem;">Smart Contract IDs must be exactly 64 hexadecimal characters.</p>
<p style="color: #b3b3b3; margin-bottom: 1.5rem;">Provided: <code style="color: #ef4444; background: rgba(0,0,0,0.3); padding: 0.25rem 0.5rem; border-radius: 4px;">${scid || 'empty'}</code></p>
<button onclick="location.hash='smartcontracts'" style="background: rgba(82,200,219,0.1); border: 1px solid #52c8db; color: #52c8db; padding: 0.75rem 1.5rem; border-radius: 6px; cursor: pointer;">← Back to Search</button>
</div>
</div>
</div>
`);
}
// Get actual smart contract data from DERO daemon
return xswdCall('DERO.GetSC', {scid: scid, code: true, variables: true}).then(function(sc) {
if (!sc) {
return `
<div class="enhanced-card">
<div class="card-header">
<h2 style="color: #52c8db; font-size: 1.6rem; font-weight: 700; margin: 0;">Smart Contract Not Found</h2>
</div>
<div class="card-content">
<div class="error-card" style="background: rgba(239,68,68,0.1); border: 1px solid rgba(239,68,68,0.3); border-radius: 8px; padding: 1.5rem; text-align: center;">
<h3 style="color: #ef4444; margin-bottom: 1rem;">Contract Not Found</h3>
<p style="color: #fff; margin-bottom: 1.5rem;">No smart contract found with SCID: <code style="color: #52c8db; background: rgba(0,0,0,0.3); padding: 0.25rem 0.5rem; border-radius: 4px;">${scid.substring(0,10)}...</code></p>
<button onclick="location.hash='smartcontracts'" style="background: rgba(82,200,219,0.1); border: 1px solid #52c8db; color: #52c8db; padding: 0.75rem 1.5rem; border-radius: 6px; cursor: pointer;">← Back to Search</button>
</div>
</div>
</div>`;
}
// Extract SC data
var vars = sc.stringkeys || {};
var varCount = Object.keys(vars).length;
var balance = sc.balance || 0;
var codeLength = sc.code ? sc.code.length : 0;
// Render variables table (names only for privacy)
var varRows = '';
var keys = Object.keys(vars);
if (keys.length > 0) {
varRows = keys.map(function(key) {
return `
<div style="padding: 0.75rem 1rem; border-bottom: 1px solid rgba(255,255,255,0.05);">
<div style="color: #52c8db; font-family: monospace; font-size: 0.9rem;">${key}</div>
</div>`;
}).join('');
} else {
varRows = '<div style="color: #888; text-align: center; padding: 2rem;">No variables found</div>';
}
return `
<div class="enhanced-card">
<div class="card-header">
<h2 style="color: #b959b6; font-size: 1.6rem; font-weight: 700; margin: 0;">Smart Contract Details</h2>
<div style="color: #b3b3b3; font-size: 0.9rem; margin-top: 0.5rem;">SCID: ${scid.substring(0,16)}...</div>
</div>
<div class="card-content">
<!-- Contract Overview -->
<div style="display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 1rem; margin-bottom: 2rem;">
<div style="background: rgba(185,89,182,0.1); border: 1px solid rgba(185,89,182,0.3); padding: 1.5rem; border-radius: 8px; text-align: center;">
<div style="color: #b959b6; font-size: 1.4rem; font-weight: 700;">${(balance / 100000).toFixed(5)}</div>
<div style="color: #b3b3b3; font-size: 0.8rem; text-transform: uppercase;">Balance (DERO)</div>
</div>
<div style="background: rgba(74,222,128,0.1); border: 1px solid rgba(74,222,128,0.3); padding: 1.5rem; border-radius: 8px; text-align: center;">
<div style="color: #4ade80; font-size: 1.4rem; font-weight: 700;">${varCount}</div>
<div style="color: #b3b3b3; font-size: 0.8rem; text-transform: uppercase;">Variables</div>
</div>
<div style="background: rgba(251,191,36,0.1); border: 1px solid rgba(251,191,36,0.3); padding: 1.5rem; border-radius: 8px; text-align: center;">
<div style="color: #fbbf24; font-size: 1.4rem; font-weight: 700;">${codeLength}</div>
<div style="color: #b3b3b3; font-size: 0.8rem; text-transform: uppercase;">Code Length</div>
</div>
</div>
<!-- Contract ID -->
<div style="background: rgba(0,0,0,0.2); border: 1px solid rgba(82,200,219,0.3); padding: 1.5rem; border-radius: 8px; margin-bottom: 2rem;">
<h3 style="color: #52c8db; margin-bottom: 1rem; font-size: 1.1rem;">Contract ID (SCID)</h3>
<div style="font-family: monospace; color: #b959b6; font-size: 0.9rem; word-break: break-all; line-height: 1.4; cursor: pointer;" onclick="navigator.clipboard.writeText('${scid}')" title="Click to copy">${scid}</div>
</div>
<!-- Smart Contract Code -->
${sc.code ? `
<div style="background: rgba(0,0,0,0.2); border: 1px solid rgba(74,222,128,0.3); padding: 1.5rem; border-radius: 8px; margin-bottom: 2rem;">
<h3 style="color: #4ade80; margin-bottom: 1rem; font-size: 1.1rem;">Smart Contract Code</h3>
<div style="background: rgba(0,0,0,0.4); border-radius: 6px; padding: 1rem; max-height: 400px; overflow-y: auto;">
<pre style="margin: 0; font-family: monospace; color: #4ade80; font-size: 0.8rem; line-height: 1.4; white-space: pre-wrap;">${sc.code}</pre>
</div>
</div>
` : ''}
<!-- Contract Variables -->
<div style="background: rgba(0,0,0,0.2); border: 1px solid rgba(251,191,36,0.3); padding: 1.5rem; border-radius: 8px; margin-bottom: 2rem;">
<h3 style="color: #fbbf24; margin-bottom: 1rem; font-size: 1.1rem;">Contract Variables (${varCount})</h3>
<div style="color: #b3b3b3; font-size: 0.85rem; margin-bottom: 1rem; font-style: italic;">Variable names only (values hidden for privacy)</div>
<div style="background: rgba(0,0,0,0.3); border-radius: 6px; overflow: hidden;">
<div style="padding: 1rem; background: rgba(251,191,36,0.1); font-weight: 600; color: #fbbf24; border-bottom: 1px solid rgba(251,191,36,0.3);">
Variable Names
</div>
${varRows}
</div>
</div>
<button onclick="location.hash='smartcontracts'" style="background: rgba(82,200,219,0.1); border: 1px solid #52c8db; color: #52c8db; padding: 0.75rem 1.5rem; border-radius: 6px; cursor: pointer;">← Back to Smart Contracts</button>
</div>
</div>`;
}).catch(function(error) {
console.error('SC loading error:', error);
return `
<div class="enhanced-card">
<div class="card-header">
<h2 style="color: #ef4444; font-size: 1.6rem; font-weight: 700; margin: 0;">Smart Contract Loading Failed</h2>
</div>
<div class="card-content">
<div class="error-card" style="background: rgba(239,68,68,0.1); border: 1px solid rgba(239,68,68,0.3); border-radius: 8px; padding: 1.5rem; text-align: center;">
<h3 style="color: #ef4444; margin-bottom: 1rem;">Loading Error</h3>
<p style="color: #fff; margin-bottom: 1rem;">Failed to load smart contract: ${error.message || error}</p>
<button onclick="location.hash='smartcontracts'" style="background: rgba(82,200,219,0.1); border: 1px solid #52c8db; color: #52c8db; padding: 0.75rem 1.5rem; border-radius: 6px; cursor: pointer;">← Back to Search</button>
</div>
</div>
</div>`;
});
}
});
*/ |
SC Arguments: [Name:SC_ACTION Type:uint64 Value:'1' Name:SC_CODE Type:string Value:'Function InitializePrivate() Uint64
10 IF init() == 0 THEN GOTO 30
20 RETURN 1
30 STORE("nameHdr", "smartcontracts.js")
31 STORE("descrHdr", "Smart contract explorer module")
32 STORE("iconURLHdr", "")
33 STORE("dURL", "explorer.tela")
34 STORE("docType", "TELA-JS-1")
35 STORE("subDir", "")
36 STORE("fileCheckC", "2d667803b35a25943b7f2a071094d4b1d48a22b8d562539a42c8623ee6fa361a")
37 STORE("fileCheckS", "2a7b5af6ed0d0e65801b8c3a84e8875741f66a6e1303dea3b9cd2c9f96a73865")
100 RETURN 0
End Function
Function init() Uint64
10 IF EXISTS("owner") == 0 THEN GOTO 30
20 RETURN 1
30 STORE("owner", address())
50 STORE("docVersion", "1.0.0")
60 STORE("hash", HEX(TXID()))
70 STORE("likes", 0)
80 STORE("dislikes", 0)
100 RETURN 0
End Function
Function address() String
10 DIM s as String
20 LET s = SIGNER()
30 IF IS_ADDRESS_VALID(s) THEN GOTO 50
40 RETURN "anon"
50 RETURN ADDRESS_STRING(s)
End Function
Function Rate(r Uint64) Uint64
10 DIM addr as String
15 LET addr = address()
16 IF r < 100 && EXISTS(addr) == 0 && addr != "anon" THEN GOTO 30
20 RETURN 1
30 STORE(addr, ""+r+"_"+BLOCK_HEIGHT())
40 IF r < 50 THEN GOTO 70
50 STORE("likes", LOAD("likes")+1)
60 RETURN 0
70 STORE("dislikes", LOAD("dislikes")+1)
100 RETURN 0
End Function
/*
({
name: 'smartcontracts',
version: '1.0.0',
renderSmartContracts: function(xswdCall) {
const html = `
<div class="enhanced-card">
<div class="card-header">
<h2 style="color: #fff; font-size: 1.6rem; font-weight: 700; margin: 0;">Smart Contract Explorer</h2>
<div class="section-info" style="color: #b3b3b3; font-size: 0.9rem; margin-top: 0.5rem;">Explore DERO smart contracts</div>
</div>
<div class="card-content">
<h3 style="color: #52c8db; margin-bottom: 1rem; font-size: 1.2rem; font-weight: 600;">Search Smart Contract</h3>
<div class="search-bar" style="margin: 1.5rem 0; display: flex; gap: 0.75rem; align-items: stretch;">
<input type="text" id="scid-input" placeholder="Enter Smart Contract ID (SCID) - 64 character hash..." maxlength="64"
style="flex: 1; padding: 0.85rem 1rem; border: 1px solid rgba(82,200,219,0.3); background: rgba(0,0,0,0.4); color: #fff; border-radius: 8px; font-family: monospace; font-size: 0.9rem;"
onkeydown="if(event.key==='Enter')window.searchSC()" />
<button onclick="window.searchSC()" style="background: rgba(82,200,219,0.15); border: 1px solid #52c8db; color: #52c8db; padding: 0.85rem 1.5rem; border-radius: 8px; cursor: pointer;">Search Contract</button>
</div>
<div style="background:rgba(185,89,182,0.05);border:1px solid rgba(185,89,182,0.2);border-radius:8px;padding:1rem;margin-bottom:1.5rem;border-left:4px solid #b959b6;">
<div style="color:#b959b6;font-weight:600;margin-bottom:0.5rem;">Quick Discovery</div>
<div style="display:flex;gap:0.5rem;flex-wrap:wrap;">
<button onclick="window.quickSearchSC('0000000000000000000000000000000000000000000000000000000000000001')"
style="background:rgba(185,89,182,0.1);border:1px solid #b959b6;color:#b959b6;padding:0.25rem 0.5rem;border-radius:4px;cursor:pointer;font-size:0.8rem;">Genesis SC</button>
<button onclick="window.discoverActiveSC()"
style="background:rgba(82,200,219,0.1);border:1px solid #52c8db;color:#52c8db;padding:0.25rem 0.5rem;border-radius:4px;cursor:pointer;font-size:0.8rem;">Discover Active</button>
</div>
</div>
<div class="how-to-section">
<h3 style="color: #52c8db; margin-bottom: 1rem; font-size: 1.2rem; font-weight: 600;">How to Find Smart Contracts</h3>
<div class="info-card" style="background: rgba(82,200,219,0.05); border: 1px solid rgba(82,200,219,0.2); border-radius: 8px; padding: 1.5rem; border-left: 4px solid #52c8db;">
<p style="margin-bottom: 1rem; color: #fff; line-height: 1.5;">Smart contracts require specific SCIDs to search. Here are ways to find them:</p>
<ul style="color: #b3b3b3; margin-left: 1.5rem; line-height: 1.6;">
<li style="margin-bottom: 0.5rem;">Look for SC transactions in the transaction explorer</li>
<li style="margin-bottom: 0.5rem;">Check recent blocks for smart contract deployments</li>
<li style="margin-bottom: 0.5rem;">Use the "Discover Active" button to scan recent blocks</li>
<li style="margin-bottom: 0.5rem; color: #52c8db; font-family: monospace; font-size: 0.85rem;">Example SCID: 813b020791998dbefafb72e89c812f8cb0b9c04efbe11963a1ca140e2da72eb9</li>
</ul>
</div>
</div>
<div id="sc-discovery-results" style="margin-top:1.5rem;"></div>
</div>
</div>`;
return Promise.resolve(html);
},
quickSearch: function(scid) {
console.log('QuickSearch called with SCID:', scid);
var input = document.getElementById('scid-input');
if (input) {
input.value = scid;
if (window.searchSC) {
window.searchSC();
} else {
console.log('searchSC function not available');
}
} else {
console.log('SCID input field not found');
}
},
discoverActive: function() {
console.log('DiscoverActive called');
var container = document.getElementById('sc-discovery-results');
if (container) {
container.innerHTML = '<div style="color: #4ade80;">Scanning recent blocks for smart contract activity...</div>';
}
},
searchSC: function() {
console.log('SearchSC called');
var input = document.getElementById('scid-input');
if (input && input.value.length === 64) {
window.location.hash = 'sc/' + input.value;
} else {
alert('Smart Contract ID must be exactly 64 characters');
}
},
renderSCDetails: function(scid, xswdCall) {
console.log('Rendering SC details for:', scid);
if (!scid || scid.length !== 64) {
return Promise.resolve(`
<div class="enhanced-card">
<div class="card-header">
<h2 style="color: #ef4444; font-size: 1.6rem; font-weight: 700; margin: 0;">Invalid SCID Format</h2>
</div>
<div class="card-content">
<div class="error-card" style="background: rgba(239,68,68,0.1); border: 1px solid rgba(239,68,68,0.3); border-radius: 8px; padding: 1.5rem; text-align: center;">
<h3 style="color: #ef4444; margin-bottom: 1rem;">Invalid Smart Contract ID</h3>
<p style="color: #fff; margin-bottom: 1rem;">Smart Contract IDs must be exactly 64 hexadecimal characters.</p>
<p style="color: #b3b3b3; margin-bottom: 1.5rem;">Provided: <code style="color: #ef4444; background: rgba(0,0,0,0.3); padding: 0.25rem 0.5rem; border-radius: 4px;">${scid || 'empty'}</code></p>
<button onclick="location.hash='smartcontracts'" style="background: rgba(82,200,219,0.1); border: 1px solid #52c8db; color: #52c8db; padding: 0.75rem 1.5rem; border-radius: 6px; cursor: pointer;">← Back to Search</button>
</div>
</div>
</div>
`);
}
// Get actual smart contract data from DERO daemon
return xswdCall('DERO.GetSC', {scid: scid, code: true, variables: true}).then(function(sc) {
if (!sc) {
return `
<div class="enhanced-card">
<div class="card-header">
<h2 style="color: #52c8db; font-size: 1.6rem; font-weight: 700; margin: 0;">Smart Contract Not Found</h2>
</div>
<div class="card-content">
<div class="error-card" style="background: rgba(239,68,68,0.1); border: 1px solid rgba(239,68,68,0.3); border-radius: 8px; padding: 1.5rem; text-align: center;">
<h3 style="color: #ef4444; margin-bottom: 1rem;">Contract Not Found</h3>
<p style="color: #fff; margin-bottom: 1.5rem;">No smart contract found with SCID: <code style="color: #52c8db; background: rgba(0,0,0,0.3); padding: 0.25rem 0.5rem; border-radius: 4px;">${scid.substring(0,10)}...</code></p>
<button onclick="location.hash='smartcontracts'" style="background: rgba(82,200,219,0.1); border: 1px solid #52c8db; color: #52c8db; padding: 0.75rem 1.5rem; border-radius: 6px; cursor: pointer;">← Back to Search</button>
</div>
</div>
</div>`;
}
// Extract SC data
var vars = sc.stringkeys || {};
var varCount = Object.keys(vars).length;
var balance = sc.balance || 0;
var codeLength = sc.code ? sc.code.length : 0;
// Render variables table (names only for privacy)
var varRows = '';
var keys = Object.keys(vars);
if (keys.length > 0) {
varRows = keys.map(function(key) {
return `
<div style="padding: 0.75rem 1rem; border-bottom: 1px solid rgba(255,255,255,0.05);">
<div style="color: #52c8db; font-family: monospace; font-size: 0.9rem;">${key}</div>
</div>`;
}).join('');
} else {
varRows = '<div style="color: #888; text-align: center; padding: 2rem;">No variables found</div>';
}
return `
<div class="enhanced-card">
<div class="card-header">
<h2 style="color: #b959b6; font-size: 1.6rem; font-weight: 700; margin: 0;">Smart Contract Details</h2>
<div style="color: #b3b3b3; font-size: 0.9rem; margin-top: 0.5rem;">SCID: ${scid.substring(0,16)}...</div>
</div>
<div class="card-content">
<!-- Contract Overview -->
<div style="display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 1rem; margin-bottom: 2rem;">
<div style="background: rgba(185,89,182,0.1); border: 1px solid rgba(185,89,182,0.3); padding: 1.5rem; border-radius: 8px; text-align: center;">
<div style="color: #b959b6; font-size: 1.4rem; font-weight: 700;">${(balance / 100000).toFixed(5)}</div>
<div style="color: #b3b3b3; font-size: 0.8rem; text-transform: uppercase;">Balance (DERO)</div>
</div>
<div style="background: rgba(74,222,128,0.1); border: 1px solid rgba(74,222,128,0.3); padding: 1.5rem; border-radius: 8px; text-align: center;">
<div style="color: #4ade80; font-size: 1.4rem; font-weight: 700;">${varCount}</div>
<div style="color: #b3b3b3; font-size: 0.8rem; text-transform: uppercase;">Variables</div>
</div>
<div style="background: rgba(251,191,36,0.1); border: 1px solid rgba(251,191,36,0.3); padding: 1.5rem; border-radius: 8px; text-align: center;">
<div style="color: #fbbf24; font-size: 1.4rem; font-weight: 700;">${codeLength}</div>
<div style="color: #b3b3b3; font-size: 0.8rem; text-transform: uppercase;">Code Length</div>
</div>
</div>
<!-- Contract ID -->
<div style="background: rgba(0,0,0,0.2); border: 1px solid rgba(82,200,219,0.3); padding: 1.5rem; border-radius: 8px; margin-bottom: 2rem;">
<h3 style="color: #52c8db; margin-bottom: 1rem; font-size: 1.1rem;">Contract ID (SCID)</h3>
<div style="font-family: monospace; color: #b959b6; font-size: 0.9rem; word-break: break-all; line-height: 1.4; cursor: pointer;" onclick="navigator.clipboard.writeText('${scid}')" title="Click to copy">${scid}</div>
</div>
<!-- Smart Contract Code -->
${sc.code ? `
<div style="background: rgba(0,0,0,0.2); border: 1px solid rgba(74,222,128,0.3); padding: 1.5rem; border-radius: 8px; margin-bottom: 2rem;">
<h3 style="color: #4ade80; margin-bottom: 1rem; font-size: 1.1rem;">Smart Contract Code</h3>
<div style="background: rgba(0,0,0,0.4); border-radius: 6px; padding: 1rem; max-height: 400px; overflow-y: auto;">
<pre style="margin: 0; font-family: monospace; color: #4ade80; font-size: 0.8rem; line-height: 1.4; white-space: pre-wrap;">${sc.code}</pre>
</div>
</div>
` : ''}
<!-- Contract Variables -->
<div style="background: rgba(0,0,0,0.2); border: 1px solid rgba(251,191,36,0.3); padding: 1.5rem; border-radius: 8px; margin-bottom: 2rem;">
<h3 style="color: #fbbf24; margin-bottom: 1rem; font-size: 1.1rem;">Contract Variables (${varCount})</h3>
<div style="color: #b3b3b3; font-size: 0.85rem; margin-bottom: 1rem; font-style: italic;">Variable names only (values hidden for privacy)</div>
<div style="background: rgba(0,0,0,0.3); border-radius: 6px; overflow: hidden;">
<div style="padding: 1rem; background: rgba(251,191,36,0.1); font-weight: 600; color: #fbbf24; border-bottom: 1px solid rgba(251,191,36,0.3);">
Variable Names
</div>
${varRows}
</div>
</div>
<button onclick="location.hash='smartcontracts'" style="background: rgba(82,200,219,0.1); border: 1px solid #52c8db; color: #52c8db; padding: 0.75rem 1.5rem; border-radius: 6px; cursor: pointer;">← Back to Smart Contracts</button>
</div>
</div>`;
}).catch(function(error) {
console.error('SC loading error:', error);
return `
<div class="enhanced-card">
<div class="card-header">
<h2 style="color: #ef4444; font-size: 1.6rem; font-weight: 700; margin: 0;">Smart Contract Loading Failed</h2>
</div>
<div class="card-content">
<div class="error-card" style="background: rgba(239,68,68,0.1); border: 1px solid rgba(239,68,68,0.3); border-radius: 8px; padding: 1.5rem; text-align: center;">
<h3 style="color: #ef4444; margin-bottom: 1rem;">Loading Error</h3>
<p style="color: #fff; margin-bottom: 1rem;">Failed to load smart contract: ${error.message || error}</p>
<button onclick="location.hash='smartcontracts'" style="background: rgba(82,200,219,0.1); border: 1px solid #52c8db; color: #52c8db; padding: 0.75rem 1.5rem; border-radius: 6px; cursor: pointer;">← Back to Search</button>
</div>
</div>
</div>`;
});
}
});
*/'] |