tx · 9LXAkVvc73oLyu77La1BUMfDFGdi7Cb11AXxdswNzwRt 3Mynaio8coZLr58tu2AdBEhmCvB17vTBRkA: -0.01000000 Waves 2023.06.03 18:46 [2606705] smart account 3Mynaio8coZLr58tu2AdBEhmCvB17vTBRkA > SELF 0.00000000 Waves
{ "type": 13, "id": "9LXAkVvc73oLyu77La1BUMfDFGdi7Cb11AXxdswNzwRt", "fee": 1000000, "feeAssetId": null, "timestamp": 1685807255229, "version": 2, "chainId": 84, "sender": "3Mynaio8coZLr58tu2AdBEhmCvB17vTBRkA", "senderPublicKey": "Dx7cJVhpJb4qUDGiDnSjj6Wfjdj5nmzwVLfaggkbjDtv", "proofs": [ "4xQWNW6YT6qgAj9qzVYxPdB5NUGwyPWXbGRMkmwKTjDZBboPmr3d1qc87yxF6ZEypKF4XWrqEroztcX1dEEPxNtn" ], "script": "base64:BgIGCAISABIABwEKbnVtVG9XYXZlcwEDbnVtCQBoAgUDbnVtAIDC1y8BC2lzUGF5bWVudE9rAQFpBBFhY2NlcHRhYmxlQXNzZXRJZAEgIkSm54hUfVEormpXug9p+nbhDnc37ahHq1IfaU2UQkcDCQAAAgkAkAMBCAUBaQhwYXltZW50cwAACQACAQIUUGF5bWVudCBub3QgYXR0YWNoZWQEAXAJAJEDAggFAWkIcGF5bWVudHMAAAQHJG1hdGNoMAgFAXAHYXNzZXRJZAMJAAECBQckbWF0Y2gwAgpCeXRlVmVjdG9yBAdhc3NldElkBQckbWF0Y2gwAwkAAAIFB2Fzc2V0SWQFEWFjY2VwdGFibGVBc3NldElkCQBnAggFAXAGYW1vdW50CQEKbnVtVG9XYXZlcwEAAQcJAGcCCAUBcAZhbW91bnQJAQpudW1Ub1dhdmVzAQABARNnZXRMdWNreVdoZWVsQmV0S2V5AQFpCQCsAgICD2JldF9MdWNreVdoZWVsXwkApQgBCAUBaQZjYWxsZXIBE2dldEx1Y2t5V2hlZWxXb25LZXkBAWkJAKwCAgIPd29uX0x1Y2t5V2hlZWxfCQClCA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hbEJsb2NrCQETdmFsdWVPckVycm9yTWVzc2FnZQIJAO0HAQUMY29tbWl0SGVpZ2h0AhF1bmV4Y3BlY3RlZCBlcnJvcgQDdnJmCQETdmFsdWVPckVycm9yTWVzc2FnZQIIBQtyZXZlYWxCbG9jawN2cmYCEXVuZXhjcGVjdGVkIGVycm9yBApyYW5kb21TZWVkCQCxCQEJAPUDAQUDdnJmBAxyYW5kb21OdW1iZXIJAGQCCQBqAgUKcmFuZG9tU2VlZAkAZAIJAGUCAAwAAQABAAEEDXdpbm5pbmdBbW91bnQJARlnYW1lTHVja3lXaGVlbFdoYXRVc2VyV29uAQUMcmFuZG9tTnVtYmVyAwkAZgIFDXdpbm5pbmdBbW91bnQAAAkAzAgCCQELRGVsZXRlRW50cnkBCQETZ2V0THVja3lXaGVlbEJldEtleQEFAWkJAMwIAgkBDlNjcmlwdFRyYW5zZmVyAwgFAWkGY2FsbGVyBQ13aW5uaW5nQW1vdW50BQR1bml0CQDMCAIJAQxJbnRlZ2VyRW50cnkCCQETZ2V0THVja3lXaGVlbFdvbktleQEFAWkFDXdpbm5pbmdBbW91bnQJAMwIAgkBDEludGVnZXJFbnRyeQIJARxnZXRMdWNreVdoZWVsUmFuZG9tTnVtYmVyS2V5AQUBaQUMcmFuZG9tTnVtYmVyCQDMCAIJAQxJbnRlZ2VyRW50cnkCCQETZ2V0THVja3lXaGVlbExvZ0tleQEFAWkFDXdpbm5pbmdBbW91bnQFA25pbAkAzAgCCQELRGVsZXRlRW50cnkBCQETZ2V0THVja3lXaGVlbEJldEtleQEFAWkJAMwIAgkBDEludGVnZXJFbnRyeQIJARNnZXRMdWNreVdoZWVsV29uS2V5AQUBaQUNd2lubmluZ0Ftb3VudAkAzAgCCQEMSW50ZWdlckVudHJ5AgkBHGdldEx1Y2t5V2hlZWxSYW5kb21OdW1iZXJLZXkBBQFpBQxyYW5kb21OdW1iZXIFA25pbABT9/cB", "height": 2606705, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: D6gbhA39Wfb7w2eRvjkZnXJYgaY762jdt7rK8jh4Fmk1 Next: J66F5jHRodUYP18ArFJhHV8XgQvEQm4Csv1QZFpMPpLc Diff:
Old | New | Differences | |
---|---|---|---|
32 | 32 | func k (d) = ("randomNumber_LuckyWheel_" + toString(d.caller)) | |
33 | 33 | ||
34 | 34 | ||
35 | - | func l (m) = { | |
36 | - | let g = m | |
35 | + | func l (d) = ("log_LuckyWheel_" + toString(d.caller)) | |
36 | + | ||
37 | + | ||
38 | + | func m (n) = { | |
39 | + | let g = n | |
37 | 40 | if ((1 == g)) | |
38 | 41 | then a(2) | |
39 | 42 | else if ((5 == g)) | |
55 | 58 | ||
56 | 59 | @Callable(d) | |
57 | 60 | func revealLuckyWheel () = { | |
58 | - | let | |
59 | - | if (( | |
60 | - | then throw((("wait " + toString(( | |
61 | + | let o = valueOrErrorMessage(getIntegerValue(i(d)), "Bet not found") | |
62 | + | if ((o > height)) | |
63 | + | then throw((("wait " + toString((o - height))) + " blocks to reveal this id")) | |
61 | 64 | else { | |
62 | - | let | |
63 | - | let | |
64 | - | let | |
65 | - | let | |
66 | - | let | |
67 | - | if (( | |
68 | - | then [DeleteEntry(i(d)), ScriptTransfer(d.caller, | |
69 | - | else [DeleteEntry(i(d)), IntegerEntry(j(d), | |
65 | + | let p = valueOrErrorMessage(blockInfoByHeight(o), "unexcpected error") | |
66 | + | let q = valueOrErrorMessage(p.vrf, "unexcpected error") | |
67 | + | let r = toInt(keccak256(q)) | |
68 | + | let s = ((r % ((12 - 1) + 1)) + 1) | |
69 | + | let t = m(s) | |
70 | + | if ((t > 0)) | |
71 | + | then [DeleteEntry(i(d)), ScriptTransfer(d.caller, t, unit), IntegerEntry(j(d), t), IntegerEntry(k(d), s), IntegerEntry(l(d), t)] | |
72 | + | else [DeleteEntry(i(d)), IntegerEntry(j(d), t), IntegerEntry(k(d), s)] | |
70 | 73 | } | |
71 | 74 | } | |
72 | 75 |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 6 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | func a (b) = (b * 100000000) | |
5 | 5 | ||
6 | 6 | ||
7 | 7 | func c (d) = { | |
8 | 8 | let e = base58'3JmaWyFqWo8YSA8x3DXCBUW7veesxacvKx19dMv7wTMg' | |
9 | 9 | if ((size(d.payments) == 0)) | |
10 | 10 | then throw("Payment not attached") | |
11 | 11 | else { | |
12 | 12 | let f = d.payments[0] | |
13 | 13 | let g = f.assetId | |
14 | 14 | if ($isInstanceOf(g, "ByteVector")) | |
15 | 15 | then { | |
16 | 16 | let h = g | |
17 | 17 | if ((h == e)) | |
18 | 18 | then (f.amount >= a(1)) | |
19 | 19 | else false | |
20 | 20 | } | |
21 | 21 | else (f.amount >= a(1)) | |
22 | 22 | } | |
23 | 23 | } | |
24 | 24 | ||
25 | 25 | ||
26 | 26 | func i (d) = ("bet_LuckyWheel_" + toString(d.caller)) | |
27 | 27 | ||
28 | 28 | ||
29 | 29 | func j (d) = ("won_LuckyWheel_" + toString(d.caller)) | |
30 | 30 | ||
31 | 31 | ||
32 | 32 | func k (d) = ("randomNumber_LuckyWheel_" + toString(d.caller)) | |
33 | 33 | ||
34 | 34 | ||
35 | - | func l (m) = { | |
36 | - | let g = m | |
35 | + | func l (d) = ("log_LuckyWheel_" + toString(d.caller)) | |
36 | + | ||
37 | + | ||
38 | + | func m (n) = { | |
39 | + | let g = n | |
37 | 40 | if ((1 == g)) | |
38 | 41 | then a(2) | |
39 | 42 | else if ((5 == g)) | |
40 | 43 | then a(1) | |
41 | 44 | else if ((7 == g)) | |
42 | 45 | then a(6) | |
43 | 46 | else if ((11 == g)) | |
44 | 47 | then a(1) | |
45 | 48 | else 0 | |
46 | 49 | } | |
47 | 50 | ||
48 | 51 | ||
49 | 52 | @Callable(d) | |
50 | 53 | func commitLuckyWheel () = if (!(c(d))) | |
51 | 54 | then throw("Wrong payment amount or asset") | |
52 | 55 | else [IntegerEntry(i(d), (height + 1)), DeleteEntry(k(d)), DeleteEntry(j(d))] | |
53 | 56 | ||
54 | 57 | ||
55 | 58 | ||
56 | 59 | @Callable(d) | |
57 | 60 | func revealLuckyWheel () = { | |
58 | - | let | |
59 | - | if (( | |
60 | - | then throw((("wait " + toString(( | |
61 | + | let o = valueOrErrorMessage(getIntegerValue(i(d)), "Bet not found") | |
62 | + | if ((o > height)) | |
63 | + | then throw((("wait " + toString((o - height))) + " blocks to reveal this id")) | |
61 | 64 | else { | |
62 | - | let | |
63 | - | let | |
64 | - | let | |
65 | - | let | |
66 | - | let | |
67 | - | if (( | |
68 | - | then [DeleteEntry(i(d)), ScriptTransfer(d.caller, | |
69 | - | else [DeleteEntry(i(d)), IntegerEntry(j(d), | |
65 | + | let p = valueOrErrorMessage(blockInfoByHeight(o), "unexcpected error") | |
66 | + | let q = valueOrErrorMessage(p.vrf, "unexcpected error") | |
67 | + | let r = toInt(keccak256(q)) | |
68 | + | let s = ((r % ((12 - 1) + 1)) + 1) | |
69 | + | let t = m(s) | |
70 | + | if ((t > 0)) | |
71 | + | then [DeleteEntry(i(d)), ScriptTransfer(d.caller, t, unit), IntegerEntry(j(d), t), IntegerEntry(k(d), s), IntegerEntry(l(d), t)] | |
72 | + | else [DeleteEntry(i(d)), IntegerEntry(j(d), t), IntegerEntry(k(d), s)] | |
70 | 73 | } | |
71 | 74 | } | |
72 | 75 | ||
73 | 76 |
github/deemru/w8io/169f3d6 73.58 ms ◑