tx · D6gbhA39Wfb7w2eRvjkZnXJYgaY762jdt7rK8jh4Fmk1 3Mynaio8coZLr58tu2AdBEhmCvB17vTBRkA: -0.01000000 Waves 2023.06.03 18:24 [2606675] smart account 3Mynaio8coZLr58tu2AdBEhmCvB17vTBRkA > SELF 0.00000000 Waves
{ "type": 13, "id": "D6gbhA39Wfb7w2eRvjkZnXJYgaY762jdt7rK8jh4Fmk1", "fee": 1000000, "feeAssetId": null, "timestamp": 1685805919544, "version": 2, "chainId": 84, "sender": "3Mynaio8coZLr58tu2AdBEhmCvB17vTBRkA", "senderPublicKey": "Dx7cJVhpJb4qUDGiDnSjj6Wfjdj5nmzwVLfaggkbjDtv", "proofs": [ "3aB4DAw4eSA3RBcAaU7sy3gifcNxi24rDQnjmrXNb1MFXfHjRTibWW4LjJXVLz7ug15nHvzAvPRWfGA9XBU4BzDg" ], "script": "base64:BgIGCAISABIABgEKbnVtVG9XYXZlcwEDbnVtCQBoAgUDbnVtAIDC1y8BC2lzUGF5bWVudE9rAQFpBBFhY2NlcHRhYmxlQXNzZXRJZAEgIkSm54hUfVEormpXug9p+nbhDnc37ahHq1IfaU2UQkcDCQAAAgkAkAMBCAUBaQhwYXltZW50cwAACQACAQIUUGF5bWVudCBub3QgYXR0YWNoZWQEAXAJAJEDAggFAWkIcGF5bWVudHMAAAQHJG1hdGNoMAgFAXAHYXNzZXRJZAMJAAECBQckbWF0Y2gwAgpCeXRlVmVjdG9yBAdhc3NldElkBQckbWF0Y2gwAwkAAAIFB2Fzc2V0SWQFEWFjY2VwdGFibGVBc3NldElkCQBnAggFAXAGYW1vdW50CQEKbnVtVG9XYXZlcwEAAQcJAGcCCAUBcAZhbW91bnQJAQpudW1Ub1dhdmVzAQABARNnZXRMdWNreVdoZWVsQmV0S2V5AQFpCQCsAgICD2JldF9MdWNreVdoZWVsXwkApQgBCAUBaQZjYWxsZXIBE2dldEx1Y2t5V2hlZWxXb25LZXkBAWkJAKwCAgIPd29uX0x1Y2t5V2hlZWxf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WdodAIRdW5leGNwZWN0ZWQgZXJyb3IEA3ZyZgkBE3ZhbHVlT3JFcnJvck1lc3NhZ2UCCAULcmV2ZWFsQmxvY2sDdnJmAhF1bmV4Y3BlY3RlZCBlcnJvcgQKcmFuZG9tU2VlZAkAsQkBCQD1AwEFA3ZyZgQMcmFuZG9tTnVtYmVyCQBkAgkAagIFCnJhbmRvbVNlZWQJAGQCCQBlAgAMAAEAAQABBA13aW5uaW5nQW1vdW50CQEZZ2FtZUx1Y2t5V2hlZWxXaGF0VXNlcldvbgEFDHJhbmRvbU51bWJlcgMJAGYCBQ13aW5uaW5nQW1vdW50AAAJAMwIAgkBC0RlbGV0ZUVudHJ5AQkBE2dldEx1Y2t5V2hlZWxCZXRLZXkBBQFpCQDMCAIJAQ5TY3JpcHRUcmFuc2ZlcgMIBQFpBmNhbGxlcgUNd2lubmluZ0Ftb3VudAUEdW5pdAkAzAgCCQEMSW50ZWdlckVudHJ5AgkBE2dldEx1Y2t5V2hlZWxXb25LZXkBBQFpBQ13aW5uaW5nQW1vdW50CQDMCAIJAQxJbnRlZ2VyRW50cnkCCQEcZ2V0THVja3lXaGVlbFJhbmRvbU51bWJlcktleQEFAWkFDHJhbmRvbU51bWJlcgUDbmlsCQDMCAIJAQtEZWxldGVFbnRyeQEJARNnZXRMdWNreVdoZWVsQmV0S2V5AQUBaQkAzAgCCQEMSW50ZWdlckVudHJ5AgkBE2dldEx1Y2t5V2hlZWxXb25LZXkBBQFpBQ13aW5uaW5nQW1vdW50CQDMCAIJAQxJbnRlZ2VyRW50cnkCCQEcZ2V0THVja3lXaGVlbFJhbmRvbU51bWJlcktleQEFAWkFDHJhbmRvbU51bWJlcgUDbmlsALb5Dzk=", "height": 2606675, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 4RG8Fit1vRGWGGHaBKGKsSo1gTuP8cgScYchQXv35yDK Next: 9LXAkVvc73oLyu77La1BUMfDFGdi7Cb11AXxdswNzwRt Diff:
Old | New | Differences | |
---|---|---|---|
38 | 38 | else if ((5 == $match0)) | |
39 | 39 | then numToWaves(1) | |
40 | 40 | else if ((7 == $match0)) | |
41 | - | then numToWaves( | |
41 | + | then numToWaves(6) | |
42 | 42 | else if ((11 == $match0)) | |
43 | 43 | then numToWaves(1) | |
44 | 44 | else 0 |
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 getLuckyWheelRandomNumberKey (i) = ("randomNumber_LuckyWheel_" + toString(i.caller)) | |
32 | 32 | ||
33 | 33 | ||
34 | 34 | func gameLuckyWheelWhatUserWon (value) = match value { | |
35 | 35 | case _ => | |
36 | 36 | if ((1 == $match0)) | |
37 | 37 | then numToWaves(2) | |
38 | 38 | else if ((5 == $match0)) | |
39 | 39 | then numToWaves(1) | |
40 | 40 | else if ((7 == $match0)) | |
41 | - | then numToWaves( | |
41 | + | then numToWaves(6) | |
42 | 42 | else if ((11 == $match0)) | |
43 | 43 | then numToWaves(1) | |
44 | 44 | else 0 | |
45 | 45 | } | |
46 | 46 | ||
47 | 47 | ||
48 | 48 | @Callable(i) | |
49 | 49 | func commitLuckyWheel () = if (!(isPaymentOk(i))) | |
50 | 50 | then throw("Wrong payment amount or asset") | |
51 | 51 | else [IntegerEntry(getLuckyWheelBetKey(i), (height + 1)), DeleteEntry(getLuckyWheelRandomNumberKey(i)), DeleteEntry(getLuckyWheelWonKey(i))] | |
52 | 52 | ||
53 | 53 | ||
54 | 54 | ||
55 | 55 | @Callable(i) | |
56 | 56 | func revealLuckyWheel () = { | |
57 | 57 | let commitHeight = valueOrErrorMessage(getIntegerValue(getLuckyWheelBetKey(i)), "Bet not found") | |
58 | 58 | if ((commitHeight > height)) | |
59 | 59 | then throw((("wait " + toString((commitHeight - height))) + " blocks to reveal this id")) | |
60 | 60 | else { | |
61 | 61 | let revealBlock = valueOrErrorMessage(blockInfoByHeight(commitHeight), "unexcpected error") | |
62 | 62 | let vrf = valueOrErrorMessage(revealBlock.vrf, "unexcpected error") | |
63 | 63 | let randomSeed = toInt(keccak256(vrf)) | |
64 | 64 | let randomNumber = ((randomSeed % ((12 - 1) + 1)) + 1) | |
65 | 65 | let winningAmount = gameLuckyWheelWhatUserWon(randomNumber) | |
66 | 66 | if ((winningAmount > 0)) | |
67 | 67 | then [DeleteEntry(getLuckyWheelBetKey(i)), ScriptTransfer(i.caller, winningAmount, unit), IntegerEntry(getLuckyWheelWonKey(i), winningAmount), IntegerEntry(getLuckyWheelRandomNumberKey(i), randomNumber)] | |
68 | 68 | else [DeleteEntry(getLuckyWheelBetKey(i)), IntegerEntry(getLuckyWheelWonKey(i), winningAmount), IntegerEntry(getLuckyWheelRandomNumberKey(i), randomNumber)] | |
69 | 69 | } | |
70 | 70 | } | |
71 | 71 | ||
72 | 72 |
github/deemru/w8io/169f3d6 25.02 ms ◑