tx · 67ujRgftPDhNHFEp1W6b7v4gzCp3AwTZDe46zEHAGyt2

3NBiXxLpuHVS2dGSaLvyPfCQYMPRKCtGCVg:  -0.01000000 Waves

2019.06.23 10:45 [554401] smart account 3NBiXxLpuHVS2dGSaLvyPfCQYMPRKCtGCVg > SELF 0.00000000 Waves

{ "type": 13, "id": "67ujRgftPDhNHFEp1W6b7v4gzCp3AwTZDe46zEHAGyt2", "fee": 1000000, "feeAssetId": null, "timestamp": 1561275927012, "version": 1, "sender": "3NBiXxLpuHVS2dGSaLvyPfCQYMPRKCtGCVg", "senderPublicKey": "H2yzJU1BtKf9NAhJSK6nCVgmFdaRaFBs5y3zgajHTLGs", "proofs": [ "3iVy7xuXhku5cM6Aro2r9SphSEZ1tKLA5JFDZNZpppWYo9SJ1nHCpADUcULuXXbqvHSscJs1ondujZFQK6GbBiTA" ], "script": "base64:AAIDAAAAAAAAAAAAAAAJAAAAAA5hZG1pblB1YmxpY0tleQEAAAAgoPq5TrIPqNMyX9LJ5ea1kHoixxLdZLkjdZ9lUlSz41QAAAAABXdjdElkAQAAACBAkwcahwxqDOVmEdNdlcYsRPoEBwsu3SMjVjLFv3jP4gAAAAAId3ZzUHJpY2UAAAAAAAX14QAAAAAACHdjdFByaWNlAAAAAAAAAABkAAAAAAhsYXN0Q2VsbAAAAAAAAAAAYwAAAAANYWRkcmVzc0xlbmd0aAAAAAAAAAAAIwAAAAAIcm91bmRLZXkCAAAABXJvdW5kAAAAAAhjZWxsc0tleQIAAAAFY2VsbHMAAAAACmxhc3RXaW5LZXkCAAAAB2xhc3RXaW4AAAACAAAAAWkBAAAABHRlc3QAAAAABAAAAAd3aW5DZWxsCQAAagAAAAIJAASxAAAAAQgFAAAACWxhc3RCbG9jawAAABNnZW5lcmF0aW9uU2lnbmF0dXJlAAAAAAAAAAAKCQAAAgAAAAEJAAEsAAAAAgkAASwAAAACCQABLAAAAAIJAAEsAAAAAgkAAlgAAAABCAUAAAAJbGFzdEJsb2NrAAAAE2dl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dFRyYW5zZmVyAAAAAwUAAAAKd2luQWRkcmVzcwUAAAALd2N0V2luU2hhcmUFAAAABXdjdElkCQAETAAAAAIJAQAAAA5TY3JpcHRUcmFuc2ZlcgAAAAMFAAAADGFkbWluQWRkcmVzcwUAAAANd2N0QWRtaW5TaGFyZQUAAAAFd2N0SWQFAAAAA25pbAkBAAAACFdyaXRlU2V0AAAAAQkABEwAAAACCQEAAAAJRGF0YUVudHJ5AAAAAgkAAaQAAAABBQAAAARjZWxsCQABLAAAAAIJAAEsAAAAAgkABCUAAAABCAUAAAABaQAAAAZjYWxsZXICAAAAAV8JAAGkAAAAAQUAAAAFcm91bmQJAARMAAAAAgkBAAAACURhdGFFbnRyeQAAAAIFAAAACGNlbGxzS2V5CQAAZAAAAAIFAAAABWNlbGxzAAAAAAAAAAABBQAAAANuaWwAAAABAAAAAnR4AQAAAAZ2ZXJpZnkAAAAABAAAAAckbWF0Y2gwBQAAAAJ0eAkAAfQAAAADCAUAAAACdHgAAAAJYm9keUJ5dGVzCQABkQAAAAIIBQAAAAJ0eAAAAAZwcm9vZnMAAAAAAAAAAAAIBQAAAAJ0eAAAAA9zZW5kZXJQdWJsaWNLZXnP2nlU", "chainId": 84, "height": 554401, "spentComplexity": 0 } View: original | compacted Prev: none Next: DGn5BtdPMuxHhrXBcKtQQ8BVQUDBabbhwB6oJnbuioQJ Full:
OldNewDifferences
1-# no script
1+{-# STDLIB_VERSION 3 #-}
2+{-# SCRIPT_TYPE ACCOUNT #-}
3+{-# CONTENT_TYPE DAPP #-}
4+let adminPublicKey = base58'BqPySUvbKdRTRZ33nGTtrQRdus5qwhnQkqZ7G9iNcDto'
5+
6+let wctId = base58'5M58Edq3qciFLWMFS9kLLKfFQoENxokdi2hdE3ju4hrq'
7+
8+let wvsPrice = 100000000
9+
10+let wctPrice = 100
11+
12+let lastCell = 99
13+
14+let addressLength = 35
15+
16+let roundKey = "round"
17+
18+let cellsKey = "cells"
19+
20+let lastWinKey = "lastWin"
21+
22+@Callable(i)
23+func test () = {
24+ let winCell = (toInt(lastBlock.generationSignature) % 10)
25+ throw(((((toBase58String(lastBlock.generationSignature) + ", ") + toBase64String(lastBlock.generationSignature)) + ", ") + toString(winCell)))
26+ }
27+
28+
29+
30+@Callable(i)
31+func buy (cell) = {
32+ let round = extract(getInteger(this, roundKey))
33+ let cells = extract(getInteger(this, cellsKey))
34+ if (if ((0 > cell))
35+ then true
36+ else (cell > lastCell))
37+ then throw("invalid cell number")
38+ else {
39+ let pmt = valueOrErrorMessage(i.payment, "Where is payment?")
40+ let wvs = !(isDefined(pmt.assetId))
41+ let wct = (pmt.assetId == wctId)
42+ if (if (if (if (!(wct))
43+ then !(wvs)
44+ else false)
45+ then true
46+ else if (wct)
47+ then (pmt.amount != wctPrice)
48+ else false)
49+ then true
50+ else if (wvs)
51+ then (pmt.amount != wvsPrice)
52+ else false)
53+ then throw("ticket price is 1 WCT or 1 WAVES")
54+ else {
55+ let cellData = getString(this, toString(cell))
56+ let bought = if (isDefined(cellData))
57+ then {
58+ let cellRound = split(extract(cellData), "_")[1]
59+ if ((cellRound == toString(round)))
60+ then true
61+ else false
62+ }
63+ else false
64+ if (bought)
65+ then throw("already bought")
66+ else {
67+ let last = (cells == lastCell)
68+ if (last)
69+ then {
70+ let wctFlag = if (wct)
71+ then 1
72+ else 0
73+ let wvsFlag = if (wvs)
74+ then 1
75+ else 0
76+ let wctAmount = (assetBalance(this, wctId) + (pmt.amount * wctFlag))
77+ let wvsAmount = (wavesBalance(this) + (pmt.amount * wvsFlag))
78+ let wvsAdminShare = (wvsAmount / 10)
79+ let wvsWinShare = (wvsAmount - wvsAdminShare)
80+ let wctAdminShare = (wctAmount / 10)
81+ let wctWinShare = (wctAmount - wctAdminShare)
82+ let adminAddress = addressFromPublicKey(adminPublicKey)
83+ let winCell = (toInt(lastBlock.generationSignature) % (lastCell + 1))
84+ let winData = extract(getString(this, toString(winCell)))
85+ let winAddress = if ((winCell == cell))
86+ then i.caller
87+ else extract(addressFromString(split(winData, "_")[0]))
88+ ScriptResult(WriteSet([DataEntry(toString(cell), ((toString(i.caller) + "_") + toString(round))), DataEntry(cellsKey, 0), DataEntry(roundKey, (round + 1)), DataEntry(lastWinKey, ((toString(winCell) + "_") + toString(winAddress)))]), TransferSet([ScriptTransfer(winAddress, wvsWinShare, unit), ScriptTransfer(adminAddress, wvsAdminShare, unit), ScriptTransfer(winAddress, wctWinShare, wctId), ScriptTransfer(adminAddress, wctAdminShare, wctId)]))
89+ }
90+ else WriteSet([DataEntry(toString(cell), ((toString(i.caller) + "_") + toString(round))), DataEntry(cellsKey, (cells + 1))])
91+ }
92+ }
93+ }
94+ }
95+
96+
97+@Verifier(tx)
98+func verify () = match tx {
99+ case _ =>
100+ sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey)
101+}
102+

github/deemru/w8io/169f3d6 
36.75 ms