tx · Dz9sYAqvYNfsoeuJiNBgy8DaXE13QS9K5bxGPSg276Gf 3N6hQF6HBBQ5JCKB8Xs17Q61wkG3VrLvbGd: -0.10000000 Waves 2021.12.01 02:50 [1814456] smart account 3N6hQF6HBBQ5JCKB8Xs17Q61wkG3VrLvbGd > SELF 0.00000000 Waves
{ "type": 13, "id": "Dz9sYAqvYNfsoeuJiNBgy8DaXE13QS9K5bxGPSg276Gf", "fee": 10000000, "feeAssetId": null, "timestamp": 1638316270284, "version": 2, "chainId": 84, "sender": "3N6hQF6HBBQ5JCKB8Xs17Q61wkG3VrLvbGd", "senderPublicKey": "7Hi4o6vBstRs79NMVMjEove52dmP87RAcvNDAXN8C4Wi", "proofs": [ "5ALppwiUjRz93fQFVugiRUMgzui4hC2kbo7uAvsqD1J8G5ezBLicyvBs3Ngkn3L9NgpGYyuZ4uDgTKa3p81WH1Zu" ], "script": "base64:AAIFAAAAAAAAA1EIAhIDCgEIEgMKAQgSAwoBCBoMCgJhMRIGY2FzaW5vGgsKAmEyEgVXQVZFUxoMCgJhMxIGbWF4QmV0Gg8KAmE0EglzZXBhcmF0b3IaEAoCYTUSCmdldE5ld0RlY2saDQoCYTYSB2dldERlY2saCgoCYTcSBGRlY2saFQoCYTgSD2dldFJhbmRvbU51bWJlchoLCgJhORIFc2FsdDEaCwoCYjESBXNhbHQyGhIKAmIyEgxhbnN3ZXJzQ291bnQaCgoCYjMSBGhhc2gaCwoCYjQSBWluZGV4GgoKAmI1EgRyYW5kGh0KAmI2EhdnZXRQcmV2aW91c1JhbmRvbU51bWJlchoNCgJiNxIHYWRkcmVzcxoNCgJiOBIHJG1hdGNoMBoVCgJiORIPZ2V0QW1vdW50T3JaZXJvGgoKAmMxEgR0aGlzGgkKAmMyEgNrZXkaEAoCYzMSCmdldFBheW1lbnQaCQoCYzQSA3BtdBoSCgJjNRIMZ2V0Q2FyZFZhbHVlGhAKAmM2EgpzdHJpbmdDYXJkGg8KAmM3EglnZXRXaW5uZXIaEAoCY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AgIAAAADMDRECQAETAAAAAICAAAAAzA1RAkABEwAAAACAgAAAAMwNkQJAARMAAAAAgIAAAADMDdECQAETAAAAAICAAAAAzA4RAkABEwAAAACAgAAAAMwOUQJAARMAAAAAgIAAAADMTBECQAETAAAAAICAAAAAzExRAkABEwAAAACAgAAAAMxMkQJAARMAAAAAgIAAAADMTNECQAETAAAAAICAAAAAzAxSAkABEwAAAACAgAAAAMwMkgJAARMAAAAAgIAAAADMDNICQAETAAAAAICAAAAAzA0SAkABEwAAAACAgAAAAMwNUgJAARMAAAAAgIAAAADMDZICQAETAAAAAICAAAAAzA3SAkABEwAAAACAgAAAAMwOEgJAARMAAAAAgIAAAADMDlICQAETAAAAAICAAAAAzEwSAkABEwAAAACAgAAAAMxMUgJAARMAAAAAgIAAAADMTJICQAETAAAAAICAAAAAzEzSAkABEwAAAACAgAAAAMwMVMJAARMAAAAAgIAAAADMDJTCQAETAAAAAICAAAAAzAzUwkABEwAAAACAgAAAAMwNFMJAARMAAAAAgIAAAADMDVTCQAETAAAAAICAAAAAzA2UwkABEwAAAACAgAAAAMwN1MJAARMAAAAAgIAAAADMDhTCQAETAAAAAICAAAAAzA5UwkABEwAAAACAgAAAAMxMFMJAARMAAAAAgIAAAADMTFTCQAETAAAAAICAAAAAzEyUwkABEwAAAACAgAAAAMxM1MFAAAAA25pbAEAAAACYTYAAAABAAAAAmE3AwkAAGcAAAACAAAAAAAAAAAACQABkAAAAAEFAAAAAmE3CQEAAAACYTUAAAAABQAAAAJhNwEAAAACYTgAAAADAAAAAmE5AAAAAmIxAAAAAmIyBAAAAAJiMwkAAfcAAAABCQABmwAAAAEJAAEsAAAAAgUAAAACYTkFAAAAAmIxBAAAAAJiNAkABLEAAAABBQAAAAJiMwQAAAACYjUJAABqAAAAAgUAAAACYjQFAAAAAmIyAwkAAGYAAAACAAAAAAAAAAAABQAAAAJiNQkAAGQAAAACCQAAaAAAAAIA//////////8FAAAAAmI1AAAAAAAAAAABCQAAZAAAAAIFAAAAA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AAAACZDUCAAAAB193aW5uZXIEAAAAAmYyCQEAAAARQGV4dHJOYXRpdmUoMTA1MykAAAACBQAAAAJjMQkAASwAAAACBQAAAAJkNQIAAAAHX3BsYXllcgQAAAACZjMJAQAAABFAZXh0ck5hdGl2ZSgxMDUwKQAAAAIFAAAAAmMxCQABLAAAAAIFAAAAAmQ1AgAAAAhfc3VtQmV0cwMJAAAAAAAAAgUAAAACZjMAAAAAAAAAAAAJAAACAAAAAQIAAAAaWW91IHdvbiBub3RoaW5nIHRoaXMgcm91bmQDAwkAAAAAAAACBQAAAAJlOQUAAAACZDEJAAAAAAAAAgUAAAACZTkFAAAAAmExBwkABEwAAAACCQEAAAALU3RyaW5nRW50cnkAAAACBQAAAAJmMQkAAaQAAAABBQAAAAJmMwkABEwAAAACCQEAAAAOU2NyaXB0VHJhbnNmZXIAAAADCAUAAAABaQAAAAZjYWxsZXIFAAAAAmYzBQAAAAR1bml0BQAAAANuaWwDAwkAAAAAAAACBQAAAAJlOQUAAAACZDEJAAAAAAAAAgUAAAACZTkFAAAAAmYyBwkABEwAAAACCQEAAAALU3RyaW5nRW50cnkAAAACBQAAAAJmMQkAAaQAAAABCQAAaAAAAAIFAAAAAmYzAAAAAAAAAAACCQAETAAAAAIJAQAAAA5TY3JpcHRUcmFuc2ZlcgAAAAMIBQAAAAFpAAAABmNhbGxlcgkAAGgAAAACBQAAAAJmMwAAAAAAAAAAAgUAAAAEdW5pdAUAAAADbmlsCQAAAgAAAAECAAAAFllvdSBhcmUgbm90IHRoZSB3aW5uZXIAAAABAAAAAnR4AQAAAAJmNAAAAAAJAAH0AAAAAwgFAAAAAnR4AAAACWJvZHlCeXRlcwkAAZEAAAACCAUAAAACdHgAAAAGcHJvb2ZzAAAAAAAAAAAACAUAAAACdHgAAAAPc2VuZGVyUHVibGljS2V5/KQhyw==", "height": 1814456, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: nZ5dojutrrLe6L2pez8Te1wUBGVHN34gbTXkXX2ZZyq Next: 3dYqNsfbEU6cvWZKbthaShNp3R3gRfysbXFUgArsQCpA Diff:
Old | New | Differences | |
---|---|---|---|
79 | 79 | else deck | |
80 | 80 | } | |
81 | 81 | else getNewDeck() | |
82 | + | ||
83 | + | ||
84 | + | @Callable(i) | |
85 | + | func lala (round) = [StringEntry("Lala", "1")] | |
86 | + | ||
82 | 87 | ||
83 | 88 | ||
84 | 89 | @Callable(i) |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 5 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let casino = "3MtaCL4v1bjTabUqs7oU4ofS8fbai34WM1i" | |
5 | 5 | ||
6 | 6 | let WAVES = 1000000000 | |
7 | 7 | ||
8 | 8 | let maxBet = (100 * WAVES) | |
9 | 9 | ||
10 | 10 | let separator = "," | |
11 | 11 | ||
12 | 12 | func getNewDeck () = ["01C", "02C", "03C", "04C", "05C", "06C", "07C", "08C", "09C", "10C", "11C", "12C", "13C", "01D", "02D", "03D", "04D", "05D", "06D", "07D", "08D", "09D", "10D", "11D", "12D", "13D", "01H", "02H", "03H", "04H", "05H", "06H", "07H", "08H", "09H", "10H", "11H", "12H", "13H", "01S", "02S", "03S", "04S", "05S", "06S", "07S", "08S", "09S", "10S", "11S", "12S", "13S"] | |
13 | 13 | ||
14 | 14 | ||
15 | 15 | func getDeck (deck) = if ((0 >= size(deck))) | |
16 | 16 | then getNewDeck() | |
17 | 17 | else deck | |
18 | 18 | ||
19 | 19 | ||
20 | 20 | func getRandomNumber (salt1,salt2,answersCount) = { | |
21 | 21 | let hash = sha256(toBytes((salt1 + salt2))) | |
22 | 22 | let index = toInt(hash) | |
23 | 23 | let rand = (index % answersCount) | |
24 | 24 | if ((0 > rand)) | |
25 | 25 | then ((-1 * rand) + 1) | |
26 | 26 | else (rand + 1) | |
27 | 27 | } | |
28 | 28 | ||
29 | 29 | ||
30 | 30 | func getPreviousRandomNumber (address) = match getInteger(this, (address + "_LastRandonNumber")) { | |
31 | 31 | case n: Int => | |
32 | 32 | toString(n) | |
33 | 33 | case _ => | |
34 | 34 | address | |
35 | 35 | } | |
36 | 36 | ||
37 | 37 | ||
38 | 38 | func getAmountOrZero (this,key) = match getInteger(this, key) { | |
39 | 39 | case a: Int => | |
40 | 40 | a | |
41 | 41 | case _ => | |
42 | 42 | 0 | |
43 | 43 | } | |
44 | 44 | ||
45 | 45 | ||
46 | 46 | func getPayment (i) = if ((size(i.payments) == 0)) | |
47 | 47 | then throw("Payment must be attached") | |
48 | 48 | else { | |
49 | 49 | let pmt = i.payments[0] | |
50 | 50 | if (isDefined(pmt.assetId)) | |
51 | 51 | then throw("This function accepts WAVES tokens only") | |
52 | 52 | else pmt.amount | |
53 | 53 | } | |
54 | 54 | ||
55 | 55 | ||
56 | 56 | func getCardValue (stringCard) = { | |
57 | 57 | let p = parseIntValue(take(stringCard, 2)) | |
58 | 58 | if ((p == 1)) | |
59 | 59 | then 20 | |
60 | 60 | else p | |
61 | 61 | } | |
62 | 62 | ||
63 | 63 | ||
64 | 64 | func getWinner (cardPlayer,cardCasino,callerAddress,casino) = { | |
65 | 65 | let p = getCardValue(cardPlayer) | |
66 | 66 | let o = getCardValue(cardCasino) | |
67 | 67 | if ((p > o)) | |
68 | 68 | then callerAddress | |
69 | 69 | else casino | |
70 | 70 | } | |
71 | 71 | ||
72 | 72 | ||
73 | 73 | func getAvailableDeck (this,availableProp) = if (isDefined(getString(this, availableProp))) | |
74 | 74 | then { | |
75 | 75 | let stringDeck = getStringValue(this, availableProp) | |
76 | 76 | let deck = split(stringDeck, separator) | |
77 | 77 | if ((size(deck) == 0)) | |
78 | 78 | then getNewDeck() | |
79 | 79 | else deck | |
80 | 80 | } | |
81 | 81 | else getNewDeck() | |
82 | + | ||
83 | + | ||
84 | + | @Callable(i) | |
85 | + | func lala (round) = [StringEntry("Lala", "1")] | |
86 | + | ||
82 | 87 | ||
83 | 88 | ||
84 | 89 | @Callable(i) | |
85 | 90 | func bet (round) = { | |
86 | 91 | let callerAddress = toBase58String(i.caller.bytes) | |
87 | 92 | let meKey = round | |
88 | 93 | let p = getPayment(i) | |
89 | 94 | let roundBetsKey = (round + "_sumBets") | |
90 | 95 | let curSumBets = getAmountOrZero(c1, roundBetsKey) | |
91 | 96 | let currentDraws = match getInteger(c1, (round + "_drawSequence")) { | |
92 | 97 | case a: Int => | |
93 | 98 | (a + 1) | |
94 | 99 | case _ => | |
95 | 100 | 0 | |
96 | 101 | } | |
97 | 102 | let currentPlayer = match getString(c1, (round + "_player")) { | |
98 | 103 | case a: String => | |
99 | 104 | a | |
100 | 105 | case _ => | |
101 | 106 | unit | |
102 | 107 | } | |
103 | 108 | let availableProp = (meKey + "_available") | |
104 | 109 | let newSumBets = (curSumBets + p) | |
105 | 110 | if (if (isDefined(getBoolean(c1, (round + "_stop")))) | |
106 | 111 | then true | |
107 | 112 | else isDefined(getString(c1, round))) | |
108 | 113 | then throw("This round is already played") | |
109 | 114 | else if (if (isDefined(getString(c1, (round + "_player")))) | |
110 | 115 | then (currentPlayer != callerAddress) | |
111 | 116 | else false) | |
112 | 117 | then throw("This is not your game") | |
113 | 118 | else if ((newSumBets > maxBet)) | |
114 | 119 | then throw(((("Maximum amount of bets for round " + toString(maxBet)) + ". With your bet it's ") + toString(newSumBets))) | |
115 | 120 | else { | |
116 | 121 | let avDeck = getAvailableDeck(c1, availableProp) | |
117 | 122 | let cardPositionPlayer = getRandomNumber(((meKey + makeString(avDeck, separator)) + callerAddress), getPreviousRandomNumber(callerAddress), size(avDeck)) | |
118 | 123 | let cardPlayer = avDeck[(cardPositionPlayer % size(avDeck))] | |
119 | 124 | let avDeck1 = removeByIndex(avDeck, (cardPositionPlayer % size(avDeck))) | |
120 | 125 | let avDeck2 = getDeck(avDeck1) | |
121 | 126 | let cardPositionCasino = getRandomNumber(((meKey + makeString(avDeck2, separator)) + callerAddress), getPreviousRandomNumber(callerAddress), size(avDeck2)) | |
122 | 127 | let cardCasino = avDeck2[(cardPositionCasino % size(avDeck2))] | |
123 | 128 | let avDeck3 = removeByIndex(avDeck2, (cardPositionCasino % size(avDeck2))) | |
124 | 129 | if ((getCardValue(cardPlayer) == getCardValue(cardCasino))) | |
125 | 130 | then [StringEntry(availableProp, makeString(avDeck3, separator)), StringEntry((round + "_player"), callerAddress), StringEntry((meKey + "_salt_debug"), meKey), IntegerEntry((meKey + "_LastRandonNumber"), cardPositionCasino), IntegerEntry((round + "_sumBets"), newSumBets), StringEntry((meKey + "_playerCard"), cardPlayer), StringEntry((meKey + "_casinoCard"), cardCasino), IntegerEntry((round + "_drawSequence"), (currentDraws + 1))] | |
126 | 131 | else { | |
127 | 132 | let winner = getWinner(cardPlayer, cardCasino, callerAddress, casino) | |
128 | 133 | [StringEntry(availableProp, makeString(avDeck3, separator)), StringEntry((meKey + "_salt_debug"), meKey), StringEntry((round + "_player"), callerAddress), IntegerEntry((meKey + "_LastRandonNumber"), cardPositionCasino), IntegerEntry((round + "_sumBets"), newSumBets), StringEntry((meKey + "_playerCard"), cardPlayer), StringEntry((meKey + "_casinoCard"), cardCasino), BooleanEntry((round + "_stop"), true), StringEntry((round + "_winner"), winner)] | |
129 | 134 | } | |
130 | 135 | } | |
131 | 136 | } | |
132 | 137 | ||
133 | 138 | ||
134 | 139 | ||
135 | 140 | @Callable(i) | |
136 | 141 | func withdraw (round) = { | |
137 | 142 | let callerAddress = toBase58String(i.caller.bytes) | |
138 | 143 | let meKey = ((round + "_") + callerAddress) | |
139 | 144 | let withdrawKey = (round + "_withdraw") | |
140 | 145 | if (isDefined(getString(c1, withdrawKey))) | |
141 | 146 | then throw("You have already got your prize") | |
142 | 147 | else if (!(isDefined(getString(c1, (round + "_winner"))))) | |
143 | 148 | then throw("There is no winner, it was a draw") | |
144 | 149 | else { | |
145 | 150 | let winner = getStringValue(c1, (round + "_winner")) | |
146 | 151 | let player = getStringValue(c1, (round + "_player")) | |
147 | 152 | let curSumBet = getIntegerValue(c1, (round + "_sumBets")) | |
148 | 153 | if ((curSumBet == 0)) | |
149 | 154 | then throw("You won nothing this round") | |
150 | 155 | else if (if ((winner == callerAddress)) | |
151 | 156 | then (winner == casino) | |
152 | 157 | else false) | |
153 | 158 | then [StringEntry(withdrawKey, toString(curSumBet)), ScriptTransfer(i.caller, curSumBet, unit)] | |
154 | 159 | else if (if ((winner == callerAddress)) | |
155 | 160 | then (winner == player) | |
156 | 161 | else false) | |
157 | 162 | then [StringEntry(withdrawKey, toString((curSumBet * 2))), ScriptTransfer(i.caller, (curSumBet * 2), unit)] | |
158 | 163 | else throw("You are not the winner") | |
159 | 164 | } | |
160 | 165 | } | |
161 | 166 | ||
162 | 167 | ||
163 | 168 | @Verifier(tx) | |
164 | 169 | func verify () = sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey) | |
165 | 170 |
github/deemru/w8io/026f985 29.86 ms ◑