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:AAIFAAAAAAAAAAgIAhIAEgASAAAAAA4AAAAABmNhc2lubwIAAAAjM010YUNMNHYxYmpUYWJVcXM3b1U0b2ZTOGZiYWkzNFdNMWkAAAAABVdBVkVTAAAAAAA7msoAAAAAAAZtYXhCZXQJAABoAAAAAgAAAAAAAAAAZAUAAAAFV0FWRVMAAAAACXNlcGFyYXRvcgIAAAABLAEAAAAKZ2V0TmV3RGVjawAAAAAJAARMAAAAAgIAAAADMDFDCQAETAAAAAICAAAAAzAyQwkABEwAAAACAgAAAAMwM0MJAARMAAAAAgIAAAADMDRDCQAETAAAAAICAAAAAzA1QwkABEwAAAACAgAAAAMwNkMJAARMAAAAAgIAAAADMDdDCQAETAAAAAICAAAAAzA4QwkABEwAAAACAgAAAAMwOUMJAARMAAAAAgIAAAADMTBDCQAETAAAAAICAAAAAzExQwkABEwAAAACAgAAAAMxMkMJAARMAAAAAgIAAAADMTNDCQAETAAAAAICAAAAAzAxRAkABEwAAAACAgAAAAMwMkQJAARMAAAAAgIAAAADMDNECQAETAAAAAICAAAAAzA0RAkABEwAAAACAgAAAAMwNUQJAARMAAAAAgIAAAADMDZECQAETAAAAAICAAAAAzA3RAkABEwAAAACAgAAAAMwOEQJAARMAAAAAgIAAAADMDlECQAETAAAAAICAAAAAzEwRAkABEwAAAACAgAAAAMxMUQJAARMAAAAAgIAAAADMTJECQAETAAAAAICAAAAAzEzRAkABEwAAAACAgAAAAMwMUgJAARMAAAAAgIAAAADMDJICQAETAAAAAICAAAAAzAzSAkABEwAAAACAgAAAAMwNEgJAARMAAAAAgIAAAADMDVICQAETAAAAAICAAAAAzA2SAkABEwAAAACAgAAAAMwN0gJAARMAAAAAgIAAAADMDhICQAETAAAAAICAAAAAzA5SAkABEwAAAACAgAAAAMxMEgJAARMAAAAAgIAAAADMTFICQAETAAAAAICAAAAAzEySAkABEwAAAACAgAAAAMxM0gJAARMAAAAAgIAAAADMDFTCQAETAAAAAICAAAAAzAyUwkABEwAAAACAgAAAAMwM1MJAARMAAAAAgIAAAADMDRTCQAETAAAAAICAAAAAzA1UwkABEwAAAACAgAAAAMwNlMJAARMAAAAAgIAAAADMDdTCQAETAAAAAICAAAAAzA4UwkABEwAAAACAgAAAAMwOVMJAARMAAAAAgIAAAADMTBTCQAETAAAAAICAAAAAzExUwkABEwAAAACAgAAAAMxMlMJAARMAAAAAgIAAAADMTNTBQAAAANuaWwBAAAADmdldFNpeE5ld0RlY2tzAAAAAAkABE4AAAACCQAETgAAAAIJAAROAAAAAgkABE4AAAACCQAETgAAAAIJAQAAAApnZXROZXdEZWNrAAAAAAkBAAAACmdldE5ld0RlY2sAAAAACQEAAAAKZ2V0TmV3RGVjawAAAAAJAQAAAApnZXROZXdEZWNrAAAAAAkBAAAACmdldE5ld0RlY2sAAAAACQEAAAAKZ2V0TmV3RGVjawAAAAABAAAAB2dldERlY2sAAAABAAAABGRlY2sDCQAAZwAAAAIAAAAAAAAAAAAJAAGQAAAAAQUAAAAEZGVjawkBAAAADmdldFNpeE5ld0RlY2tzAAAAAAUAAAAEZGVjawEAAAAPZ2V0UmFuZG9tTnVtYmVyAAAAAwAAAA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AAAAIBQAAAAJ0eAAAAA9zZW5kZXJQdWJsaWNLZXnPDGEv", "height": 1817381, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: gKLz3t98YNuYEomLykmuxyFCRVjBJYWnVfe1SFyg4e6 Next: 74DtLLFfEQPom6pDV5W9PmEbm21HFrWvhMzfms2bK7yf Diff:
OldNewDifferences
3838 }
3939
4040
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))
5042 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+ }
5761
5862
5963 func getCardValue (stringCard) = {
6468 }
6569
6670
67-func getWinner (cardPlayer,cardCasino,callerAddress,casino) = {
71+func isPlayerWinner (cardPlayer,cardCasino) = {
6872 let p = getCardValue(cardPlayer)
6973 let o = getCardValue(cardCasino)
70- if ((p > o))
71- then callerAddress
72- else casino
74+ (p > o)
7375 }
7476
7577
9294
9395
9496 @Callable(i)
95-func bet (round) = {
97+func bet () = {
9698 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")) {
100103 case a: Int =>
101104 (a + 1)
102105 case _ =>
103- 0
106+ 1
104107 }
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"))))
122110 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
147131 }
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+ }
148140 }
149141
150142
151143
152144 @Callable(i)
153-func withdraw (round) = {
145+func surrender () = {
154146 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")
160158 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+ }
175234 }
176235 }
177236
Full:
OldNewDifferences
11 {-# STDLIB_VERSION 5 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
44 let casino = "3MtaCL4v1bjTabUqs7oU4ofS8fbai34WM1i"
55
66 let WAVES = 1000000000
77
88 let maxBet = (100 * WAVES)
99
1010 let separator = ","
1111
1212 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"]
1313
1414
1515 func getSixNewDecks () = (((((getNewDeck() ++ getNewDeck()) ++ getNewDeck()) ++ getNewDeck()) ++ getNewDeck()) ++ getNewDeck())
1616
1717
1818 func getDeck (deck) = if ((0 >= size(deck)))
1919 then getSixNewDecks()
2020 else deck
2121
2222
2323 func getRandomNumber (salt1,salt2,answersCount) = {
2424 let hash = sha256(toBytes((salt1 + salt2)))
2525 let index = toInt(hash)
2626 let rand = (index % answersCount)
2727 if ((0 > rand))
2828 then ((-1 * rand) + 1)
2929 else (rand + 1)
3030 }
3131
3232
3333 func getPreviousRandomNumber (address) = match getInteger(this, (address + "_LastRandonNumber")) {
3434 case n: Int =>
3535 toString(n)
3636 case _ =>
3737 address
3838 }
3939
4040
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))
5042 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+ }
5761
5862
5963 func getCardValue (stringCard) = {
6064 let p = parseIntValue(take(stringCard, 2))
6165 if ((p == 1))
6266 then 20
6367 else p
6468 }
6569
6670
67-func getWinner (cardPlayer,cardCasino,callerAddress,casino) = {
71+func isPlayerWinner (cardPlayer,cardCasino) = {
6872 let p = getCardValue(cardPlayer)
6973 let o = getCardValue(cardCasino)
70- if ((p > o))
71- then callerAddress
72- else casino
74+ (p > o)
7375 }
7476
7577
7678 func getAvailableDeck (this,availableProp) = if (isDefined(getString(this, availableProp)))
7779 then {
7880 let stringDeck = getStringValue(this, availableProp)
7981 let deck = split(stringDeck, separator)
8082 getDeck(deck)
8183 }
8284 else getSixNewDecks()
8385
8486
8587 func getPlayerCardAndPositionAndUpdateDeck (meKey,callerAddress,deck) = {
8688 let avDeck2 = getDeck(deck)
8789 let cardPosition = getRandomNumber(((meKey + makeString(avDeck2, separator)) + callerAddress), getPreviousRandomNumber(callerAddress), size(avDeck2))
8890 let card = avDeck2[(cardPosition % size(avDeck2))]
8991 let avDeck3 = removeByIndex(avDeck2, (cardPosition % size(avDeck2)))
9092 $Tuple3(card, cardPosition, avDeck3)
9193 }
9294
9395
9496 @Callable(i)
95-func bet (round) = {
97+func bet () = {
9698 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")) {
100103 case a: Int =>
101104 (a + 1)
102105 case _ =>
103- 0
106+ 1
104107 }
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"))))
122110 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
147131 }
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+ }
148140 }
149141
150142
151143
152144 @Callable(i)
153-func withdraw (round) = {
145+func surrender () = {
154146 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")
160158 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+ }
175234 }
176235 }
177236
178237
179238 @Verifier(tx)
180239 func verify () = sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey)
181240

github/deemru/w8io/026f985 
50.39 ms