tx · Am5TaC7gE7jspn9i27Yho2cngGoGpPHrQr2qvLynDEMH 3N6hQF6HBBQ5JCKB8Xs17Q61wkG3VrLvbGd: -0.10010000 Waves 2021.12.03 03:34 [1817381] smart account 3N6hQF6HBBQ5JCKB8Xs17Q61wkG3VrLvbGd > SELF 0.00000000 Waves
{ "type": 13, "id": "Am5TaC7gE7jspn9i27Yho2cngGoGpPHrQr2qvLynDEMH", "fee": 10010000, "feeAssetId": null, "timestamp": 1638491724985, "version": 2, "chainId": 84, "sender": "3N6hQF6HBBQ5JCKB8Xs17Q61wkG3VrLvbGd", "senderPublicKey": "7Hi4o6vBstRs79NMVMjEove52dmP87RAcvNDAXN8C4Wi", "proofs": [ "4XD1x22MU7bnoNa6is4hgDBjaGt86njoRDZt6MGt3brMcvwhN9fnXbdo82s49wKNwpv254SLZor58kj5RyP3uyct" ], "script": "base64:AAIFAAAAAAAAAAgIAhIAEgASAAAAAA4AAAAABmNhc2lubwIAAAAjM010YUNMNHYxYmpUYWJVcXM3b1U0b2ZTOGZiYWkzNFdNMWkAAAAABVdBVkVTAAAAAAA7msoAAAAAAAZtYXhCZXQJAABoAAAAAgAAAAAAAAAAZAUAAAAFV0FWRVMAAAAACXNlcGFyYXRvcgIAAAABLAEAAAAKZ2V0TmV3RGVjawAAAAAJAARMAAAAAgIAAAADMDFDCQAETAAAAAICAAAAAzAyQwkABEwAAAACAgAAAAMwM0MJAARMAAAAAgIAAAADMDRDCQAETAAAAAICAAAAAzA1QwkABEwAAAACAgAAAAMwNkMJAARMAAAAAgIAAAADMDdDCQAETAAAAAICAAAAAzA4QwkABEwAAAACAgAAAAMwOUMJAARMAAAAAgIAAAADMTBDCQAETAAAAAICAAAAAzExQwkABEwAAAACAgAAAAMxMkMJAARMAAAAAgIAAAADMTNDCQAETAAAAAICAAAAAzAxRAkABEwAAAACAgAAAAMwMkQJAARMAAAAAgIAAAADMDNECQAETAAAAAICAAAAAzA0RAkABEwAAAACAgAAAAMwNUQJAARMAAAAAgIAAAADMDZECQAETAAAAAICAAAAAzA3RAkABEwAAAACAgAAAAMwOEQJAARMAAAAAgIAAAADMDlECQAETAAAAAICAAAAAzEwRAkABEwAAAACAgAAAAMxMUQJAARMAAAAAgIAAAADMTJECQAETAAAAAICAAAAAzEzRAkABEwAAAACAgAAAAMwMUgJAARMAAAAAgIAAAADMDJICQAETAAAAAICAAAAAzAzSAkABEwAAAACAgAAAAMwNEgJAARMAAAAAgIAAAADMDVICQAETAAAAAICAAAAAzA2SAkABEwAAAACAgAAAAMwN0gJAARMAAAAAgIAAAADMDhICQAETAAAAAICAAAAAzA5SAkABEwAAAACAgAAAAMxMEgJAARMAAAAAgIAAAADMTFICQAETAAAAAICAAAAAzEySAkABEwAAAACAgAAAAMxM0gJAARMAAAAAgIAAAADMDFTCQAETAAAAAICAAAAAzAyUwkABEwAAAACAgAAAAMwM1MJAARMAAAAAgIAAAADMDRTCQAETAAAAAICAAAAAzA1UwkABEwAAAACAgAAAAMwNlMJAARMAAAAAgIAAAADMDdTCQAETAAAAAICAAAAAzA4UwkABEwAAAACAgAAAAMwOVMJAARMAAAAAgIAAAADMTBTCQAETAAAAAICAAAAAzExUwkABEwAAAACAgAAAAMxMlMJAARMAAAAAgIAAAADMTNTBQAAAANuaWwBAAAADmdldFNpeE5ld0RlY2tzAAAAAAkABE4AAAACCQAETgAAAAIJAAROAAAAAgkABE4AAAACCQAETgAAAAIJAQAAAApnZXROZXdEZWNrAAAAAAkBAAAACmdldE5ld0RlY2sAAAAACQEAAAAKZ2V0TmV3RGVjawAAAAAJAQAAAApnZXROZXdEZWNrAAAAAAkBAAAACmdldE5ld0RlY2sAAAAACQEAAAAKZ2V0TmV3RGVjawAAAAABAAAAB2dldERlY2sAAAABAAAABGRlY2sDCQAAZwAAAAIAAAAAAAAAAAAJAAGQAAAAAQUAAAAEZGVjawkBAAAADmdldFNpeE5ld0RlY2tzAAAAAAUAAAAEZGVjawEAAAAPZ2V0UmFuZG9tTnVtYmVyAAAAAwAAAAV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AAAIBQAAAAJ0eAAAAA9zZW5kZXJQdWJsaWNLZXnPDGEv", "height": 1817381, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: gKLz3t98YNuYEomLykmuxyFCRVjBJYWnVfe1SFyg4e6 Next: 74DtLLFfEQPom6pDV5W9PmEbm21HFrWvhMzfms2bK7yf Diff:
Old | New | Differences | |
---|---|---|---|
38 | 38 | } | |
39 | 39 | ||
40 | 40 | ||
41 | - | func getAmountOrZero (this,key) = match getInteger(this, key) { | |
42 | - | case a: Int => | |
43 | - | a | |
44 | - | case _ => | |
45 | - | 0 | |
46 | - | } | |
47 | - | ||
48 | - | ||
49 | - | func getPayment (i) = if ((size(i.payments) == 0)) | |
41 | + | func getPayments (i) = if ((size(i.payments) == 0)) | |
50 | 42 | then throw("Payment must be attached") | |
51 | - | else { | |
52 | - | let pmt = i.payments[0] | |
53 | - | if (isDefined(pmt.assetId)) | |
54 | - | then throw("This function accepts WAVES tokens only") | |
55 | - | else pmt.amount | |
56 | - | } | |
43 | + | else if ((size(i.payments) == 1)) | |
44 | + | then { | |
45 | + | let pmt = i.payments[0] | |
46 | + | if (isDefined(pmt.assetId)) | |
47 | + | then throw("This function accepts WAVES tokens only (0)") | |
48 | + | else $Tuple2(pmt.amount, 0) | |
49 | + | } | |
50 | + | else { | |
51 | + | let pmt = i.payments[0] | |
52 | + | if (isDefined(pmt.assetId)) | |
53 | + | then throw("This function accepts WAVES tokens only (10)") | |
54 | + | else { | |
55 | + | let pmt2 = i.payments[1] | |
56 | + | if (isDefined(pmt2.assetId)) | |
57 | + | then throw("This function accepts WAVES tokens only (11)") | |
58 | + | else $Tuple2(pmt.amount, pmt2.amount) | |
59 | + | } | |
60 | + | } | |
57 | 61 | ||
58 | 62 | ||
59 | 63 | func getCardValue (stringCard) = { | |
64 | 68 | } | |
65 | 69 | ||
66 | 70 | ||
67 | - | func | |
71 | + | func isPlayerWinner (cardPlayer,cardCasino) = { | |
68 | 72 | let p = getCardValue(cardPlayer) | |
69 | 73 | let o = getCardValue(cardCasino) | |
70 | - | if ((p > o)) | |
71 | - | then callerAddress | |
72 | - | else casino | |
74 | + | (p > o) | |
73 | 75 | } | |
74 | 76 | ||
75 | 77 | ||
92 | 94 | ||
93 | 95 | ||
94 | 96 | @Callable(i) | |
95 | - | func bet ( | |
97 | + | func bet () = { | |
96 | 98 | let callerAddress = toBase58String(i.caller.bytes) | |
97 | - | let p = getPayment(i) | |
98 | - | let curSumBets = getAmountOrZero(this, (round + "_sumBets")) | |
99 | - | let currentDraws = match getInteger(this, (round + "_drawSequence")) { | |
99 | + | let $t029833009 = getPayments(i) | |
100 | + | let p = $t029833009._1 | |
101 | + | let t = $t029833009._2 | |
102 | + | let currentRound = match getInteger(this, (callerAddress + "_round")) { | |
100 | 103 | case a: Int => | |
101 | 104 | (a + 1) | |
102 | 105 | case _ => | |
103 | - | | |
106 | + | 1 | |
104 | 107 | } | |
105 | - | let currentPlayer = match getString(this, (round + "_player")) { | |
106 | - | case a: String => | |
107 | - | a | |
108 | - | case _ => | |
109 | - | unit | |
110 | - | } | |
111 | - | let initialBet = match getInteger(this, (round + "_initialBet")) { | |
112 | - | case a: Int => | |
113 | - | a | |
114 | - | case _ => | |
115 | - | p | |
116 | - | } | |
117 | - | let availableProp = (round + "_available") | |
118 | - | let newSumBets = (curSumBets + p) | |
119 | - | if (if (isDefined(getBoolean(this, (round + "_stop")))) | |
120 | - | then true | |
121 | - | else isDefined(getString(this, round))) | |
108 | + | let round = ((callerAddress + "_") + toString(currentRound)) | |
109 | + | if (isDefined(getBoolean(this, (round + "_stop")))) | |
122 | 110 | then throw("This round is already played") | |
123 | - | else if (if (isDefined(getString(this, (round + "_player")))) | |
124 | - | then (currentPlayer != callerAddress) | |
125 | - | else false) | |
126 | - | then throw("This is not your game") | |
127 | - | else if ((newSumBets > maxBet)) | |
128 | - | then throw(((("Maximum amount of bets for round " + toString(maxBet)) + ". With your bet it's ") + toString(newSumBets))) | |
129 | - | else if ((initialBet != p)) | |
130 | - | then throw(((("Initial bet not maching original:" + toString(initialBet)) + ", actual:") + toString(p))) | |
131 | - | else { | |
132 | - | let avDeck = getAvailableDeck(this, availableProp) | |
133 | - | let $t039554070 = getPlayerCardAndPositionAndUpdateDeck(round, callerAddress, avDeck) | |
134 | - | let cardPlayer = $t039554070._1 | |
135 | - | let cardPositionPlayer = $t039554070._2 | |
136 | - | let avDeck1 = $t039554070._3 | |
137 | - | let $t040754191 = getPlayerCardAndPositionAndUpdateDeck(round, callerAddress, avDeck1) | |
138 | - | let cardCasino = $t040754191._1 | |
139 | - | let cardPositionCasino = $t040754191._2 | |
140 | - | let avDeck2 = $t040754191._3 | |
141 | - | if ((getCardValue(cardPlayer) == getCardValue(cardCasino))) | |
142 | - | then [StringEntry(availableProp, makeString(avDeck2, separator)), StringEntry((round + "_player"), callerAddress), IntegerEntry((round + "_initialBet"), initialBet), StringEntry((round + "_salt_debug"), round), IntegerEntry((round + "_LastRandonNumber"), cardPositionCasino), IntegerEntry((round + "_sumBets"), newSumBets), StringEntry((round + "_playerCard"), cardPlayer), StringEntry((round + "_casinoCard"), cardCasino), IntegerEntry((round + "_drawSequence"), (currentDraws + 1))] | |
143 | - | else { | |
144 | - | let winner = getWinner(cardPlayer, cardCasino, callerAddress, casino) | |
145 | - | [StringEntry(availableProp, makeString(avDeck2, separator)), StringEntry((round + "_player"), callerAddress), IntegerEntry((round + "_initialBet"), initialBet), StringEntry((round + "_salt_debug"), round), IntegerEntry((round + "_LastRandonNumber"), cardPositionCasino), IntegerEntry((round + "_sumBets"), newSumBets), StringEntry((round + "_playerCard"), cardPlayer), StringEntry((round + "_casinoCard"), cardCasino), BooleanEntry((round + "_stop"), true), StringEntry((round + "_winner"), winner)] | |
146 | - | } | |
111 | + | else if (isDefined(getString(this, round))) | |
112 | + | then throw("You cannot bet on this game") | |
113 | + | else { | |
114 | + | let availableProp = (round + "_deck") | |
115 | + | let avDeck = getAvailableDeck(this, availableProp) | |
116 | + | let $t034893604 = getPlayerCardAndPositionAndUpdateDeck(round, callerAddress, avDeck) | |
117 | + | let cardPlayer = $t034893604._1 | |
118 | + | let cardPositionPlayer = $t034893604._2 | |
119 | + | let avDeck1 = $t034893604._3 | |
120 | + | let $t036093736 = getPlayerCardAndPositionAndUpdateDeck((round + cardPlayer), callerAddress, avDeck1) | |
121 | + | let cardCasino = $t036093736._1 | |
122 | + | let cardPositionCasino = $t036093736._2 | |
123 | + | let avDeck2 = $t036093736._3 | |
124 | + | if ((getCardValue(cardPlayer) == getCardValue(cardCasino))) | |
125 | + | then { | |
126 | + | let currentDraws = match getInteger(this, (round + "_drawSequence")) { | |
127 | + | case a: Int => | |
128 | + | (a + 1) | |
129 | + | case _ => | |
130 | + | 0 | |
147 | 131 | } | |
132 | + | if ((t != 0)) | |
133 | + | then [StringEntry(availableProp, makeString(avDeck2, separator)), IntegerEntry((callerAddress + "_round"), currentRound), IntegerEntry((round + "_LastRandonNumber"), cardPositionCasino), StringEntry((round + "_playerCard"), cardPlayer), StringEntry((round + "_casinoCard"), cardCasino), IntegerEntry((round + "_drawSequence"), currentDraws), IntegerEntry((round + "_betAmount"), p), ScriptTransfer(i.caller, (t * 10), unit)] | |
134 | + | else [StringEntry(availableProp, makeString(avDeck2, separator)), IntegerEntry((callerAddress + "_round"), currentRound), IntegerEntry((round + "_LastRandonNumber"), cardPositionCasino), StringEntry((round + "_playerCard"), cardPlayer), StringEntry((round + "_casinoCard"), cardCasino), IntegerEntry((round + "_drawSequence"), currentDraws), IntegerEntry((round + "_betAmount"), p)] | |
135 | + | } | |
136 | + | else if (isPlayerWinner(cardPlayer, cardCasino)) | |
137 | + | then [StringEntry(availableProp, makeString(avDeck2, separator)), IntegerEntry((callerAddress + "_round"), currentRound), IntegerEntry((round + "_LastRandonNumber"), cardPositionCasino), StringEntry((round + "_playerCard"), cardPlayer), StringEntry((round + "_casinoCard"), cardCasino), IntegerEntry((round + "_betAmount"), p), ScriptTransfer(i.caller, p, unit), BooleanEntry((round + "_stop"), true)] | |
138 | + | else [StringEntry(availableProp, makeString(avDeck2, separator)), IntegerEntry((callerAddress + "_round"), currentRound), IntegerEntry((round + "_LastRandonNumber"), cardPositionCasino), StringEntry((round + "_playerCard"), cardPlayer), StringEntry((round + "_casinoCard"), cardCasino), IntegerEntry((round + "_betAmount"), p), BooleanEntry((round + "_stop"), true)] | |
139 | + | } | |
148 | 140 | } | |
149 | 141 | ||
150 | 142 | ||
151 | 143 | ||
152 | 144 | @Callable(i) | |
153 | - | func | |
145 | + | func surrender () = { | |
154 | 146 | let callerAddress = toBase58String(i.caller.bytes) | |
155 | - | let withdrawKey = (round + "_withdraw") | |
156 | - | if (isDefined(getString(this, withdrawKey))) | |
157 | - | then throw("You have already got your prize") | |
158 | - | else if (!(isDefined(getString(this, (round + "_winner"))))) | |
159 | - | then throw("There is no winner, it was a draw") | |
147 | + | let currentRound = match getInteger(this, (callerAddress + "_round")) { | |
148 | + | case a: Int => | |
149 | + | toString(a) | |
150 | + | case _ => | |
151 | + | throw("Unable to find the round") | |
152 | + | } | |
153 | + | let round = ((callerAddress + "_") + currentRound) | |
154 | + | if (isDefined(getBoolean(this, (round + "_stop")))) | |
155 | + | then throw("This round is already played") | |
156 | + | else if (!(isDefined(getInteger(this, (round + "_drawSequence"))))) | |
157 | + | then throw("This game is not on war") | |
160 | 158 | else { | |
161 | - | let winner = getStringValue(this, (round + "_winner")) | |
162 | - | let player = getStringValue(this, (round + "_player")) | |
163 | - | let curSumBet = getIntegerValue(this, (round + "_sumBets")) | |
164 | - | if ((curSumBet == 0)) | |
165 | - | then throw("You won nothing this round") | |
166 | - | else if (if ((winner == callerAddress)) | |
167 | - | then (winner == casino) | |
168 | - | else false) | |
169 | - | then [StringEntry(withdrawKey, toString(curSumBet)), ScriptTransfer(i.caller, curSumBet, unit)] | |
170 | - | else if (if ((winner == callerAddress)) | |
171 | - | then (winner == player) | |
172 | - | else false) | |
173 | - | then [StringEntry(withdrawKey, toString((curSumBet * 2))), ScriptTransfer(i.caller, (curSumBet * 2), unit)] | |
174 | - | else throw("You are not the winner") | |
159 | + | let betAmount = match getInteger(this, (callerAddress + "_betAmount")) { | |
160 | + | case a: Int => | |
161 | + | a | |
162 | + | case _ => | |
163 | + | throw("Unable to find original bet amount") | |
164 | + | } | |
165 | + | [ScriptTransfer(i.caller, (betAmount / 2), unit), BooleanEntry((round + "_stop"), true)] | |
166 | + | } | |
167 | + | } | |
168 | + | ||
169 | + | ||
170 | + | ||
171 | + | @Callable(i) | |
172 | + | func goToWar () = { | |
173 | + | let callerAddress = toBase58String(i.caller.bytes) | |
174 | + | let currentRound = match getInteger(this, (callerAddress + "_round")) { | |
175 | + | case a: Int => | |
176 | + | a | |
177 | + | case _ => | |
178 | + | throw("Unable to find the round") | |
179 | + | } | |
180 | + | let round = ((callerAddress + "_") + toString(currentRound)) | |
181 | + | if (isDefined(getBoolean(this, (round + "_stop")))) | |
182 | + | then throw("This round is already played") | |
183 | + | else if (!(isDefined(getInteger(this, (round + "_drawSequence"))))) | |
184 | + | then throw("This game is not on war") | |
185 | + | else { | |
186 | + | let betAmount = match getInteger(this, (callerAddress + "_betAmount")) { | |
187 | + | case a: Int => | |
188 | + | a | |
189 | + | case _ => | |
190 | + | throw("Unable to find original bet amount") | |
191 | + | } | |
192 | + | let $t077897815 = getPayments(i) | |
193 | + | let p = $t077897815._1 | |
194 | + | let t = $t077897815._2 | |
195 | + | if ((p != betAmount)) | |
196 | + | then throw((((("original bet amount (" + toString(betAmount)) + ") different to the current payment (") + toString(p)) + ")")) | |
197 | + | else { | |
198 | + | let availableProp = (round + "_deck") | |
199 | + | let avDeck = getAvailableDeck(this, availableProp) | |
200 | + | let $t081058213 = getPlayerCardAndPositionAndUpdateDeck(round, callerAddress, avDeck) | |
201 | + | let burned1 = $t081058213._1 | |
202 | + | let burnedPos1 = $t081058213._2 | |
203 | + | let burnedDeck1 = $t081058213._3 | |
204 | + | let $t082268347 = getPlayerCardAndPositionAndUpdateDeck((round + burned1), callerAddress, burnedDeck1) | |
205 | + | let burned2 = $t082268347._1 | |
206 | + | let burnedPos2 = $t082268347._2 | |
207 | + | let burnedDeck2 = $t082268347._3 | |
208 | + | let $t083608481 = getPlayerCardAndPositionAndUpdateDeck((round + burned2), callerAddress, burnedDeck2) | |
209 | + | let burned3 = $t083608481._1 | |
210 | + | let burnedPos3 = $t083608481._2 | |
211 | + | let burnedDeck3 = $t083608481._3 | |
212 | + | let $t084948622 = getPlayerCardAndPositionAndUpdateDeck((round + burned3), callerAddress, burnedDeck3) | |
213 | + | let cardPlayer = $t084948622._1 | |
214 | + | let cardPositionPlayer = $t084948622._2 | |
215 | + | let avDeck1 = $t084948622._3 | |
216 | + | let $t086358762 = getPlayerCardAndPositionAndUpdateDeck((round + cardPlayer), callerAddress, avDeck1) | |
217 | + | let cardCasino = $t086358762._1 | |
218 | + | let cardPositionCasino = $t086358762._2 | |
219 | + | let avDeck2 = $t086358762._3 | |
220 | + | if ((getCardValue(cardPlayer) == getCardValue(cardCasino))) | |
221 | + | then { | |
222 | + | let currentDraws = match getInteger(this, (round + "_drawSequence")) { | |
223 | + | case a: Int => | |
224 | + | (a + 1) | |
225 | + | case _ => | |
226 | + | 0 | |
227 | + | } | |
228 | + | [StringEntry(availableProp, makeString(avDeck2, separator)), IntegerEntry((callerAddress + "_round"), currentRound), IntegerEntry((round + "_LastRandonNumber"), cardPositionCasino), StringEntry((round + "_playerCard"), cardPlayer), StringEntry((round + "_casinoCard"), cardCasino), IntegerEntry((round + "_drawSequence"), currentDraws), IntegerEntry((round + "_betAmount"), p)] | |
229 | + | } | |
230 | + | else if (isPlayerWinner(cardPlayer, cardCasino)) | |
231 | + | then [StringEntry(availableProp, makeString(avDeck2, separator)), IntegerEntry((callerAddress + "_round"), currentRound), IntegerEntry((round + "_LastRandonNumber"), cardPositionCasino), StringEntry((round + "_playerCard"), cardPlayer), StringEntry((round + "_casinoCard"), cardCasino), IntegerEntry((round + "_betAmount"), p), ScriptTransfer(i.caller, p, unit), BooleanEntry((round + "_stop"), true)] | |
232 | + | else [StringEntry(availableProp, makeString(avDeck2, separator)), StringEntry((round + "_round"), round), IntegerEntry((round + "_LastRandonNumber"), cardPositionCasino), StringEntry((round + "_playerCard"), cardPlayer), StringEntry((round + "_casinoCard"), cardCasino), IntegerEntry((round + "_betAmount"), p), BooleanEntry((round + "_stop"), true)] | |
233 | + | } | |
175 | 234 | } | |
176 | 235 | } | |
177 | 236 |
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 getSixNewDecks () = (((((getNewDeck() ++ getNewDeck()) ++ getNewDeck()) ++ getNewDeck()) ++ getNewDeck()) ++ getNewDeck()) | |
16 | 16 | ||
17 | 17 | ||
18 | 18 | func getDeck (deck) = if ((0 >= size(deck))) | |
19 | 19 | then getSixNewDecks() | |
20 | 20 | else deck | |
21 | 21 | ||
22 | 22 | ||
23 | 23 | func getRandomNumber (salt1,salt2,answersCount) = { | |
24 | 24 | let hash = sha256(toBytes((salt1 + salt2))) | |
25 | 25 | let index = toInt(hash) | |
26 | 26 | let rand = (index % answersCount) | |
27 | 27 | if ((0 > rand)) | |
28 | 28 | then ((-1 * rand) + 1) | |
29 | 29 | else (rand + 1) | |
30 | 30 | } | |
31 | 31 | ||
32 | 32 | ||
33 | 33 | func getPreviousRandomNumber (address) = match getInteger(this, (address + "_LastRandonNumber")) { | |
34 | 34 | case n: Int => | |
35 | 35 | toString(n) | |
36 | 36 | case _ => | |
37 | 37 | address | |
38 | 38 | } | |
39 | 39 | ||
40 | 40 | ||
41 | - | func getAmountOrZero (this,key) = match getInteger(this, key) { | |
42 | - | case a: Int => | |
43 | - | a | |
44 | - | case _ => | |
45 | - | 0 | |
46 | - | } | |
47 | - | ||
48 | - | ||
49 | - | func getPayment (i) = if ((size(i.payments) == 0)) | |
41 | + | func getPayments (i) = if ((size(i.payments) == 0)) | |
50 | 42 | then throw("Payment must be attached") | |
51 | - | else { | |
52 | - | let pmt = i.payments[0] | |
53 | - | if (isDefined(pmt.assetId)) | |
54 | - | then throw("This function accepts WAVES tokens only") | |
55 | - | else pmt.amount | |
56 | - | } | |
43 | + | else if ((size(i.payments) == 1)) | |
44 | + | then { | |
45 | + | let pmt = i.payments[0] | |
46 | + | if (isDefined(pmt.assetId)) | |
47 | + | then throw("This function accepts WAVES tokens only (0)") | |
48 | + | else $Tuple2(pmt.amount, 0) | |
49 | + | } | |
50 | + | else { | |
51 | + | let pmt = i.payments[0] | |
52 | + | if (isDefined(pmt.assetId)) | |
53 | + | then throw("This function accepts WAVES tokens only (10)") | |
54 | + | else { | |
55 | + | let pmt2 = i.payments[1] | |
56 | + | if (isDefined(pmt2.assetId)) | |
57 | + | then throw("This function accepts WAVES tokens only (11)") | |
58 | + | else $Tuple2(pmt.amount, pmt2.amount) | |
59 | + | } | |
60 | + | } | |
57 | 61 | ||
58 | 62 | ||
59 | 63 | func getCardValue (stringCard) = { | |
60 | 64 | let p = parseIntValue(take(stringCard, 2)) | |
61 | 65 | if ((p == 1)) | |
62 | 66 | then 20 | |
63 | 67 | else p | |
64 | 68 | } | |
65 | 69 | ||
66 | 70 | ||
67 | - | func | |
71 | + | func isPlayerWinner (cardPlayer,cardCasino) = { | |
68 | 72 | let p = getCardValue(cardPlayer) | |
69 | 73 | let o = getCardValue(cardCasino) | |
70 | - | if ((p > o)) | |
71 | - | then callerAddress | |
72 | - | else casino | |
74 | + | (p > o) | |
73 | 75 | } | |
74 | 76 | ||
75 | 77 | ||
76 | 78 | func getAvailableDeck (this,availableProp) = if (isDefined(getString(this, availableProp))) | |
77 | 79 | then { | |
78 | 80 | let stringDeck = getStringValue(this, availableProp) | |
79 | 81 | let deck = split(stringDeck, separator) | |
80 | 82 | getDeck(deck) | |
81 | 83 | } | |
82 | 84 | else getSixNewDecks() | |
83 | 85 | ||
84 | 86 | ||
85 | 87 | func getPlayerCardAndPositionAndUpdateDeck (meKey,callerAddress,deck) = { | |
86 | 88 | let avDeck2 = getDeck(deck) | |
87 | 89 | let cardPosition = getRandomNumber(((meKey + makeString(avDeck2, separator)) + callerAddress), getPreviousRandomNumber(callerAddress), size(avDeck2)) | |
88 | 90 | let card = avDeck2[(cardPosition % size(avDeck2))] | |
89 | 91 | let avDeck3 = removeByIndex(avDeck2, (cardPosition % size(avDeck2))) | |
90 | 92 | $Tuple3(card, cardPosition, avDeck3) | |
91 | 93 | } | |
92 | 94 | ||
93 | 95 | ||
94 | 96 | @Callable(i) | |
95 | - | func bet ( | |
97 | + | func bet () = { | |
96 | 98 | let callerAddress = toBase58String(i.caller.bytes) | |
97 | - | let p = getPayment(i) | |
98 | - | let curSumBets = getAmountOrZero(this, (round + "_sumBets")) | |
99 | - | let currentDraws = match getInteger(this, (round + "_drawSequence")) { | |
99 | + | let $t029833009 = getPayments(i) | |
100 | + | let p = $t029833009._1 | |
101 | + | let t = $t029833009._2 | |
102 | + | let currentRound = match getInteger(this, (callerAddress + "_round")) { | |
100 | 103 | case a: Int => | |
101 | 104 | (a + 1) | |
102 | 105 | case _ => | |
103 | - | | |
106 | + | 1 | |
104 | 107 | } | |
105 | - | let currentPlayer = match getString(this, (round + "_player")) { | |
106 | - | case a: String => | |
107 | - | a | |
108 | - | case _ => | |
109 | - | unit | |
110 | - | } | |
111 | - | let initialBet = match getInteger(this, (round + "_initialBet")) { | |
112 | - | case a: Int => | |
113 | - | a | |
114 | - | case _ => | |
115 | - | p | |
116 | - | } | |
117 | - | let availableProp = (round + "_available") | |
118 | - | let newSumBets = (curSumBets + p) | |
119 | - | if (if (isDefined(getBoolean(this, (round + "_stop")))) | |
120 | - | then true | |
121 | - | else isDefined(getString(this, round))) | |
108 | + | let round = ((callerAddress + "_") + toString(currentRound)) | |
109 | + | if (isDefined(getBoolean(this, (round + "_stop")))) | |
122 | 110 | then throw("This round is already played") | |
123 | - | else if (if (isDefined(getString(this, (round + "_player")))) | |
124 | - | then (currentPlayer != callerAddress) | |
125 | - | else false) | |
126 | - | then throw("This is not your game") | |
127 | - | else if ((newSumBets > maxBet)) | |
128 | - | then throw(((("Maximum amount of bets for round " + toString(maxBet)) + ". With your bet it's ") + toString(newSumBets))) | |
129 | - | else if ((initialBet != p)) | |
130 | - | then throw(((("Initial bet not maching original:" + toString(initialBet)) + ", actual:") + toString(p))) | |
131 | - | else { | |
132 | - | let avDeck = getAvailableDeck(this, availableProp) | |
133 | - | let $t039554070 = getPlayerCardAndPositionAndUpdateDeck(round, callerAddress, avDeck) | |
134 | - | let cardPlayer = $t039554070._1 | |
135 | - | let cardPositionPlayer = $t039554070._2 | |
136 | - | let avDeck1 = $t039554070._3 | |
137 | - | let $t040754191 = getPlayerCardAndPositionAndUpdateDeck(round, callerAddress, avDeck1) | |
138 | - | let cardCasino = $t040754191._1 | |
139 | - | let cardPositionCasino = $t040754191._2 | |
140 | - | let avDeck2 = $t040754191._3 | |
141 | - | if ((getCardValue(cardPlayer) == getCardValue(cardCasino))) | |
142 | - | then [StringEntry(availableProp, makeString(avDeck2, separator)), StringEntry((round + "_player"), callerAddress), IntegerEntry((round + "_initialBet"), initialBet), StringEntry((round + "_salt_debug"), round), IntegerEntry((round + "_LastRandonNumber"), cardPositionCasino), IntegerEntry((round + "_sumBets"), newSumBets), StringEntry((round + "_playerCard"), cardPlayer), StringEntry((round + "_casinoCard"), cardCasino), IntegerEntry((round + "_drawSequence"), (currentDraws + 1))] | |
143 | - | else { | |
144 | - | let winner = getWinner(cardPlayer, cardCasino, callerAddress, casino) | |
145 | - | [StringEntry(availableProp, makeString(avDeck2, separator)), StringEntry((round + "_player"), callerAddress), IntegerEntry((round + "_initialBet"), initialBet), StringEntry((round + "_salt_debug"), round), IntegerEntry((round + "_LastRandonNumber"), cardPositionCasino), IntegerEntry((round + "_sumBets"), newSumBets), StringEntry((round + "_playerCard"), cardPlayer), StringEntry((round + "_casinoCard"), cardCasino), BooleanEntry((round + "_stop"), true), StringEntry((round + "_winner"), winner)] | |
146 | - | } | |
111 | + | else if (isDefined(getString(this, round))) | |
112 | + | then throw("You cannot bet on this game") | |
113 | + | else { | |
114 | + | let availableProp = (round + "_deck") | |
115 | + | let avDeck = getAvailableDeck(this, availableProp) | |
116 | + | let $t034893604 = getPlayerCardAndPositionAndUpdateDeck(round, callerAddress, avDeck) | |
117 | + | let cardPlayer = $t034893604._1 | |
118 | + | let cardPositionPlayer = $t034893604._2 | |
119 | + | let avDeck1 = $t034893604._3 | |
120 | + | let $t036093736 = getPlayerCardAndPositionAndUpdateDeck((round + cardPlayer), callerAddress, avDeck1) | |
121 | + | let cardCasino = $t036093736._1 | |
122 | + | let cardPositionCasino = $t036093736._2 | |
123 | + | let avDeck2 = $t036093736._3 | |
124 | + | if ((getCardValue(cardPlayer) == getCardValue(cardCasino))) | |
125 | + | then { | |
126 | + | let currentDraws = match getInteger(this, (round + "_drawSequence")) { | |
127 | + | case a: Int => | |
128 | + | (a + 1) | |
129 | + | case _ => | |
130 | + | 0 | |
147 | 131 | } | |
132 | + | if ((t != 0)) | |
133 | + | then [StringEntry(availableProp, makeString(avDeck2, separator)), IntegerEntry((callerAddress + "_round"), currentRound), IntegerEntry((round + "_LastRandonNumber"), cardPositionCasino), StringEntry((round + "_playerCard"), cardPlayer), StringEntry((round + "_casinoCard"), cardCasino), IntegerEntry((round + "_drawSequence"), currentDraws), IntegerEntry((round + "_betAmount"), p), ScriptTransfer(i.caller, (t * 10), unit)] | |
134 | + | else [StringEntry(availableProp, makeString(avDeck2, separator)), IntegerEntry((callerAddress + "_round"), currentRound), IntegerEntry((round + "_LastRandonNumber"), cardPositionCasino), StringEntry((round + "_playerCard"), cardPlayer), StringEntry((round + "_casinoCard"), cardCasino), IntegerEntry((round + "_drawSequence"), currentDraws), IntegerEntry((round + "_betAmount"), p)] | |
135 | + | } | |
136 | + | else if (isPlayerWinner(cardPlayer, cardCasino)) | |
137 | + | then [StringEntry(availableProp, makeString(avDeck2, separator)), IntegerEntry((callerAddress + "_round"), currentRound), IntegerEntry((round + "_LastRandonNumber"), cardPositionCasino), StringEntry((round + "_playerCard"), cardPlayer), StringEntry((round + "_casinoCard"), cardCasino), IntegerEntry((round + "_betAmount"), p), ScriptTransfer(i.caller, p, unit), BooleanEntry((round + "_stop"), true)] | |
138 | + | else [StringEntry(availableProp, makeString(avDeck2, separator)), IntegerEntry((callerAddress + "_round"), currentRound), IntegerEntry((round + "_LastRandonNumber"), cardPositionCasino), StringEntry((round + "_playerCard"), cardPlayer), StringEntry((round + "_casinoCard"), cardCasino), IntegerEntry((round + "_betAmount"), p), BooleanEntry((round + "_stop"), true)] | |
139 | + | } | |
148 | 140 | } | |
149 | 141 | ||
150 | 142 | ||
151 | 143 | ||
152 | 144 | @Callable(i) | |
153 | - | func | |
145 | + | func surrender () = { | |
154 | 146 | let callerAddress = toBase58String(i.caller.bytes) | |
155 | - | let withdrawKey = (round + "_withdraw") | |
156 | - | if (isDefined(getString(this, withdrawKey))) | |
157 | - | then throw("You have already got your prize") | |
158 | - | else if (!(isDefined(getString(this, (round + "_winner"))))) | |
159 | - | then throw("There is no winner, it was a draw") | |
147 | + | let currentRound = match getInteger(this, (callerAddress + "_round")) { | |
148 | + | case a: Int => | |
149 | + | toString(a) | |
150 | + | case _ => | |
151 | + | throw("Unable to find the round") | |
152 | + | } | |
153 | + | let round = ((callerAddress + "_") + currentRound) | |
154 | + | if (isDefined(getBoolean(this, (round + "_stop")))) | |
155 | + | then throw("This round is already played") | |
156 | + | else if (!(isDefined(getInteger(this, (round + "_drawSequence"))))) | |
157 | + | then throw("This game is not on war") | |
160 | 158 | else { | |
161 | - | let winner = getStringValue(this, (round + "_winner")) | |
162 | - | let player = getStringValue(this, (round + "_player")) | |
163 | - | let curSumBet = getIntegerValue(this, (round + "_sumBets")) | |
164 | - | if ((curSumBet == 0)) | |
165 | - | then throw("You won nothing this round") | |
166 | - | else if (if ((winner == callerAddress)) | |
167 | - | then (winner == casino) | |
168 | - | else false) | |
169 | - | then [StringEntry(withdrawKey, toString(curSumBet)), ScriptTransfer(i.caller, curSumBet, unit)] | |
170 | - | else if (if ((winner == callerAddress)) | |
171 | - | then (winner == player) | |
172 | - | else false) | |
173 | - | then [StringEntry(withdrawKey, toString((curSumBet * 2))), ScriptTransfer(i.caller, (curSumBet * 2), unit)] | |
174 | - | else throw("You are not the winner") | |
159 | + | let betAmount = match getInteger(this, (callerAddress + "_betAmount")) { | |
160 | + | case a: Int => | |
161 | + | a | |
162 | + | case _ => | |
163 | + | throw("Unable to find original bet amount") | |
164 | + | } | |
165 | + | [ScriptTransfer(i.caller, (betAmount / 2), unit), BooleanEntry((round + "_stop"), true)] | |
166 | + | } | |
167 | + | } | |
168 | + | ||
169 | + | ||
170 | + | ||
171 | + | @Callable(i) | |
172 | + | func goToWar () = { | |
173 | + | let callerAddress = toBase58String(i.caller.bytes) | |
174 | + | let currentRound = match getInteger(this, (callerAddress + "_round")) { | |
175 | + | case a: Int => | |
176 | + | a | |
177 | + | case _ => | |
178 | + | throw("Unable to find the round") | |
179 | + | } | |
180 | + | let round = ((callerAddress + "_") + toString(currentRound)) | |
181 | + | if (isDefined(getBoolean(this, (round + "_stop")))) | |
182 | + | then throw("This round is already played") | |
183 | + | else if (!(isDefined(getInteger(this, (round + "_drawSequence"))))) | |
184 | + | then throw("This game is not on war") | |
185 | + | else { | |
186 | + | let betAmount = match getInteger(this, (callerAddress + "_betAmount")) { | |
187 | + | case a: Int => | |
188 | + | a | |
189 | + | case _ => | |
190 | + | throw("Unable to find original bet amount") | |
191 | + | } | |
192 | + | let $t077897815 = getPayments(i) | |
193 | + | let p = $t077897815._1 | |
194 | + | let t = $t077897815._2 | |
195 | + | if ((p != betAmount)) | |
196 | + | then throw((((("original bet amount (" + toString(betAmount)) + ") different to the current payment (") + toString(p)) + ")")) | |
197 | + | else { | |
198 | + | let availableProp = (round + "_deck") | |
199 | + | let avDeck = getAvailableDeck(this, availableProp) | |
200 | + | let $t081058213 = getPlayerCardAndPositionAndUpdateDeck(round, callerAddress, avDeck) | |
201 | + | let burned1 = $t081058213._1 | |
202 | + | let burnedPos1 = $t081058213._2 | |
203 | + | let burnedDeck1 = $t081058213._3 | |
204 | + | let $t082268347 = getPlayerCardAndPositionAndUpdateDeck((round + burned1), callerAddress, burnedDeck1) | |
205 | + | let burned2 = $t082268347._1 | |
206 | + | let burnedPos2 = $t082268347._2 | |
207 | + | let burnedDeck2 = $t082268347._3 | |
208 | + | let $t083608481 = getPlayerCardAndPositionAndUpdateDeck((round + burned2), callerAddress, burnedDeck2) | |
209 | + | let burned3 = $t083608481._1 | |
210 | + | let burnedPos3 = $t083608481._2 | |
211 | + | let burnedDeck3 = $t083608481._3 | |
212 | + | let $t084948622 = getPlayerCardAndPositionAndUpdateDeck((round + burned3), callerAddress, burnedDeck3) | |
213 | + | let cardPlayer = $t084948622._1 | |
214 | + | let cardPositionPlayer = $t084948622._2 | |
215 | + | let avDeck1 = $t084948622._3 | |
216 | + | let $t086358762 = getPlayerCardAndPositionAndUpdateDeck((round + cardPlayer), callerAddress, avDeck1) | |
217 | + | let cardCasino = $t086358762._1 | |
218 | + | let cardPositionCasino = $t086358762._2 | |
219 | + | let avDeck2 = $t086358762._3 | |
220 | + | if ((getCardValue(cardPlayer) == getCardValue(cardCasino))) | |
221 | + | then { | |
222 | + | let currentDraws = match getInteger(this, (round + "_drawSequence")) { | |
223 | + | case a: Int => | |
224 | + | (a + 1) | |
225 | + | case _ => | |
226 | + | 0 | |
227 | + | } | |
228 | + | [StringEntry(availableProp, makeString(avDeck2, separator)), IntegerEntry((callerAddress + "_round"), currentRound), IntegerEntry((round + "_LastRandonNumber"), cardPositionCasino), StringEntry((round + "_playerCard"), cardPlayer), StringEntry((round + "_casinoCard"), cardCasino), IntegerEntry((round + "_drawSequence"), currentDraws), IntegerEntry((round + "_betAmount"), p)] | |
229 | + | } | |
230 | + | else if (isPlayerWinner(cardPlayer, cardCasino)) | |
231 | + | then [StringEntry(availableProp, makeString(avDeck2, separator)), IntegerEntry((callerAddress + "_round"), currentRound), IntegerEntry((round + "_LastRandonNumber"), cardPositionCasino), StringEntry((round + "_playerCard"), cardPlayer), StringEntry((round + "_casinoCard"), cardCasino), IntegerEntry((round + "_betAmount"), p), ScriptTransfer(i.caller, p, unit), BooleanEntry((round + "_stop"), true)] | |
232 | + | else [StringEntry(availableProp, makeString(avDeck2, separator)), StringEntry((round + "_round"), round), IntegerEntry((round + "_LastRandonNumber"), cardPositionCasino), StringEntry((round + "_playerCard"), cardPlayer), StringEntry((round + "_casinoCard"), cardCasino), IntegerEntry((round + "_betAmount"), p), BooleanEntry((round + "_stop"), true)] | |
233 | + | } | |
175 | 234 | } | |
176 | 235 | } | |
177 | 236 | ||
178 | 237 | ||
179 | 238 | @Verifier(tx) | |
180 | 239 | func verify () = sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey) | |
181 | 240 |
github/deemru/w8io/026f985 50.39 ms ◑