tx · GhrnZDcmfPjrg58w2WRU3Epwdho4jvCKNZvugMDL7ia4 3Mynaio8coZLr58tu2AdBEhmCvB17vTBRkA: -0.01000000 Waves 2023.05.31 21:25 [2602506] smart account 3Mynaio8coZLr58tu2AdBEhmCvB17vTBRkA > SELF 0.00000000 Waves
{ "type": 13, "id": "GhrnZDcmfPjrg58w2WRU3Epwdho4jvCKNZvugMDL7ia4", "fee": 1000000, "feeAssetId": null, "timestamp": 1685557557286, "version": 2, "chainId": 84, "sender": "3Mynaio8coZLr58tu2AdBEhmCvB17vTBRkA", "senderPublicKey": "Dx7cJVhpJb4qUDGiDnSjj6Wfjdj5nmzwVLfaggkbjDtv", "proofs": [ "3tTZ7JQejC9n4bdghJ3QMj1zGAqUdBnn3AFnQzmLpXuM6AvNGumWTjeZZmjtMHsyAFqtMFHwAP7YdHqBFoGjthuk" ], "script": "base64:AAIEAAAAAAAAAAwIAhIDCgEIEgMKAQEAAAAEAQAAAApudW1Ub1dhdmVzAAAAAQAAAANudW0JAABoAAAAAgUAAAADbnVtAAAAAAAF9eEAAQAAABRnZW5lcmF0ZVJhbmRvbU51bWJlcgAAAAMAAAABaQAAAANtaW4AAAADbWF4BAAAAApyYW5kb21TZWVkCQAEsQAAAAEJAAH1AAAAAQgFAAAAAWkAAAANdHJhbnNhY3Rpb25JZAQAAAAMcmFuZG9tTnVtYmVyCQAAZAAAAAIJAABqAAAAAgUAAAAKcmFuZG9tU2VlZAkAAGQAAAACCQAAZQAAAAIFAAAAA21heAUAAAADbWluAAAAAAAAAAABBQAAAANtaW4FAAAADHJhbmRvbU51bWJlcgEAAAALaXNQYXltZW50T2sAAAABAAAAAWkEAAAAEWFjY2VwdGFibGVBc3NldElkAQAAACAiRKbniFR9USiuale6D2n6duEOdzftqEerUh9pTZRCRwMJAAAAAAAAAgkAAZAAAAABCAUAAAABaQAAAAhwYXltZW50cwAAAAAAAAAAAAkAAAIAAAABAgAAABRQYXltZW50IG5vdCBhdHRhY2hlZAQAAAABcAk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VzdF9nYW1lX3JhbmRvbU51bWJlcl8FAAAAAmlkBQAAAAxyYW5kb21OdW1iZXIJAARMAAAAAgkBAAAADEludGVnZXJFbnRyeQAAAAIJAAEsAAAAAgIAAAAYdGVzdF9nYW1lX3dpbm5pbmdBbW91bnRfBQAAAAJpZAUAAAANd2lubmluZ0Ftb3VudAUAAAADbmlsCQAETAAAAAIJAQAAAAxJbnRlZ2VyRW50cnkAAAACCQABLAAAAAICAAAABWdhbWVfBQAAAAJpZAUAAAANd2lubmluZ0Ftb3VudAkABEwAAAACCQEAAAALU3RyaW5nRW50cnkAAAACCQABLAAAAAICAAAADGdhbWVfc3RhdHVzXwUAAAACaWQCAAAABGxvc2UJAARMAAAAAgkBAAAADEludGVnZXJFbnRyeQAAAAIJAAEsAAAAAgIAAAAXdGVzdF9nYW1lX3JhbmRvbU51bWJlcl8FAAAAAmlkBQAAAAxyYW5kb21OdW1iZXIJAARMAAAAAgkBAAAADEludGVnZXJFbnRyeQAAAAIJAAEsAAAAAgIAAAAYdGVzdF9nYW1lX3dpbm5pbmdBbW91bnRfBQAAAAJpZAUAAAANd2lubmluZ0Ftb3VudAUAAAADbmlsAAAAAWkBAAAAEGNvbW1pdEx1Y2t5V2hlZWwAAAABAAAAA2JldAQAAAAFYnl0ZXMJAAQlAAAAAQgFAAAAAWkAAAAGY2FsbGVyCQAETAAAAAIJAQAAAAtTdHJpbmdFbnRyeQAAAAICAAAABHRlc3QFAAAABWJ5dGVzBQAAAANuaWwAAAAA4w9LwA==", "height": 2602506, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: Bbf3BU8TcGYU3Ap61GFcKyt3PuFetCunhNCpeij5NDW4 Next: HoCW69TMjiYjffqCBVVisk7BDQcYdenKwuASUuB7wUxk Full:
Old | New | Differences | |
---|---|---|---|
1 | - | {-# STDLIB_VERSION | |
1 | + | {-# STDLIB_VERSION 4 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | - | ||
4 | + | func a (b) = (b * 100000000) | |
5 | 5 | ||
6 | - | @Callable(b) | |
7 | - | func commit (c) = if (if ((0 > c)) | |
8 | - | then true | |
9 | - | else (c > 255)) | |
10 | - | then throw("0 <= bet <= 255") | |
11 | - | else [IntegerEntry(toBase58String(b.transactionId), c)] | |
6 | + | ||
7 | + | func c (d,e,f) = { | |
8 | + | let g = toInt(keccak256(d.transactionId)) | |
9 | + | let h = ((g % ((f - e) + 1)) + e) | |
10 | + | h | |
11 | + | } | |
12 | + | ||
13 | + | ||
14 | + | func i (d) = { | |
15 | + | let j = base58'3JmaWyFqWo8YSA8x3DXCBUW7veesxacvKx19dMv7wTMg' | |
16 | + | if ((size(d.payments) == 0)) | |
17 | + | then throw("Payment not attached") | |
18 | + | else { | |
19 | + | let k = d.payments[0] | |
20 | + | let l = k.assetId | |
21 | + | if ($isInstanceOf(l, "ByteVector")) | |
22 | + | then { | |
23 | + | let m = l | |
24 | + | if ((m == j)) | |
25 | + | then (k.amount >= a(1)) | |
26 | + | else false | |
27 | + | } | |
28 | + | else (k.amount >= a(1)) | |
29 | + | } | |
30 | + | } | |
31 | + | ||
32 | + | ||
33 | + | func n (o) = { | |
34 | + | let l = o | |
35 | + | if ((1 == l)) | |
36 | + | then a(2) | |
37 | + | else if ((5 == l)) | |
38 | + | then a(1) | |
39 | + | else if ((7 == l)) | |
40 | + | then a(4) | |
41 | + | else if ((11 == l)) | |
42 | + | then a(1) | |
43 | + | else 0 | |
44 | + | } | |
45 | + | ||
46 | + | ||
47 | + | @Callable(d) | |
48 | + | func gameLuckyWheel (p) = if (!(i(d))) | |
49 | + | then throw("Wrong payment amount or asset") | |
50 | + | else { | |
51 | + | let h = c(d, 1, 12) | |
52 | + | let q = n(h) | |
53 | + | if ((q == a(1))) | |
54 | + | then [ScriptTransfer(d.caller, q, unit), StringEntry(("game_status_" + p), "roll"), IntegerEntry(("game_" + p), q), IntegerEntry(("test_game_randomNumber_" + p), h), IntegerEntry(("test_game_winningAmount_" + p), q)] | |
55 | + | else if ((q > 0)) | |
56 | + | then [ScriptTransfer(d.caller, q, unit), StringEntry(("game_status_" + p), "win"), IntegerEntry(("game_" + p), q), IntegerEntry(("test_game_randomNumber_" + p), h), IntegerEntry(("test_game_winningAmount_" + p), q)] | |
57 | + | else [IntegerEntry(("game_" + p), q), StringEntry(("game_status_" + p), "lose"), IntegerEntry(("test_game_randomNumber_" + p), h), IntegerEntry(("test_game_winningAmount_" + p), q)] | |
58 | + | } | |
12 | 59 | ||
13 | 60 | ||
14 | 61 | ||
15 | - | @Callable(b) | |
16 | - | func reveal (d) = if ((1 > a)) | |
17 | - | then throw("N cannot be < 1") | |
18 | - | else { | |
19 | - | let e = valueOrErrorMessage(transactionHeightById(fromBase58String(d)), (d + " not found")) | |
20 | - | let f = (e + a) | |
21 | - | if ((f > height)) | |
22 | - | then throw((("wait " + toString((f - height))) + " blocks to reveal this id")) | |
23 | - | else { | |
24 | - | let g = valueOrErrorMessage(blockInfoByHeight(f), "unexcpected error") | |
25 | - | let h = valueOrErrorMessage(g.vrf, "unexcpected error") | |
26 | - | let c = valueOrErrorMessage(getInteger(d), "cannot find bet") | |
27 | - | let i = sha256(((h + toBytes(d)) + toBytes(c))) | |
28 | - | let j = (toInt(i) % 256) | |
29 | - | let k = (c == j) | |
30 | - | $Tuple2([IntegerEntry((d + "_result"), j)], k) | |
31 | - | } | |
32 | - | } | |
62 | + | @Callable(d) | |
63 | + | func commitLuckyWheel (r) = { | |
64 | + | let s = toString(d.caller) | |
65 | + | [StringEntry("test", s)] | |
66 | + | } | |
33 | 67 | ||
34 | 68 |
github/deemru/w8io/169f3d6 29.35 ms ◑