tx · DGn5BtdPMuxHhrXBcKtQQ8BVQUDBabbhwB6oJnbuioQJ

3NBiXxLpuHVS2dGSaLvyPfCQYMPRKCtGCVg:  -0.01400000 Waves

2019.07.09 22:46 [578542] smart account 3NBiXxLpuHVS2dGSaLvyPfCQYMPRKCtGCVg > SELF 0.00000000 Waves

{ "type": 13, "id": "DGn5BtdPMuxHhrXBcKtQQ8BVQUDBabbhwB6oJnbuioQJ", "fee": 1400000, "feeAssetId": null, "timestamp": 1562701649586, "version": 1, "sender": "3NBiXxLpuHVS2dGSaLvyPfCQYMPRKCtGCVg", "senderPublicKey": "H2yzJU1BtKf9NAhJSK6nCVgmFdaRaFBs5y3zgajHTLGs", "proofs": [ "3j5CWs4Nmdy2x2mGqHSavSZ2h8wznHGCLYdUiDAAudVEv8wZRfZzpxXbjQwDpv9GP85JrdnCd4i61ncvQAZBRxhV" ], "script": "base64:AAIDAAAAAAAAAAAAAAAKAAAAAA5hZG1pblB1YmxpY0tleQEAAAAgoPq5TrIPqNMyX9LJ5ea1kHoixxLdZLkjdZ9lUlSz41QAAAAABXdjdElkAQAAACBAkwcahwxqDOVmEdNdlcYsRPoEBwsu3SMjVjLFv3jP4gAAAAAId3ZzUHJpY2UAAAAAAAX14QAAAAAACHdjdFByaWNlAAAAAAAAAABkAAAAAAhsYXN0Q2VsbAAAAAAAAAAAYwAAAAAIcm91bmRLZXkCAAAABXJvdW5kAAAAAAhjZWxsc0tleQIAAAAFY2VsbHMAAAAACmxhc3RXaW5LZXkCAAAAB2xhc3RXaW4AAAAADWxhc3RXaW5XY3RLZXkCAAAAC2xhc3RXaW5fd2N0AAAAAA1sYXN0V2luV3ZzS2V5AgAAAAtsYXN0V2luX3d2cwAAAAEAAAABaQEAAAADYnV5AAAAAQAAAARjZWxsBAAAAAVyb3VuZAkBAAAAB2V4dHJhY3QAAAABCQAEGgAAAAIFAAAABHRoaXMFAAAACHJvdW5kS2V5BAAAAAVjZWxscwkBAAAAB2V4dHJhY3QAAAABCQAEG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5BZGRyZXNzBQAAAA13Y3RBZG1pblNoYXJlBQAAAAV3Y3RJZAUAAAADbmlsCQEAAAAIV3JpdGVTZXQAAAABCQAETAAAAAIJAQAAAAlEYXRhRW50cnkAAAACCQABpAAAAAEFAAAABGNlbGwJAAEsAAAAAgkAASwAAAACCQAEJQAAAAEIBQAAAAFpAAAABmNhbGxlcgIAAAABXwkAAaQAAAABBQAAAAVyb3VuZAkABEwAAAACCQEAAAAJRGF0YUVudHJ5AAAAAgUAAAAIY2VsbHNLZXkJAABkAAAAAgUAAAAFY2VsbHMAAAAAAAAAAAEFAAAAA25pbAAAAAEAAAACdHgBAAAABnZlcmlmeQAAAAAEAAAAByRtYXRjaDAFAAAAAnR4CQAB9AAAAAMIBQAAAAJ0eAAAAAlib2R5Qnl0ZXMJAAGRAAAAAggFAAAAAnR4AAAABnByb29mcwAAAAAAAAAAAAgFAAAAAnR4AAAAD3NlbmRlclB1YmxpY0tleTFEEw0=", "chainId": 84, "height": 578542, "spentComplexity": 0 } View: original | compacted Prev: 67ujRgftPDhNHFEp1W6b7v4gzCp3AwTZDe46zEHAGyt2 Next: 2wEC6v8EayocEeQyKWa4LKHVHjxfdvv7zquh7BSR1cwi Diff:
OldNewDifferences
1111
1212 let lastCell = 99
1313
14-let addressLength = 35
15-
1614 let roundKey = "round"
1715
1816 let cellsKey = "cells"
1917
2018 let lastWinKey = "lastWin"
2119
22-@Callable(i)
23-func test () = {
24- let winCell = (toInt(lastBlock.generationSignature) % 10)
25- throw(((((toBase58String(lastBlock.generationSignature) + ", ") + toBase64String(lastBlock.generationSignature)) + ", ") + toString(winCell)))
26- }
20+let lastWinWctKey = "lastWin_wct"
2721
28-
22+let lastWinWvsKey = "lastWin_wvs"
2923
3024 @Callable(i)
3125 func buy (cell) = {
3428 if (if ((0 > cell))
3529 then true
3630 else (cell > lastCell))
37- then throw("invalid cell number")
31+ then throw("Invalid number")
3832 else {
3933 let pmt = valueOrErrorMessage(i.payment, "Where is payment?")
4034 let wvs = !(isDefined(pmt.assetId))
5044 else if (wvs)
5145 then (pmt.amount != wvsPrice)
5246 else false)
53- then throw("ticket price is 1 WCT or 1 WAVES")
47+ then throw("Price is 1 WCT or 1 WAVES")
5448 else {
5549 let cellData = getString(this, toString(cell))
5650 let bought = if (isDefined(cellData))
6256 }
6357 else false
6458 if (bought)
65- then throw("already bought")
59+ then throw("Already bought")
6660 else {
6761 let last = (cells == lastCell)
6862 if (last)
8579 let winAddress = if ((winCell == cell))
8680 then i.caller
8781 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)]))
82+ 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)]))
8983 }
9084 else WriteSet([DataEntry(toString(cell), ((toString(i.caller) + "_") + toString(round))), DataEntry(cellsKey, (cells + 1))])
9185 }
Full:
OldNewDifferences
11 {-# STDLIB_VERSION 3 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
44 let adminPublicKey = base58'BqPySUvbKdRTRZ33nGTtrQRdus5qwhnQkqZ7G9iNcDto'
55
66 let wctId = base58'5M58Edq3qciFLWMFS9kLLKfFQoENxokdi2hdE3ju4hrq'
77
88 let wvsPrice = 100000000
99
1010 let wctPrice = 100
1111
1212 let lastCell = 99
1313
14-let addressLength = 35
15-
1614 let roundKey = "round"
1715
1816 let cellsKey = "cells"
1917
2018 let lastWinKey = "lastWin"
2119
22-@Callable(i)
23-func test () = {
24- let winCell = (toInt(lastBlock.generationSignature) % 10)
25- throw(((((toBase58String(lastBlock.generationSignature) + ", ") + toBase64String(lastBlock.generationSignature)) + ", ") + toString(winCell)))
26- }
20+let lastWinWctKey = "lastWin_wct"
2721
28-
22+let lastWinWvsKey = "lastWin_wvs"
2923
3024 @Callable(i)
3125 func buy (cell) = {
3226 let round = extract(getInteger(this, roundKey))
3327 let cells = extract(getInteger(this, cellsKey))
3428 if (if ((0 > cell))
3529 then true
3630 else (cell > lastCell))
37- then throw("invalid cell number")
31+ then throw("Invalid number")
3832 else {
3933 let pmt = valueOrErrorMessage(i.payment, "Where is payment?")
4034 let wvs = !(isDefined(pmt.assetId))
4135 let wct = (pmt.assetId == wctId)
4236 if (if (if (if (!(wct))
4337 then !(wvs)
4438 else false)
4539 then true
4640 else if (wct)
4741 then (pmt.amount != wctPrice)
4842 else false)
4943 then true
5044 else if (wvs)
5145 then (pmt.amount != wvsPrice)
5246 else false)
53- then throw("ticket price is 1 WCT or 1 WAVES")
47+ then throw("Price is 1 WCT or 1 WAVES")
5448 else {
5549 let cellData = getString(this, toString(cell))
5650 let bought = if (isDefined(cellData))
5751 then {
5852 let cellRound = split(extract(cellData), "_")[1]
5953 if ((cellRound == toString(round)))
6054 then true
6155 else false
6256 }
6357 else false
6458 if (bought)
65- then throw("already bought")
59+ then throw("Already bought")
6660 else {
6761 let last = (cells == lastCell)
6862 if (last)
6963 then {
7064 let wctFlag = if (wct)
7165 then 1
7266 else 0
7367 let wvsFlag = if (wvs)
7468 then 1
7569 else 0
7670 let wctAmount = (assetBalance(this, wctId) + (pmt.amount * wctFlag))
7771 let wvsAmount = (wavesBalance(this) + (pmt.amount * wvsFlag))
7872 let wvsAdminShare = (wvsAmount / 10)
7973 let wvsWinShare = (wvsAmount - wvsAdminShare)
8074 let wctAdminShare = (wctAmount / 10)
8175 let wctWinShare = (wctAmount - wctAdminShare)
8276 let adminAddress = addressFromPublicKey(adminPublicKey)
8377 let winCell = (toInt(lastBlock.generationSignature) % (lastCell + 1))
8478 let winData = extract(getString(this, toString(winCell)))
8579 let winAddress = if ((winCell == cell))
8680 then i.caller
8781 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)]))
82+ 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)]))
8983 }
9084 else WriteSet([DataEntry(toString(cell), ((toString(i.caller) + "_") + toString(round))), DataEntry(cellsKey, (cells + 1))])
9185 }
9286 }
9387 }
9488 }
9589
9690
9791 @Verifier(tx)
9892 func verify () = match tx {
9993 case _ =>
10094 sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey)
10195 }
10296

github/deemru/w8io/169f3d6 
42.12 ms