tx · HkrBMSFyxzoAeXXJgpo4Hx3yGb8RLMjzGsBtiXa7B7in

3MxL4UKxkpm6FSUnQkjtrVjbWNHvNViWWZ9:  -0.01400000 Waves

2019.08.02 10:40 [612934] smart account 3MxL4UKxkpm6FSUnQkjtrVjbWNHvNViWWZ9 > SELF 0.00000000 Waves

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

github/deemru/w8io/026f985 
18.08 ms