Smart Contract Details
Open on Dero ExplorerInternal ID:
49401
Hash / Transaction:
Block:
Timestamp:
2024-06-30 03:05:56 UTC (1.2 years ago)
Creator:
…qgv26xst
(1414481)
Raw Data:
[{"name":"SC_ACTION","datatype":"U","value":1},{"name":"SC_CODE","datatype":"S","value":"// Logs\n\n Function InitializePrivate() Uint64\n 10 initSetup()\n 20 RETURN 0\n End Function\n\n Function SmartLOG(contract 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(\"zc\" + (index-1), contract)\n 200 RETURN 0\n End Function\n\n Function initSetup() Uint64\n 10 STORE(\"owner\", SIGNER())\n 20 STORE(\"version\", \"v1.0.0\")\n 30 STORE(\"readme\", \"Logs\")\n 40 STORE(\"min_post\", 99999)\n 50 STORE(\"max_post\", 250)\n 60 STORE(\"index\", 0) \n 70 STORE(\"total\", 0)\n 80 STORE(\"active\", 1)\n 100 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 100 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\n"}]
Code:
// Logs
Function InitializePrivate() Uint64
10 initSetup()
20 RETURN 0
End Function
Function SmartLOG(contract 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("zc" + (index-1), contract)
200 RETURN 0
End Function
Function initSetup() Uint64
10 STORE("owner", SIGNER())
20 STORE("version", "v1.0.0")
30 STORE("readme", "Logs")
40 STORE("min_post", 99999)
50 STORE("max_post", 250)
60 STORE("index", 0)
70 STORE("total", 0)
80 STORE("active", 1)
100 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)
100 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