Transaction Details

Open on Dero Explorer
Internal ID:
3211008
Transaction Hash:
1ec13912666f36c88ab9e3d2162614a5cf2fc32fc44d0933761e27fd9bcb96fb
Block:
Timestamp:
2022-12-26 22:54:31 UTC (2.8 years ago)
Type:
sc
Ring Size:
2
Payloads:
1
Caller:
test.keystore (+2 more) (1366966)
SC Data:
[{"name":"SC_ACTION","datatype":"U","value":"0"},{"name":"SC_ID","datatype":"H","value":"b0bb9c1c75fc0e84dd92ce03f0619d1b61737981f0bb796911ea31529a76358c"},{"name":"code","datatype":"S","value":"\n//       ______  _______  ______  _____       ______   ______ _____ ______   ______ _______\n//       |     \\ |______ |_____/ |     |      |_____] |_____/   |   |     \\ |  ____ |______\n//       |_____/ |______ |    \\_ |_____|      |_____] |    \\_ __|__ |_____/ |_____| |______\n//\n//       Token Contract\n\nFunction Initialize() Uint64\n\t10 IF EXISTS(\"version\") THEN GOTO 1100\n\t20 SetVer()\n\t30 STORE(\"t:\" + HEX(SIGNER()), 0)\n\t40 STORE(\"tl:0\", HEX(SIGNER()))\n\t50 STORE(\"numTrustees\", 1)\n\t60 STORE(\"bridgeOpen\", 1)\n\t70 STORE(\"quorum\", 1)\n\t80 STORE(\"totalsupply\", 0)\n\t90 STORE(\"name\", \"${name}\")\n\t100 STORE(\"symbol\", \"${symbol}\")\n\t110 STORE(\"decimals\", ${decimals})\n\t120 STORE(\"native_decimals\", ${native_decimals})\n\t130 STORE(\"native_symbol\", \"${native_symbol}\")\n\t140 STORE(\"bridgeFee\", ${bridgefee})\n\n\t1000 RETURN 0\n\t1100 RETURN 100\nEnd Function\n\nFunction GetVer() String\n\t10 return \"0.230\"\nEnd Function\n\nFunction SetVer() Uint64\n\t10 STORE(\"version\", GetVer())\n\n\t1000 RETURN 0\nEnd Function\n\nFunction toLower(eth String) String\n\t10 DIM i AS Uint64\n\t20 DIM res,c AS String\n\n\t25 LET res = \"\"\n\t30 LET i = 0\n\n\t50 LET c = SUBSTR(eth, i, 1)\n\n\t60 IF (c != \"A\") THEN GOTO 70\n\t65 LET c = \"a\"\n\t67 GOTO 120\n\n\t70 IF (c != \"B\") THEN GOTO 80\n\t75 LET c = \"b\"\n\t77 GOTO 120\n\n\t80 IF (c != \"C\") THEN GOTO 90\n\t85 LET c = \"c\"\n\t87 GOTO 120\n\n\t90 IF (c != \"D\") THEN GOTO 100\n\t95 LET c = \"d\"\n\t97 GOTO 120\n\n\t100 IF (c != \"E\") THEN GOTO 110\n\t105 LET c = \"e\"\n\t107 GOTO 120\n\n\t110 IF (c != \"F\") THEN GOTO 120\n\t115 LET c = \"f\"\n\n\t120 LET res = res + c\n\t130 LET i = i + 1\n\t140 IF (i == 40) THEN GOTO 160\n\t150 GOTO 50\n\n\t160 RETURN res\nEnd Function\n\nFunction toUpper(char String) String\n\t20 IF (char != \"a\") THEN GOTO 30\n\t25 RETURN \"A\"\n\n\t30 IF (char != \"b\") THEN GOTO 40\n\t35 RETURN \"B\"\n\n\t40 IF (char != \"c\") THEN GOTO 50\n\t45 RETURN \"C\"\n\n\t50 IF (char != \"d\") THEN GOTO 60\n\t55 RETURN \"D\"\n\n\t60 IF (char != \"e\") THEN GOTO 70\n\t65 RETURN \"E\"\n\n\t70 IF (char != \"f\") THEN GOTO 80\n\t75 RETURN \"F\"\n\n\t80 RETURN char\nEnd Function\n\nFunction rebuildEth(eth_lower String, keccak String) String\n\t10 DIM c, k, res AS String\n\t20 DIM i, n AS Uint64\n\t30 LET res = \"0x\"\n\t40 LET i = 0\n\n\t50 LET c = SUBSTR(eth_lower, i, 1)\n\t60 LET k = SUBSTR(keccak, i, 1)\n\t70 IF (k == \"0\" || k == \"1\" || k == \"2\" || k == \"3\" || k == \"4\" || k == \"5\" || k == \"6\" || k == \"7\") THEN GOTO 100\n\t90 LET c = toUpper(c)\n\t100 LET res = res + c\n\t110 LET i = i + 1\n\t120 IF (i == 40) THEN GOTO 160\n\t130 GOTO 50\n\n\t160 RETURN res\nEnd Function\n\nFunction ValidateETH(eth String) Uint64 \n\t10 DIM eth_stripped, eth_lower, keccak, eth_rebuilt AS String\n\n\t100 IF (STRLEN(eth) != 42) THEN GOTO 1000\n\t110 IF (SUBSTR(eth, "0", 2) != \"0x\") THEN GOTO 1000\n\n\t200 LET eth_lower = toLower(SUBSTR(eth, "2", 40))\n\t210 LET eth_rebuilt = rebuildEth(eth_lower, HEX(KECCAK256(eth_lower)))\n\t220 IF (eth != eth_rebuilt) THEN GOTO 1000\n\t230 RETURN 0\n\n\t1000 RETURN 1\nEnd Function\n\nFunction countVotes(tally Uint64) Uint64\n\t10 DIM votes, i AS Uint64\n\t20 LET votes = 0\n\t30 LET i = LOAD(\"numTrustees\")\n\t\n\t100 IF (tally \u0026 (1\u003c\u003ci)) \u003c 1 THEN GOTO 120\n\t110 LET votes = votes + 1\n\t120 LET i = i - 1\n\t130 IF i \u003c 1 THEN GOTO 1000\n\t140 GOTO 100\n\n\t1000 RETURN votes\nEnd Function\n\nFunction SHL(a Uint64, b Uint64) Uint64\n\t10 RETURN a \u003c\u003c b\nEnd Function\n\nFunction castVote(trustee String, key String, proposal String) Uint64\n\t10 DIM value, c, tally_str AS String\n\t20 DIM i, tally AS Uint64\n\t30 LET tally_str = \"0\"\n\t40 IF EXISTS(\"i:\" + key) != 1 THEN GOTO 230\n\t50 LET value = LOAD(\"i:\" + key)\n\t60 LET i = 0\n\t\n\t100 LET c = SUBSTR(value, i, 1)\n\t110 IF (c == \":\") THEN GOTO 200\n\t120 LET tally_str = tally_str + c\n\t130 LET i = i + 1\n\t140 GOTO 100\n\n\t200 LET tally = ATOI(tally_str)\n\t210 IF ((tally \u0026 1) == 1) THEN GOTO 1000\n\t220 IF SUBSTR(value, i+1, STRLEN(proposal)) == proposal THEN GOTO 300\n\t230 LET tally = 0\n\n\t300 LET tally = tally | SHL(1, LOAD(trustee) + 1)\n\t310 IF countVotes(tally) \u003c LOAD(\"quorum\") THEN GOTO 400\n\t320 LET tally = tally | 1\n\n\t400 STORE(\"i:\" + key, ITOA(tally) + \":\" + proposal)\n\t410 RETURN (tally \u0026 1)\n\n\t1000 RETURN 0\nEnd Function\n\nFunction VoteSetBridgeFee(fee Uint64) Uint64\n\t10 DIM trustee AS String\n\t20 LET trustee = \"t:\" + HEX(SIGNER())\n\t30 IF EXISTS(trustee) != 1 THEN GOTO 1100\n\t40 IF LOAD(\"bridgeFee\") == fee THEN GOTO 1260\n\n\t100 IF castVote(trustee, \"0\", ITOA(fee)) != 1 THEN GOTO 200\n\t110 DELETE(\"i:0\")\n\t120 STORE(\"bridgeFee\", fee)\n\n\t200 RETURN 0\n\n\t1100 RETURN 100\n\t1260 RETURN 260\nEnd Function\n\nFunction VoteMint(eth_txid String, deroAddr String, amount Uint64) Uint64 \n\t10 DIM trustee AS String\n\t20 LET trustee = \"t:\" + HEX(SIGNER())\n\t30 IF LOAD(\"bridgeOpen\") == 0 THEN GOTO 1290\n\t40 IF EXISTS(trustee) != 1 THEN GOTO 1100\n\n\t100 IF castVote(trustee, eth_txid, deroAddr + \".\" + ITOA(amount) + \".\") != 1 THEN GOTO 200\n\t110 STORE(\"totalsupply\", LOAD(\"totalsupply\") + amount)\n\t120 SEND_ASSET_TO_ADDRESS(HEXDECODE(deroAddr), amount, SCID())\n\n\t200 RETURN 0\n\n\t1100 RETURN 100\n\t1260 RETURN 260\n\t1290 RETURN 290\nEnd Function\n\nFunction VoteAddTrustee(new_trustee String) Uint64\n\t10 DIM trustee AS String\n\t20 LET trustee = \"t:\" + HEX(SIGNER())\n\t30 IF EXISTS(trustee) != 1 THEN GOTO 1100\n\t40 IF EXISTS(\"t:\" + new_trustee) THEN GOTO 1260\n\t50 IF STRLEN(new_trustee) != 66 THEN GOTO 1260\n\n\t100 IF castVote(trustee, \"1\", new_trustee) != 1 THEN GOTO 200\n\t110 DELETE(\"i:1\")\n\t120 DIM numTrustees AS Uint64\n\t130 LET numTrustees = LOAD(\"numTrustees\")\n\t140 STORE(\"tl:\" + numTrustees, new_trustee)\n\t150 STORE(\"t:\"+ new_trustee, numTrustees)\n\t160 STORE(\"numTrustees\", numTrustees + 1)\n\n\t200 RETURN 0\n\n\t1100 RETURN 100\n\t1260 RETURN 260\nEnd Function\n\nFunction VoteRemoveTrustee(old_trustee String) Uint64\n\t10 DIM trustee AS String\n\t20 DIM numTrustees AS Uint64\n\t30 LET trustee = \"t:\" + HEX(SIGNER())\n\t40 IF EXISTS(trustee) != 1 THEN GOTO 1100\n\t50 IF EXISTS(\"t:\" + old_trustee) != 1 THEN GOTO 1260\n\t60 LET numTrustees = LOAD(\"numTrustees\") - 1\n\t70 IF numTrustees == 0 THEN GOTO 1270\n\t80 IF numTrustees \u003e LOAD(\"quorum\") THEN GOTO 1280\n\n\t100 IF castVote(trustee, \"2\", old_trustee) != 1 THEN GOTO 300\n\t110 DELETE(\"i:2\")\n\n\t200 DIM keyToMove AS String\n\t210 DIM rowToReplace AS Uint64\n\t220 LET keyToMove = LOAD(\"tl:\" + numTrustees)\n\t230 LET rowToReplace = LOAD(\"t:\" + old_trustee)\n\t240 STORE(\"t:\" + keyToMove, rowToReplace)\n\t250 STORE(\"tl:\" + rowToReplace, keyToMove)\n\t260 DELETE(\"t:\" + old_trustee)\n\t270 DELETE(\"tl:\" + numTrustees)\n\t280 STORE(\"numTrustees\", numTrustees)\n\n\t300 RETURN 0\n\n\t1100 RETURN 100\n\t1260 RETURN 260\n\t1270 RETURN 270\n\t1290 RETURN 290\nEnd Function\n\nFunction VoteChangeQuorum(new_quorum Uint64) Uint64\n\t10 DIM trustee AS String\n\t20 LET trustee = \"t:\" + HEX(SIGNER())\n\t30 IF EXISTS(trustee) != 1 THEN GOTO 1100\n\t40 IF LOAD(\"quorum\") == new_quorum THEN GOTO 1260\n\t50 IF new_quorum \u003e LOAD(\"numTrustees\") THEN GOTO 1300\n\n\t100 IF castVote(trustee, \"3\", ITOA(new_quorum)) != 1 THEN GOTO 200\n\t110 DELETE(\"i:3\")\n\t120 STORE(\"quorum\", new_quorum)\n\n\t200 RETURN 0\n\n\t1100 RETURN 100\n\t1260 RETURN 260\n\t1300 RETURN 300\nEnd Function\n\nFunction VoteUpdateCode(code String) Uint64\n\t10 DIM trustee AS String\n\t20 LET trustee = \"t:\" + HEX(SIGNER())\n\t30 IF EXISTS(trustee) != 1 THEN GOTO 1100\n\n\t100 IF castVote(trustee, \"4\", sha256(code)) != 1 THEN GOTO 200\n\t110 DELETE(\"i:4\")\n\t120 UPDATE_SC_CODE(code)\n\n\t200 RETURN 0\n\n\t1100 RETURN 100\n\t1260 RETURN 260\nEnd Function\n\nFunction SetBridgeClosed() Uint64\n\t10 DIM trustee AS String\n\t20 LET trustee = \"t:\" + HEX(SIGNER())\n\t30 IF EXISTS(trustee) != 1 THEN GOTO 1100\n\n\t100 STORE(\"bridgeOpen\", 0)\n\n\t200 RETURN 0\n\n\t1100 RETURN 100\nEnd Function\n\nFunction VoteSetBridgeOpen() Uint64\n\t10 DIM trustee AS String\n\t20 LET trustee = \"t:\" + HEX(SIGNER())\n\t30 IF EXISTS(trustee) != 1 THEN GOTO 1100\n\t40 IF LOAD(\"bridgeOpen\") == 1 THEN GOTO 1260\n\n\t100 IF castVote(trustee, \"5\", \"true\") != 1 THEN GOTO 200\n\t110 DELETE(\"i:5\")\n\t120 STORE(\"bridgeOpen\", 1)\n\n\t200 RETURN 0\n\n\t1100 RETURN 100\n\t1260 RETURN 260\nEnd Function\n\nFunction SetImageUrl(i String) Uint64)\n\t10 IF EXISTS(\"t:\"+HEX(SIGNER())) != 1 THEN GOTO 1100\n\t20 STORE(\"image_url\", i)\n\t30 RETURN 0\n\n\t1100 RETURN 100\nEnd Function\n\nFunction Bridge(eth_addr String) Uint64\n\t10 IF LOAD(\"bridgeOpen\") == 0 THEN GOTO 1290\n\t20 DIM bridgeFee AS Uint64\n\t30 LET bridgeFee = LOAD(\"bridgeFee\")\n\t40 IF DEROVALUE() != bridgeFee THEN GOTO 1210\n\t50 IF ValidateETH(eth_addr) THEN GOTO 1240\n\n\t200 DIM amount AS Uint64\n\t210 LET amount = ASSETVALUE(SCID())\n\t220 IF amount \u003c 1 THEN GOTO 1250\n\n\t300 STORE(\"b:\" + HEX(TXID()), eth_addr + \":\" + amount)\n\t310 STORE(\"totalsupply\", LOAD(\"totalsupply\") - amount)\n\t320 DIM i, numTrustees, portion AS Uint64\n\t330 LET numTrustees = LOAD(\"numTrustees\")\n\t340 LET portion = bridgeFee / numTrustees\n\t350 SEND_DERO_TO_ADDRESS(HEXDECODE(LOAD(\"tl:0\")), portion + bridgeFee - portion * numTrustees)\n\t360 LET i = 1\n\n\t400 IF i \u003e= numTrustees THEN GOTO 500\n\t410 SEND_DERO_TO_ADDRESS(HEXDECODE(LOAD(\"tl:\" + i)), portion)\n\t420 LET i = i + 1\n\t430 GOTO 400\n\n\t500 RETURN 0\n\n\t1210 RETURN 210\n\t1240 RETURN 240\n\t1250 RETURN 250\n\t1290 RETURN 290\nEnd Function\n"},{"name":"entrypoint","datatype":"S","value":"VoteUpdateCode"}]

Payload

Token (SCID):
DERO
Deposited:
none
Fees:
0.17915 DERO