Smart Contract Details

Open on Dero Explorer
Internal ID:
49777
Block:
Timestamp:
2025-05-16 20:08:52 UTC (2 months ago)
Creator:
goodwallet (1770683)
Raw Data:
[{"name":"SC_ACTION","datatype":"U","value":1},{"name":"SC_CODE","datatype":"S","value":"Function InitializePrivate() Uint64\n10 IF init() == 0 THEN GOTO 30\n20 RETURN 1\n30 STORE(\"nameHdr\", \"tela.html\")\n31 STORE(\"descrHdr\", \"AS's Playground Live\")\n32 STORE(\"iconURLHdr\", \"\")\n33 STORE(\"dURL\", \"AS's Playground Live\")\n34 STORE(\"docType\", \"TELA-HTML-1\")\n35 STORE(\"subDir\", \"\")\n36 STORE(\"fileCheckC\", \"2b95ad57b8568be9ed1bb9f09e7445c659154ff86df2fc88f5c026cb87b0edb7\")\n37 STORE(\"fileCheckS\", \"a371a5c8ae374780670b0110abb49854f3003883d1c9c50238d38915f301dd0\")\n100 RETURN 0\nEnd Function\n\nFunction init() Uint64\n10 IF EXISTS(\"owner\") == 0 THEN GOTO 30\n20 RETURN 1\n30 STORE(\"owner\", address())\n50 STORE(\"docVersion\", \"1.0.0\")\n60 STORE(\"hash\", HEX(TXID()))\n70 STORE(\"likes\", 0)\n80 STORE(\"dislikes\", 0)\n100 RETURN 0\nEnd Function\n\nFunction address() String\n10 DIM s as String\n20 LET s = SIGNER()\n30 IF IS_ADDRESS_VALID(s) THEN GOTO 50\n40 RETURN \"anon\"\n50 RETURN ADDRESS_STRING(s)\nEnd Function\n\nFunction Rate(r Uint64) Uint64\n10 DIM addr as String\n15 LET addr = address()\n16 IF r \u003c 100 \u0026\u0026 EXISTS(addr) == 0 \u0026\u0026 addr != \"anon\" THEN GOTO 30\n20 RETURN 1\n30 STORE(addr, \"\"+r+\"_\"+BLOCK_HEIGHT())\n40 IF r \u003c 50 THEN GOTO 70\n50 STORE(\"likes\", LOAD(\"likes\")+1)\n60 RETURN 0\n70 STORE(\"dislikes\", LOAD(\"dislikes\")+1)\n100 RETURN 0\nEnd Function\n\n/*\n\u003c!DOCTYPE html\u003e\n\u003chtml lang=\"en\"\u003e\n\u003chead\u003e\n\u003ctitle\u003eAS's Playground Live\u003c/title\u003e\n\u003cmeta charset=\"utf-8\"\u003e\n\u003cmeta name=\"viewport\" content=\"width=device-width, initial-scale=1\"\u003e\n\n\u003clink rel=\"stylesheet\" type=\"text/css\" href=\"style.css\"\u003e\n\u003cscript src=\"header.js\" type=\"text/javascript\" defer\u003e\u003c/script\u003e\n\u003cscript src=\"nav.js\" type=\"text/javascript\" defer\u003e\u003c/script\u003e\n\u003cscript src=\"footer.js\" type=\"text/javascript\" defer\u003e\u003c/script\u003e\n\u003cscript src=\"main.js\"\u003e\u003c/script\u003e\n\u003c/head\u003e\n\u003cbody\u003e\n  \n  \u003cheader\u003e\u003cheader-component\u003e\u003c/header-component\u003e\u003c/header\u003e\n  \u003cdiv class=\"sticky\";\u003e\n    \u003cnav\u003e\u003cdiv class=\"marginside\";\u003e\u003cnav-component\u003e\u003c/nav-component\u003e\u003c/div\u003e\u003c/nav\u003e\n  \u003c/div\u003e\n\n\n\u003csection\u003e\n  \u003caside\u003e\n    \u003cp\u003e\u003cstrong\u003e\u003c/srong\u003eTELA\u003c/strong\u003e\u003cp\u003e\n    \u003cli\u003e\u003ca class=\"side\" href=\"#Links to another SCID\"\u003eLinks to another SCID\u003c/a\u003e\u003c/li\u003e\n    \u003cli\u003e\u003ca class=\"side\" href=\"#Terminal Things\"\u003eTerminal Things\u003c/a\u003e\u003c/li\u003e\n  \u003c/aside\u003e\n\n  \u003carticle\u003e\n    \u003ch1\u003eTELA\u003c/h1\u003e\n    \u003cp\u003eThings I learned, found out about.\u003c/p\u003e\n    \u003ch2 id=\"Links to another SCID\" class=\"anchored\"\u003eLinks to another SCID\u003c/h2\u003e\n    \u003chr\u003e\n    \u003cp\u003eTo make a link to another Webapp.\u003c/p\u003e\n    \u003cp\u003e\u003ccode\u003etela://open/scid\u003c/code\u003e\u003c/p\u003e\n      \n      \u003cp\u003eFor example if you want to make a link to a certain page from another SCID it would be something like this:\u003c/p\u003e\n      \u003cp\u003e\u003ccode\u003etela://open/scid/somepage.html\u003c/code\u003e\u003c/p\u003e\n        \n      \u003cp\u003eTo get rid of all the secrets, here the copy/pasta of the total line of code, use it for no less than great links, forget about the silly ones.\u003c/p\u003e\n      \u003cp\u003e\u003ccode\u003e\u0026lta href=\"#\" onclick='sendData({ jsonrpc: \"2.0\", id: \"1\", method: \"HandleTELALinks\", params: { telaLink: \"tela://open/\u0026ltSCID here\u0026gt\" } }); return false;'\u0026gtFor example name of the dApp here\u0026lt/a\u0026gt\u003c/code\u003e\u003c/p\u003e\n      \u003cpre\u003e\u003cp\u003e\u003ccode\u003ehtml\n\n\u0026lta href=\"#\"\n     onclick='sendData({\n       jsonrpc: \"2.0\",\n       id: \"1\",\n       method: \"HandleTELALinks\",\n       params: { telaLink: \"tela://open/\u0026ltSCID here\u0026gt\" }\n     }); return false;'\u0026gt\n     For example name of the dApp\n\u0026lt/a\u0026gt\u003c/code\u003e\u003c/p\u003e\n\u003c/pre\u003e\n\n\u003ch3\u003eExplanation:\u003c/h3\u003e\n\u003cul\u003e\n\u003cp\u003e\u003cli\u003e\u003ccode\u003e\u0026lt;a href=\"#\"\u0026gt;\u003c/code\u003e: This creates a hyperlink. The href=\"#\" means it doesn\u0026rsquo;t navigate anywhere by default (it's a placeholder).\u003c/li\u003e\u003c/p\u003e\n\u003cp\u003e\u003cli\u003e\u003ccode\u003eonclick='...'\u003c/code\u003e: When the user clicks this link, JavaScript inside this handler will execute.\u003c/li\u003e\u003c/p\u003e\n\u003cp\u003e\u003cli\u003e\u003ccode\u003esendData({...})\u003c/code\u003e: This calls a JavaScript function named sendData and passes it an object. This object appears to follow the JSON-RPC 2.0 specification, a common protocol for remote procedure calls (RPCs).\u003c/li\u003e\u003c/p\u003e\n\u003c/ul\u003e\n\u003ch4\u003eThe object inside \u003ccode\u003esendData()\u003c/code\u003e includes:\u003c/h4\u003e\n\u003cul\u003e\n\u003cp\u003e\u003cli\u003e\u003ccode\u003ejsonrpc: \"2.0\"\u003c/code\u003e: Indicates this is a JSON-RPC 2.0 request.\u003c/li\u003e\u003c/p\u003e\n\u003cp\u003e\u003cli\u003e\u003ccode\u003eid: \"1\"\u003c/code\u003e: A request identifier (can be used to match responses).\u003c/li\u003e\u003c/p\u003e\n\u003cp\u003e\u003cli\u003e\u003ccode\u003emethod: \"HandleTELALinks\"\u003c/code\u003e: The method being invoked on the server or endpoint.\u003c/li\u003e\u003c/p\u003e\n\u003cp\u003e\u003cli\u003e\u003ccode\u003eparams: { telaLink: \"tela://open/\u0026lt;SCID here\u0026gt;\" }\u003c/code\u003e: The parameters to the method. In this case, telaLink is a custom URI scheme (tela://) with a placeholder for a SCID (Smart Contract ID or similar unique identifier).\u003c/li\u003e\u003c/p\u003e\n\u003cp\u003e\u003cli\u003e\u003ccode\u003ereturn false;\u003c/code\u003e: Prevents the default action of the \u0026lt;a\u0026gt; tag (which would be to jump to the top of the page due to href=\"#\").\u003c/li\u003e\u003c/p\u003e\n\u003c/ul\u003e\n\n\n      \n        \u003ch2 id=\"Terminal Things\" class=\"anchored\"\u003eTerminal Things\u003c/h2\u003e\n        \u003chr\u003e\n        \u003cp\u003eQ: Is there a way to escape out of an install other than closing the terminal?\u003c/p\u003e\n        \u003cp\u003eAt any point `ctrl+d` can be used to go back to the main prompt.\u003c/p\u003e\n        \u003cp\u003e\u003ccode\u003ectrl+d\u003c/code\u003e\u003c/p\u003e\n\n        \u003cbr\u003e\n\u003chr\u003e\n    \u003csvg style=\"height: 150px; max-width: 95%;\" id=\"titleImg\" data-name=\"titleImg\" xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 1784.46 832.8\"\u003e\n      \u003cg id=\"Text\"\u003e\n          \u003cpolygon class=\"cls-3\"\n              points=\".27 118.61 712.59 118.61 712.59 237.61 356.69 237.61 356.69 714.18 237.26 714.18 237.26 237.61 0 237.61 .27 118.61\" /\u003e\n          \u003crect class=\"cls-3\" x=\"475.31\" y=\"356.72\" width=\"237.27\" height=\"119.41\" /\u003e\n          \u003cpolygon class=\"cls-3\"\n              points=\"475.27 594.79 831.2 594.79 831.2 118.61 950.62 118.61 950.62 594.79 1188.68 594.79 1188.68 118.61 1784.46 713.61 1615.41 713.61 1308.06 406.95 1308.06 713.61 475.27 713.61 475.27 594.79\" /\u003e\n          \u003crect class=\"cls-2\" x=\"356.69\" y=\"714.2\" width=\"118.61\" height=\"118.61\" /\u003e\n          \u003crect class=\"cls-1\" x=\"712.59\" width=\"118.61\" height=\"118.61\" /\u003e\n      \u003c/g\u003e\n  \u003c/svg\u003e\n  \u003c/article\u003e\n\n\u003c/section\u003e\n\n\n\u003cfooter-component\u003e\u003c/footer-component\u003e\n\n\n\n\u003c/body\u003e\n\u003c/html\u003e\n\n*/"}]
Code:
Function InitializePrivate() Uint64
10 IF init() == 0 THEN GOTO 30
20 RETURN 1
30 STORE("nameHdr", "tela.html")
31 STORE("descrHdr", "AS's Playground Live")
32 STORE("iconURLHdr", "")
33 STORE("dURL", "AS's Playground Live")
34 STORE("docType", "TELA-HTML-1")
35 STORE("subDir", "")
36 STORE("fileCheckC", "2b95ad57b8568be9ed1bb9f09e7445c659154ff86df2fc88f5c026cb87b0edb7")
37 STORE("fileCheckS", "a371a5c8ae374780670b0110abb49854f3003883d1c9c50238d38915f301dd0")
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

/*
<!DOCTYPE html>
<html lang="en">
<head>
<title>AS's Playground Live</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">

<link rel="stylesheet" type="text/css" href="style.css">
<script src="header.js" type="text/javascript" defer></script>
<script src="nav.js" type="text/javascript" defer></script>
<script src="footer.js" type="text/javascript" defer></script>
<script src="main.js"></script>
</head>
<body>
  
  <header><header-component></header-component></header>
  <div class="sticky";>
    <nav><div class="marginside";><nav-component></nav-component></div></nav>
  </div>


<section>
  <aside>
    <p><strong></srong>TELA</strong><p>
    <li><a class="side" href="#Links to another SCID">Links to another SCID</a></li>
    <li><a class="side" href="#Terminal Things">Terminal Things</a></li>
  </aside>

  <article>
    <h1>TELA</h1>
    <p>Things I learned, found out about.</p>
    <h2 id="Links to another SCID" class="anchored">Links to another SCID</h2>
    <hr>
    <p>To make a link to another Webapp.</p>
    <p><code>tela://open/scid</code></p>
      
      <p>For example if you want to make a link to a certain page from another SCID it would be something like this:</p>
      <p><code>tela://open/scid/somepage.html</code></p>
        
      <p>To get rid of all the secrets, here the copy/pasta of the total line of code, use it for no less than great links, forget about the silly ones.</p>
      <p><code>&lta href="#" onclick='sendData({ jsonrpc: "2.0", id: "1", method: "HandleTELALinks", params: { telaLink: "tela://open/&ltSCID here&gt" } }); return false;'&gtFor example name of the dApp here&lt/a&gt</code></p>
      <pre><p><code>html

&lta href="#"
     onclick='sendData({
       jsonrpc: "2.0",
       id: "1",
       method: "HandleTELALinks",
       params: { telaLink: "tela://open/&ltSCID here&gt" }
     }); return false;'&gt
     For example name of the dApp
&lt/a&gt</code></p>
</pre>

<h3>Explanation:</h3>
<ul>
<p><li><code>&lt;a href="#"&gt;</code>: This creates a hyperlink. The href="#" means it doesn&rsquo;t navigate anywhere by default (it's a placeholder).</li></p>
<p><li><code>onclick='...'</code>: When the user clicks this link, JavaScript inside this handler will execute.</li></p>
<p><li><code>sendData({...})</code>: This calls a JavaScript function named sendData and passes it an object. This object appears to follow the JSON-RPC 2.0 specification, a common protocol for remote procedure calls (RPCs).</li></p>
</ul>
<h4>The object inside <code>sendData()</code> includes:</h4>
<ul>
<p><li><code>jsonrpc: "2.0"</code>: Indicates this is a JSON-RPC 2.0 request.</li></p>
<p><li><code>id: "1"</code>: A request identifier (can be used to match responses).</li></p>
<p><li><code>method: "HandleTELALinks"</code>: The method being invoked on the server or endpoint.</li></p>
<p><li><code>params: { telaLink: "tela://open/&lt;SCID here&gt;" }</code>: The parameters to the method. In this case, telaLink is a custom URI scheme (tela://) with a placeholder for a SCID (Smart Contract ID or similar unique identifier).</li></p>
<p><li><code>return false;</code>: Prevents the default action of the &lt;a&gt; tag (which would be to jump to the top of the page due to href="#").</li></p>
</ul>


      
        <h2 id="Terminal Things" class="anchored">Terminal Things</h2>
        <hr>
        <p>Q: Is there a way to escape out of an install other than closing the terminal?</p>
        <p>At any point `ctrl+d` can be used to go back to the main prompt.</p>
        <p><code>ctrl+d</code></p>

        <br>
<hr>
    <svg style="height: 150px; max-width: 95%;" id="titleImg" data-name="titleImg" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1784.46 832.8">
      <g id="Text">
          <polygon class="cls-3"
              points=".27 118.61 712.59 118.61 712.59 237.61 356.69 237.61 356.69 714.18 237.26 714.18 237.26 237.61 0 237.61 .27 118.61" />
          <rect class="cls-3" x="475.31" y="356.72" width="237.27" height="119.41" />
          <polygon class="cls-3"
              points="475.27 594.79 831.2 594.79 831.2 118.61 950.62 118.61 950.62 594.79 1188.68 594.79 1188.68 118.61 1784.46 713.61 1615.41 713.61 1308.06 406.95 1308.06 713.61 475.27 713.61 475.27 594.79" />
          <rect class="cls-2" x="356.69" y="714.2" width="118.61" height="118.61" />
          <rect class="cls-1" x="712.59" width="118.61" height="118.61" />
      </g>
  </svg>
  </article>

</section>


<footer-component></footer-component>



</body>
</html>

*/