Smart Contract Details
Open on Dero ExplorerInternal ID:
30014
Hash / Transaction:
Block:
Timestamp:
2023-04-02 05:11:39 UTC (2.4 years ago)
Creator:
…qgv26xst
(1414481)
Raw Data:
[{"name":"SC_ACTION","datatype":"U","value":1},{"name":"SC_CODE","datatype":"S","value":"// Domain Validation\n\n Function InitializePrivate() Uint64\n 10 initSetup()\n 20 RETURN 0\n End Function\n\n Function SmartDNS(webURL String, webIP String, webDesc String) Uint64\n 10 dim index,min_post,max_post,active as Uint64\n 20 LET index = LOAD(\"index\") + 1\n 30 LET min_post = LOAD(\"min_post\")\n 40 LET max_post = LOAD(\"max_post\")\n 50 LET active = LOAD(\"active\")\n 60 IF active == 0 THEN GOTO 200\n 70 IF max_post \u003c index THEN GOTO 200 \n 80 IF DEROVALUE() \u003c min_post THEN GOTO 200\n 90 STORE(\"total\", LOAD(\"total\") + DEROVALUE())\n 100 STORE(\"index\", index)\n 110 STORE(\"s\" + (index-1), ADDRESS_STRING(SIGNER()))\n 120 STORE(\"w\" + (index-1), SIGNER()) \n 130 STORE(\"x\" + (index-1), webURL)\n 140 STORE(\"y\" + (index-1), webIP)\n 150 STORE(\"z\" + (index-1), webDesc)\n 200 RETURN 0\n End Function\n\n Function initSetup() Uint64\n 10 STORE(\"owner\", SIGNER())\n 20 STORE(\"version\", \"v1.0.1\")\n 30 STORE(\"readme\", \"Domain Validation\")\n 40 STORE(\"min_post\", 45000)\n 50 STORE(\"max_post\", 100)\n 60 STORE(\"index\", 0) \n 70 STORE(\"total\", 0)\n 80 STORE(\"active\", 1)\n 90 STORE(\"w\", \"DNS Signer\") \n 100 STORE(\"x\", \"www.website.com\")\n 110 STORE(\"y\", \"11.111.11.1\")\n 120 STORE(\"z\", \"Description\")\n 130 RETURN 0\n End Function\n\n Function UpdateEntry(i Uint64, webURL String, webIP String, webDesc String) Uint64\n 10 IF LOAD(\"w\" + i) == SIGNER() THEN GOTO 30\n 20 RETURN 1\n 30 STORE(\"x\" + i, webURL)\n 40 STORE(\"y\" + i, webIP)\n 50 STORE(\"z\" + i, webDesc)\n 60 RETURN 0\n End Function\n\n Function TuneParams(note String, x0 Uint64, x1 Uint64, x2 Uint64, x3 Uint64) Uint64\n 10 IF LOAD(\"owner\") == SIGNER() THEN GOTO 30\n 20 RETURN 1\n 30 STORE(\"readme\", note)\n 40 STORE(\"min_post\", x0)\n 50 STORE(\"max_post\", x1)\n 60 STORE(\"total\", x2)\n 70 STORE(\"active\", x3)\n 80 RETURN 0\n End Function\n\n Function TuneIndex(x0 Uint64) Uint64\n 10 IF LOAD(\"owner\") == SIGNER() THEN GOTO 30\n 20 RETURN 1\n 30 STORE(\"index\", x0)\n 40 RETURN 0\n End Function\n\n Function Withdraw(amount Uint64) Uint64 \n 10 IF LOAD(\"owner\") == SIGNER() THEN GOTO 30 \n 20 RETURN 1\n 30 SEND_DERO_TO_ADDRESS(SIGNER(),amount)\n 40 RETURN 0\n End Function\n\n Function TransferOwnership(newOwner String) Uint64 \n 10 IF ADDRESS_RAW(LOAD(\"owner\")) == ADDRESS_RAW(SIGNER()) THEN GOTO 30 \n 20 RETURN 1\n 30 STORE(\"tmpowner\",newOwner)\n 40 RETURN 0\n End Function\n\n Function ClaimOwnership() Uint64 \n 10 IF ADDRESS_RAW(LOAD(\"tmpowner\")) == ADDRESS_RAW(SIGNER()) THEN GOTO 30 \n 20 RETURN 1\n 30 STORE(\"owner\",SIGNER())\n 40 RETURN 0\n End Function\n\n Function UpdateCode(code String) Uint64 \n 10 IF LOAD(\"owner\") == SIGNER() THEN GOTO 30 \n 20 RETURN 1\n 30 UPDATE_SC_CODE(code)\n 40 RETURN 0\n End Function"}]
Code:
// Domain Validation
Function InitializePrivate() Uint64
10 initSetup()
20 RETURN 0
End Function
Function SmartDNS(webURL String, webIP String, webDesc String) Uint64
10 dim index,min_post,max_post,active as Uint64
20 LET index = LOAD("index") + 1
30 LET min_post = LOAD("min_post")
40 LET max_post = LOAD("max_post")
50 LET active = LOAD("active")
60 IF active == 0 THEN GOTO 200
70 IF max_post < index THEN GOTO 200
80 IF DEROVALUE() < min_post THEN GOTO 200
90 STORE("total", LOAD("total") + DEROVALUE())
100 STORE("index", index)
110 STORE("s" + (index-1), ADDRESS_STRING(SIGNER()))
120 STORE("w" + (index-1), SIGNER())
130 STORE("x" + (index-1), webURL)
140 STORE("y" + (index-1), webIP)
150 STORE("z" + (index-1), webDesc)
200 RETURN 0
End Function
Function initSetup() Uint64
10 STORE("owner", SIGNER())
20 STORE("version", "v1.0.1")
30 STORE("readme", "Domain Validation")
40 STORE("min_post", 45000)
50 STORE("max_post", 100)
60 STORE("index", 0)
70 STORE("total", 0)
80 STORE("active", 1)
90 STORE("w", "DNS Signer")
100 STORE("x", "www.website.com")
110 STORE("y", "11.111.11.1")
120 STORE("z", "Description")
130 RETURN 0
End Function
Function UpdateEntry(i Uint64, webURL String, webIP String, webDesc String) Uint64
10 IF LOAD("w" + i) == SIGNER() THEN GOTO 30
20 RETURN 1
30 STORE("x" + i, webURL)
40 STORE("y" + i, webIP)
50 STORE("z" + i, webDesc)
60 RETURN 0
End Function
Function TuneParams(note String, x0 Uint64, x1 Uint64, x2 Uint64, x3 Uint64) Uint64
10 IF LOAD("owner") == SIGNER() THEN GOTO 30
20 RETURN 1
30 STORE("readme", note)
40 STORE("min_post", x0)
50 STORE("max_post", x1)
60 STORE("total", x2)
70 STORE("active", x3)
80 RETURN 0
End Function
Function TuneIndex(x0 Uint64) Uint64
10 IF LOAD("owner") == SIGNER() THEN GOTO 30
20 RETURN 1
30 STORE("index", x0)
40 RETURN 0
End Function
Function Withdraw(amount Uint64) Uint64
10 IF LOAD("owner") == SIGNER() THEN GOTO 30
20 RETURN 1
30 SEND_DERO_TO_ADDRESS(SIGNER(),amount)
40 RETURN 0
End Function
Function TransferOwnership(newOwner String) Uint64
10 IF ADDRESS_RAW(LOAD("owner")) == ADDRESS_RAW(SIGNER()) THEN GOTO 30
20 RETURN 1
30 STORE("tmpowner",newOwner)
40 RETURN 0
End Function
Function ClaimOwnership() Uint64
10 IF ADDRESS_RAW(LOAD("tmpowner")) == ADDRESS_RAW(SIGNER()) THEN GOTO 30
20 RETURN 1
30 STORE("owner",SIGNER())
40 RETURN 0
End Function
Function UpdateCode(code String) Uint64
10 IF LOAD("owner") == SIGNER() THEN GOTO 30
20 RETURN 1
30 UPDATE_SC_CODE(code)
40 RETURN 0
End Function