tx · 3oskqxZztcAUS3PemdsMDntReEcyUDiBH8dV6p8teCoD 3Mynaio8coZLr58tu2AdBEhmCvB17vTBRkA: -0.01000000 Waves 2023.05.31 23:23 [2602614] smart account 3Mynaio8coZLr58tu2AdBEhmCvB17vTBRkA > SELF 0.00000000 Waves
{ "type": 13, "id": "3oskqxZztcAUS3PemdsMDntReEcyUDiBH8dV6p8teCoD", "fee": 1000000, "feeAssetId": null, "timestamp": 1685564698970, "version": 2, "chainId": 84, "sender": "3Mynaio8coZLr58tu2AdBEhmCvB17vTBRkA", "senderPublicKey": "Dx7cJVhpJb4qUDGiDnSjj6Wfjdj5nmzwVLfaggkbjDtv", "proofs": [ "35NTe1rtFsPekMNGBPdrPQLdTcJVHqoBydnVZX6ZNXtVpNiDgAogf4HXh5KVqFdfHuBT1v8z8cReCS7f5DoQprjY" ], "script": "base64:BgIGCAISABIABQEKbnVtVG9XYXZlcwEDbnVtCQBoAgUDbnVtAIDC1y8BC2lzUGF5bWVudE9rAQFpBBFhY2NlcHRhYmxlQXNzZXRJZAEgIkSm54hUfVEormpXug9p+nbhDnc37ahHq1IfaU2UQkcDCQAAAgkAkAMBCAUBaQhwYXltZW50cwAACQACAQIUUGF5bWVudCBub3QgYXR0YWNoZWQEAXAJAJEDAggFAWkIcGF5bWVudHMAAAQHJG1hdGNoMAgFAXAHYXNzZXRJZAMJAAECBQckbWF0Y2gwAgpCeXRlVmVjdG9yBAdhc3NldElkBQckbWF0Y2gwAwkAAAIFB2Fzc2V0SWQFEWFjY2VwdGFibGVBc3NldElkCQBnAggFAXAGYW1vdW50CQEKbnVtVG9XYXZlcwEAAQcJAGcCCAUBcAZhbW91bnQJAQpudW1Ub1dhdmVzAQABARNnZXRMdWNreVdoZWVsQmV0S2V5AQFpCQCsAgICD2JldF9MdWNreVdoZWVsXwkApQgBCAUBaQZjYWxsZXIBE2dldEx1Y2t5V2hlZWxXb25LZXkBAWkJAKwCAgIPd29uX0x1Y2t5V2hlZWxfCQClCAEIBQF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Vja3lXaGVlbFdoYXRVc2VyV29uAQUMcmFuZG9tTnVtYmVyAwkAZgIFDXdpbm5pbmdBbW91bnQAAAkAzAgCCQELRGVsZXRlRW50cnkBCQETZ2V0THVja3lXaGVlbEJldEtleQEFAWkJAMwIAgkBDlNjcmlwdFRyYW5zZmVyAwgFAWkGY2FsbGVyBQ13aW5uaW5nQW1vdW50BQR1bml0CQDMCAIJAQxJbnRlZ2VyRW50cnkCCQETZ2V0THVja3lXaGVlbFdvbktleQEFAWkFDXdpbm5pbmdBbW91bnQFA25pbAkAzAgCCQELRGVsZXRlRW50cnkBCQETZ2V0THVja3lXaGVlbEJldEtleQEFAWkJAMwIAgkBDEludGVnZXJFbnRyeQIJARNnZXRMdWNreVdoZWVsV29uS2V5AQUBaQUNd2lubmluZ0Ftb3VudAUDbmlsACXtQR0=", "height": 2602614, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 56QDn5wZ3SeL2ChmvFX1vWyLeeyg4v1B6tfs6AYukXZ8 Next: Ff8opM7C4Eyt5bc6WZFDP1TZznkpq5puyB3bga1pqe3A Diff:
Old | New | Differences | |
---|---|---|---|
45 | 45 | @Callable(i) | |
46 | 46 | func commitLuckyWheel () = if (!(isPaymentOk(i))) | |
47 | 47 | then throw("Wrong payment amount or asset") | |
48 | - | else [IntegerEntry(getLuckyWheelBetKey(i), (height + 1)) | |
48 | + | else [IntegerEntry(getLuckyWheelBetKey(i), (height + 1))] | |
49 | 49 | ||
50 | 50 | ||
51 | 51 |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 6 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | func numToWaves (num) = (num * 100000000) | |
5 | 5 | ||
6 | 6 | ||
7 | 7 | func isPaymentOk (i) = { | |
8 | 8 | let acceptableAssetId = base58'3JmaWyFqWo8YSA8x3DXCBUW7veesxacvKx19dMv7wTMg' | |
9 | 9 | if ((size(i.payments) == 0)) | |
10 | 10 | then throw("Payment not attached") | |
11 | 11 | else { | |
12 | 12 | let p = i.payments[0] | |
13 | 13 | match p.assetId { | |
14 | 14 | case assetId: ByteVector => | |
15 | 15 | if ((assetId == acceptableAssetId)) | |
16 | 16 | then (p.amount >= numToWaves(1)) | |
17 | 17 | else false | |
18 | 18 | case _ => | |
19 | 19 | (p.amount >= numToWaves(1)) | |
20 | 20 | } | |
21 | 21 | } | |
22 | 22 | } | |
23 | 23 | ||
24 | 24 | ||
25 | 25 | func getLuckyWheelBetKey (i) = ("bet_LuckyWheel_" + toString(i.caller)) | |
26 | 26 | ||
27 | 27 | ||
28 | 28 | func getLuckyWheelWonKey (i) = ("won_LuckyWheel_" + toString(i.caller)) | |
29 | 29 | ||
30 | 30 | ||
31 | 31 | func gameLuckyWheelWhatUserWon (value) = match value { | |
32 | 32 | case _ => | |
33 | 33 | if ((1 == $match0)) | |
34 | 34 | then numToWaves(2) | |
35 | 35 | else if ((5 == $match0)) | |
36 | 36 | then numToWaves(1) | |
37 | 37 | else if ((7 == $match0)) | |
38 | 38 | then numToWaves(4) | |
39 | 39 | else if ((11 == $match0)) | |
40 | 40 | then numToWaves(1) | |
41 | 41 | else 0 | |
42 | 42 | } | |
43 | 43 | ||
44 | 44 | ||
45 | 45 | @Callable(i) | |
46 | 46 | func commitLuckyWheel () = if (!(isPaymentOk(i))) | |
47 | 47 | then throw("Wrong payment amount or asset") | |
48 | - | else [IntegerEntry(getLuckyWheelBetKey(i), (height + 1)) | |
48 | + | else [IntegerEntry(getLuckyWheelBetKey(i), (height + 1))] | |
49 | 49 | ||
50 | 50 | ||
51 | 51 | ||
52 | 52 | @Callable(i) | |
53 | 53 | func revealLuckyWheel () = { | |
54 | 54 | let commitHeight = valueOrErrorMessage(getIntegerValue(getLuckyWheelBetKey(i)), "Bet not found") | |
55 | 55 | if ((commitHeight > height)) | |
56 | 56 | then throw((("wait " + toString((commitHeight - height))) + " blocks to reveal this id")) | |
57 | 57 | else { | |
58 | 58 | let revealBlock = valueOrErrorMessage(blockInfoByHeight(commitHeight), "unexcpected error") | |
59 | 59 | let vrf = valueOrErrorMessage(revealBlock.vrf, "unexcpected error") | |
60 | 60 | let randomSeed = toInt(keccak256(vrf)) | |
61 | 61 | let randomNumber = ((randomSeed % ((12 - 1) + 1)) + 1) | |
62 | 62 | let winningAmount = gameLuckyWheelWhatUserWon(randomNumber) | |
63 | 63 | if ((winningAmount > 0)) | |
64 | 64 | then [DeleteEntry(getLuckyWheelBetKey(i)), ScriptTransfer(i.caller, winningAmount, unit), IntegerEntry(getLuckyWheelWonKey(i), winningAmount)] | |
65 | 65 | else [DeleteEntry(getLuckyWheelBetKey(i)), IntegerEntry(getLuckyWheelWonKey(i), winningAmount)] | |
66 | 66 | } | |
67 | 67 | } | |
68 | 68 | ||
69 | 69 |
github/deemru/w8io/169f3d6 29.88 ms ◑