tx · HbQfmbW7bhDhHHzrgkAdbRjuJSHa56gnSN4Vuu9QaJZb

3MqkCH2bxNpe9PqXY5WP3HYAD8S7LJs7KbK:  -0.01401000 Waves

2021.06.03 17:19 [1554298] smart account 3MqkCH2bxNpe9PqXY5WP3HYAD8S7LJs7KbK > SELF 0.00000000 Waves

{ "type": 13, "id": "HbQfmbW7bhDhHHzrgkAdbRjuJSHa56gnSN4Vuu9QaJZb", "fee": 1401000, "feeAssetId": null, "timestamp": 1622729973062, "version": 2, "chainId": 84, "sender": "3MqkCH2bxNpe9PqXY5WP3HYAD8S7LJs7KbK", "senderPublicKey": "AN4MpPP69eUoXBNDezAU1WiBE9X2oVfoN8T7XeyRxiKt", "proofs": [ "2KNZC5WB38FyZSpVzo1ETiiYL6ySkAf83sSDx5jpH8WsGKEFDMQsNVoingd3ghJX1Uky45wg62iRSbjm6ydxUtaz" ], "script": "base64:AAIEAAAAAAAAABAIAhIFCgMIAQESBQoDAQEIAAAADwAAAAAJR0FNRVNUQVJUAAAAAAAAAAAAAAAAAA5HQU1FSU5QUk9HUkVTUwAAAAAAAAAAAQAAAAAMR0FNRUZJTklTSEVEAAAAAAAAAAACAAAAABZCTE9DS1RPUFJPQ0VTU0ZPUlRIUk9XAAAAAAAAAAABAAAAAAtQQVNTTElORUJFVAIAAAALUEFTU0xJTkVCRVQAAAAAD0RPTlRQQVNTTElORUJFVAIAAAAPRE9OVFBBU1NMSU5FQkVUAAAAAAdDT01FQkVUAgAAAAdDT01FQkVUAAAAAAtET05UQ09NRUJFVAIAAAALRE9OVENPTUVCRVQAAAAACEZJRUxEQkVUAgAAAAhGSUVMREJFVAAAAAAHT0REU0JFVAIAAAAHT0REU0JFVAAAAAAKQklHNk9SOEJFVAIAAAAKQklHNk9SOEJFVAAAAAALUExBQ0VCRVRCVVkCAAAAC1BMQUNFQkVUQlVZAAAAAAxQTEFDRUJFVExPU0UCAAAADFBMQUNFQkVUTE9TRQAAAAALUExBQ0VCRVRMQVkCAAAAC1B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pZnkAAAAABAAAAAckbWF0Y2gwBQAAAAJ0eAkAAfQAAAADCAUAAAACdHgAAAAJYm9keUJ5dGVzCQABkQAAAAIIBQAAAAJ0eAAAAAZwcm9vZnMAAAAAAAAAAAAIBQAAAAJ0eAAAAA9zZW5kZXJQdWJsaWNLZXna39BH", "height": 1554298, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: FeSFjE8rquaUAgxMeUcHrR32Gm5WgTsJAVZGaMMvBg3L Next: 94KY6LsrFkzfwhspLPpuRLbpoBv8U7oQtXDhXGfPa81i Diff:
OldNewDifferences
11 {-# STDLIB_VERSION 4 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
4-let gameMasterPublicKey = base58'AN4MpPP69eUoXBNDezAU1WiBE9X2oVfoN8T7XeyRxiKt'
5-
6-let diceNumber = [2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]
7-
8-let gameToken = base58'Co7gTLr7ZJvVKwToLpuZJqmkVecy5uwupYH6qCkKuhc8'
9-
10-let RSAPUBLIC = fromBase64String("base64:MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAjnt2PdN1Pdj7rsXzbapgucn9e1XffUx1o7grAlw8C6NFuv1PPj7KnQ6RtN9xhniLF4xKlc7//TYXd1uHWmx9vu9hjciYX9UMRJnhlZO2q34mxPdcgLDKhJHDN726KI0wHpFQ5dHMyzoMLdWsahFc1Wx/XxroK2Kc1y2JBWN2akRlkxSDcluqbbUcWMyrwG6iWuVlhej5xfcuerg/psK35WGn7SLF29tWuR2x+24nM+BJUsuRG7yBZUhGrYzJk2gvpucRLea6AFRvow7RdyMYAwKFrr6mgQ0VcUw2T750e1oGanY0UdU3NPsKIgvU4Ft4uibMlMMBJvcrsEbDQHfDlwIDAQAB")
11-
124 let GAMESTART = 0
135
146 let GAMEINPROGRESS = 1
3931
4032 let PLACEBETWIN = "PLACEBETWIN"
4133
42-let gameCounterLabel = "G_GAMECOUNTER"
43-
44-let gameTotalBetsLabel = "G_TOTALBETS"
45-
46-let gameTotalProccedBetsLabel = "G_PROCESSEDBETS"
47-
48-let gameTotalFieldBetsLabel = "G_TOTALFIELD_ODDS_BETS"
49-
50-let gameTotalProccedFieldOrOddsBetsLabel = "G_PROCESSEDFIEL_ODDS_BETS"
51-
52-func gameStartHeightLabel (gameCounter) = (("G_" + toString(gameCounter)) + "_STARTHEIGHT")
53-
54-
55-func gameEndHeightLabel (gameCounter) = (("G_" + toString(gameCounter)) + "_ENDHEIGHT")
56-
57-
58-func getStartHeight (gameCounter) = getInteger(this, gameStartHeightLabel(gameCounter))
59-
60-
61-func getEndHeight (gameCounter) = getInteger(this, gameEndHeightLabel(gameCounter))
62-
63-
64-func gameBetLineLabel (betNumber) = (("B_" + toString(betNumber)) + "_BETDETAILS")
65-
66-
67-func gameFieldOrOddsBetLineLabel (betNumber) = (("B_" + toString(betNumber)) + "_BETFIELODDSDDETAILS")
68-
69-
70-func getBetDetailsResult (betNumber) = getString(this, gameBetLineLabel(betNumber))
71-
72-
73-func getFieldBetDetailsResult (betNumber) = getString(this, gameFieldOrOddsBetLineLabel(betNumber))
74-
75-
76-func authorizePermission (callerPublicKey) = (callerPublicKey != gameMasterPublicKey)
77-
78-
79-func gameCurrentPointDiceLabel (gameCounter) = (("G_" + toString(gameCounter)) + "_LASTPOINT")
80-
81-
82-func gameFirstPointDiceLabel (gameCounter) = (("G_" + toString(gameCounter)) + "_FIRSTPOINT")
83-
84-
85-func gameWinningNumberBetLabel (gameCounter,betNumber,betType) = ((((((("W_" + "BET_TYPE_") + betType) + "_") + toString(betNumber)) + "_WINNING_BET_") + toString(gameCounter)) + "_GAME_NUMBER")
86-
87-
88-func gameStateLabel (gameCounter) = (("G_" + toString(gameCounter)) + "_STATE")
89-
90-
91-func gameSumShaLabel (gameCounter) = (("G_" + toString(gameCounter)) + "_SUMSHA")
92-
93-
94-func gameRandomHashLabel (gameCounter) = (("G_" + toString(gameCounter)) + "_RANDOMHASH")
95-
96-
97-func getGameTotalBets () = getInteger(this, gameTotalBetsLabel)
98-
99-
100-func getGameProcessedBets () = getInteger(this, gameTotalProccedBetsLabel)
101-
102-
103-func getGameTotalFieldOrOddsBets () = getInteger(this, gameTotalFieldBetsLabel)
104-
105-
106-func getGameProcessedFieldOrOddsBets () = getInteger(this, gameTotalProccedFieldOrOddsBetsLabel)
107-
108-
109-func getGameState (gameCounter) = getInteger(this, gameStateLabel(gameCounter))
110-
111-
112-func getGameSumSha (gameCounter) = getString(this, gameSumShaLabel(gameCounter))
113-
114-
115-func getRandomHash (gameCounter) = getString(this, gameRandomHashLabel(gameCounter))
116-
117-
118-func gameRollsCountBetLabel (gameCounter) = (("G_" + toString(gameCounter)) + "_ROLLSCOUNT")
119-
120-
121-func gameRollDiceWithGameNumberLabel (gameCounter,rollDice) = (((("G_" + toString(gameCounter)) + "_") + toString(rollDice)) + "_GAMENUMBER_ROLLDICE")
122-
123-
124-func gameFieldOrOddsBetForNextThrowLabel (betNumber) = (("B_" + toString(betNumber)) + "_FIELD_ODDS_BET_ROLLDICE")
125-
126-
127-func getGameRollsCount (gameCounter) = getInteger(this, gameRollsCountBetLabel(gameCounter))
128-
129-
130-func getGameRollDiceWithGameNumber (gameCounter,rollDice) = getInteger(this, gameRollDiceWithGameNumberLabel(gameCounter, rollDice))
131-
132-
133-func getFieldOddsBetForNextDice (betNumber) = getInteger(this, gameFieldOrOddsBetForNextThrowLabel(betNumber))
134-
135-
136-func gameBetCounterLabel (gameNumber) = (("B_" + toString(gameNumber)) + "_BET_GAMENUMBER")
137-
138-
139-func gameFieldOrOddsBetGameCounterLabel (gameNumber) = (("B_" + toString(gameNumber)) + "_FIELD_ODDS_BET_GAMENUMBER")
140-
141-
142-func getGameBetCounter (gameNumber) = getInteger(this, gameBetCounterLabel(gameNumber))
143-
144-
145-func getGameFieldOrOddsBetCounter (gameNumber) = getInteger(this, gameFieldOrOddsBetGameCounterLabel(gameNumber))
146-
147-
148-func getGameCounter () = getInteger(this, gameCounterLabel)
149-
150-
151-func getFirstPointDice (gameCounter) = getInteger(this, gameFirstPointDiceLabel(gameCounter))
152-
153-
154-func getCurrentPointDice (gameCounter) = match getInteger(this, gameCurrentPointDiceLabel(gameCounter)) {
155- case val: Int =>
156- val
157- case _ =>
158- 0
159-}
160-
161-
162-func validateBetName (betName) = if ((betName == PASSLINEBET))
163- then true
164- else if ((betName == DONTPASSLINEBET))
165- then true
166- else false
167-
168-
169-func validateRoundBet (betName) = if ((betName == FIELDBET))
170- then true
171- else if ((betName == ODDSBET))
172- then true
173- else if ((betName == BIG6OR8BET))
174- then true
175- else if ((betName == PLACEBETBUY))
34+@Callable(i)
35+func getWinningAmount (betDetails,resultOfRound,round) = {
36+ let betType = split(betDetails, "_")[2]
37+ let odd = value(parseInt(split(betDetails, "_")[5]))
38+ let amount = value(parseInt(split(betDetails, "_")[1]))
39+ if ((betType == FIELDBET))
40+ then if ((resultOfRound == 12))
41+ then [IntegerEntry("price", (amount * 4))]
42+ else if ((resultOfRound == 2))
43+ then [IntegerEntry("price", (amount * 3))]
44+ else if (if (if (if ((resultOfRound == 5))
45+ then true
46+ else (resultOfRound == 6))
47+ then true
48+ else (resultOfRound == 7))
49+ then true
50+ else (resultOfRound == 8))
51+ then [IntegerEntry("price", 0)]
52+ else [IntegerEntry("price", (amount * 2))]
53+ else if ((betType == ODDSBET))
54+ then if (if ((odd == 4))
17655 then true
177- else if ((betName == PLACEBETLAY))
56+ else (odd == 10))
57+ then [IntegerEntry("price", (amount * 7))]
58+ else if (if ((odd == 5))
17859 then true
179- else if ((betName == COMEBET))
60+ else (odd == 8))
61+ then [IntegerEntry("price", (amount * 9))]
62+ else if (if ((odd == 3))
18063 then true
181- else if ((betName == DONTCOMEBET))
64+ else (odd == 11))
65+ then [IntegerEntry("price", (amount * 15))]
66+ else if (if ((odd == 2))
18267 then true
183- else if ((betName == PLACEBETLOSE))
68+ else (odd == 12))
69+ then [IntegerEntry("price", (amount * 30))]
70+ else if (if ((odd == 10))
18471 then true
185- else if ((betName == PLACEBETWIN))
186- then true
187- else false
188-
189-
190-func getWinningAmountForOdds (amount,odd,resultOfRound) = if (if ((odd == 4))
191- then true
192- else (odd == 10))
193- then {
194- let winningAmount = (amount * 7)
195- winningAmount
196- }
197- else if (if ((odd == 5))
198- then true
199- else (odd == 8))
200- then {
201- let winningAmount = (amount * 9)
202- winningAmount
203- }
204- else if (if ((odd == 3))
205- then true
206- else (odd == 11))
207- then {
208- let winningAmount = (amount * 15)
209- winningAmount
210- }
211- else if (if ((odd == 2))
212- then true
213- else (odd == 12))
214- then {
215- let winningAmount = (amount * 30)
216- winningAmount
217- }
218- else if (if ((odd == 10))
72+ else (odd == 4))
73+ then [IntegerEntry("price", (amount * 30))]
74+ else if ((odd == 7))
75+ then [IntegerEntry("price", (amount * 4))]
76+ else if (if ((odd == 100))
77+ then if (if ((resultOfRound == 3))
78+ then true
79+ else (resultOfRound == 12))
80+ then true
81+ else (resultOfRound == 2)
82+ else false)
83+ then [IntegerEntry("price", (amount * 7))]
84+ else [IntegerEntry("price", 0)]
85+ else if ((betType == BIG6OR8BET))
86+ then if (if ((resultOfRound == 6))
21987 then true
220- else (odd == 4))
221- then {
222- let winningAmount = (amount * 30)
223- winningAmount
224- }
225- else if ((odd == 7))
226- then {
227- let winningAmount = (amount * 4)
228- winningAmount
229- }
230- else if (if ((odd == 100))
231- then if (if ((resultOfRound == 3))
232- then true
233- else (resultOfRound == 12))
234- then true
235- else (resultOfRound == 2)
236- else false)
88+ else (resultOfRound == 8))
89+ then [IntegerEntry("price", (amount * 2))]
90+ else [IntegerEntry("price", 0)]
91+ else if (if ((betType == PLACEBETLAY))
92+ then true
93+ else (betType == PLACEBETLOSE))
94+ then if ((resultOfRound == 7))
95+ then [IntegerEntry("price", (amount * 2))]
96+ else if ((resultOfRound == odd))
97+ then [IntegerEntry("price", 0)]
98+ else [IntegerEntry("price", -1)]
99+ else if (if ((betType == PLACEBETBUY))
100+ then true
101+ else (betType == PLACEBETWIN))
102+ then if ((resultOfRound == 7))
103+ then [IntegerEntry("price", 0)]
104+ else if ((resultOfRound == odd))
105+ then [IntegerEntry("price", 2)]
106+ else [IntegerEntry("price", -1)]
107+ else if ((betType == COMEBET))
237108 then {
238- let winningAmount = (amount * 7)
239- winningAmount
109+ let playerPoint = value(parseInt(split(betDetails, "_")[6]))
110+ if ((round == 2))
111+ then if (if ((resultOfRound == 7))
112+ then true
113+ else (resultOfRound == 11))
114+ then [IntegerEntry("price", (amount * 2))]
115+ else if (if (if ((resultOfRound == 2))
116+ then true
117+ else (resultOfRound == 12))
118+ then true
119+ else (resultOfRound == 3))
120+ then [IntegerEntry("price", 0)]
121+ else if ((resultOfRound == playerPoint))
122+ then [IntegerEntry("price", (amount * 2))]
123+ else [IntegerEntry("price", -1)]
124+ else if ((round > 2))
125+ then if ((resultOfRound == 7))
126+ then [IntegerEntry("price", 0)]
127+ else if ((resultOfRound == playerPoint))
128+ then [IntegerEntry("price", (amount * 2))]
129+ else [IntegerEntry("price", -1)]
130+ else throw("Not Allow in The Beginning")
240131 }
241- else 0
242-
243-
244-func getWinningAmountForField (amount,resultOfRound) = if ((resultOfRound == 12))
245- then {
246- let winningAmount = (amount * 4)
247- winningAmount
248- }
249- else if ((resultOfRound == 2))
250- then {
251- let winningAmount = (amount * 3)
252- winningAmount
253- }
254- else if (if (if (if ((resultOfRound == 5))
255- then true
256- else (resultOfRound == 6))
257- then true
258- else (resultOfRound == 7))
259- then true
260- else (resultOfRound == 8))
261- then 0
262- else {
263- let winningAmount = (amount * 2)
264- winningAmount
265- }
266-
267-
268-func storeOneRoundBetTypes (gameCounter,amount,typeBet,caller,odd) = match getGameTotalFieldOrOddsBets() {
269- case betCount: Int =>
270- match getGameRollsCount(gameCounter) {
271- case rollCount: Int =>
272- let newTotalBetCount = (betCount + 1)
273- let newRollCountForGame = (rollCount + 1)
274- if (if ((typeBet == COMEBET))
275- then true
276- else (typeBet == DONTCOMEBET))
277- then [IntegerEntry(gameFieldOrOddsBetGameCounterLabel(newTotalBetCount), gameCounter), StringEntry(gameFieldOrOddsBetLineLabel(newTotalBetCount), ((((((((caller + "_") + amount) + "_") + typeBet) + "_active_pending_") + toString(gameCounter)) + "_") + toString(newRollCountForGame))), IntegerEntry(gameTotalFieldBetsLabel, newTotalBetCount), IntegerEntry(gameFieldOrOddsBetForNextThrowLabel(newTotalBetCount), newRollCountForGame)]
278- else [IntegerEntry(gameFieldOrOddsBetGameCounterLabel(newTotalBetCount), gameCounter), StringEntry(gameFieldOrOddsBetLineLabel(newTotalBetCount), ((((((caller + "_") + amount) + "_") + typeBet) + "_active_pending_") + toString(odd))), IntegerEntry(gameTotalFieldBetsLabel, newTotalBetCount), IntegerEntry(gameFieldOrOddsBetForNextThrowLabel(newTotalBetCount), newRollCountForGame)]
279- case _ =>
280- throw("Game doesn't exist")
281- }
282- case _ =>
283- throw("Game has not bee initialized")
284-}
285-
286-
287-func rollPlaceBetIntoAnotherRoundBet (totalBets,lastFieldProcessBet,betOnRoll,gameCounter,amount,typeBet,caller,odd) = [IntegerEntry(gameFieldOrOddsBetGameCounterLabel(totalBets), gameCounter), StringEntry(gameFieldOrOddsBetLineLabel(totalBets), ((((((caller + "_") + amount) + "_") + typeBet) + "_active_pending_") + toString(odd))), StringEntry(gameFieldOrOddsBetLineLabel(lastFieldProcessBet), ((((((caller + "_") + amount) + "_") + typeBet) + "_inactive_rolled_") + toString(odd))), IntegerEntry(gameTotalProccedFieldOrOddsBetsLabel, lastFieldProcessBet), IntegerEntry(gameTotalFieldBetsLabel, totalBets), IntegerEntry(gameFieldOrOddsBetForNextThrowLabel(totalBets), betOnRoll)]
288-
289-
290-func storeNextRoll (gameState,amount,totalFieldBets,lastFieldProcessBet,betOnRoll,gameNumber,betType,betPlacer,odd) = if ((gameState == GAMEFINISHED))
291- then rollPlaceBetIntoAnotherRoundBet((totalFieldBets + 1), (lastFieldProcessBet + 1), 1, (gameNumber + 1), toString(amount), betType, betPlacer, odd)
292- else rollPlaceBetIntoAnotherRoundBet((totalFieldBets + 1), (lastFieldProcessBet + 1), (betOnRoll + 1), gameNumber, toString(amount), betType, betPlacer, odd)
293-
294-
295-func storeComeDontComeBet (gameState,betDetails,resultOfRound,amount,totalFieldBets,lastFieldProcessBet,betOnRoll,gameNumber,betType,betPlacer,odd) = {
296- let comeBetGameNumber = value(parseInt(split(betDetails, "_")[5]))
297- let comeBetRollNumber = value(parseInt(split(betDetails, "_")[6]))
298- let resultOfGame = value(getGameRollDiceWithGameNumber(comeBetGameNumber, comeBetRollNumber))
299- if ((resultOfRound == 7))
300- then if ((betDetails == COMEBET))
301- then throw("Only Field Type of Bet can be proceed")
302- else throw("Only Field Type of Bet can be proceed")
303- else if ((resultOfRound == resultOfGame))
304- then throw("Only Field Type of Bet can be proceed")
305- else if ((gameState == GAMEFINISHED))
306- then storeNextRoll(gameState, amount, (totalFieldBets + 1), (lastFieldProcessBet + 1), 1, (gameNumber + 1), betType, betPlacer, odd)
307- else storeNextRoll(gameState, amount, (totalFieldBets + 1), (lastFieldProcessBet + 1), (betOnRoll + 1), gameNumber, betType, betPlacer, odd)
308- }
309-
310-
311-func storePassOrComeBet (gameCounter,amount,typeBet,caller) = match getGameTotalBets() {
312- case number: Int =>
313- let newTotalBets = (number + 1)
314-[IntegerEntry(gameBetCounterLabel(newTotalBets), gameCounter), StringEntry(gameBetLineLabel(newTotalBets), (((((caller + "_") + amount) + "_") + typeBet) + "_active_pending")), IntegerEntry(gameTotalBetsLabel, newTotalBets)]
315- case _ =>
316- throw("Game has not bee initialized")
317-}
318-
319-
320-func udpateBetDetailsWithLost (updateBetDetials,gameNumber,lastProceedBet,betIndex,betProceedIndex) = {
321- let updateInfoBet = (updateBetDetials + "_lost")
322-[StringEntry(betIndex, updateInfoBet), IntegerEntry(betProceedIndex, lastProceedBet)]
323- }
324-
325-
326-func udpateBetDetailsWithLostWithOdd (updateBetDetials,gameNumber,lastProceedBet,betIndex,betProceedIndex,oddNumber) = {
327- let updateInfoBet = ((updateBetDetials + "_lost_") + toString(oddNumber))
328-[StringEntry(betIndex, updateInfoBet), IntegerEntry(betProceedIndex, lastProceedBet)]
329- }
330-
331-
332-func updateBetDetailsWithWinning (updateBetDetials,gameNumber,currentProceedBet,betPlacer,winningAmount,betType,betIndex,betProceedIndex) = {
333- let updateInfoBet = (updateBetDetials + "_won_")
334-[StringEntry(gameWinningNumberBetLabel(gameNumber, currentProceedBet, betType), ((betPlacer + "_amount_") + toString(winningAmount))), StringEntry(betIndex, updateBetDetials), IntegerEntry(betProceedIndex, currentProceedBet), ScriptTransfer(value(addressFromString(betPlacer)), winningAmount, unit)]
335- }
336-
337-
338-func storeGameProgressPointState (storeIndex,gameNumber,number,rollCount,currentHeight,randomHash,state) = [IntegerEntry(gameStateLabel(gameNumber), state), IntegerEntry(storeIndex, number), IntegerEntry(gameRollsCountBetLabel(gameNumber), rollCount), IntegerEntry(gameEndHeightLabel(gameNumber), (currentHeight + BLOCKTOPROCESSFORTHROW)), StringEntry(gameRandomHashLabel(gameNumber), toBase64String(randomHash)), IntegerEntry(gameRollDiceWithGameNumberLabel(gameNumber, rollCount), number)]
339-
340-
341-@Callable(i)
342-func processNextBet () = if (authorizePermission(i.callerPublicKey))
343- then throw("processFieldBet_FORBIDDEN")
344- else match getGameTotalBets() {
345- case totalBets: Int =>
346- match getGameProcessedBets() {
347- case lastProcessBet: Int =>
348- let nextBet = (lastProcessBet + 1)
349- if ((nextBet > totalBets))
350- then throw("Next bet has not been places.")
351- else match getGameBetCounter(nextBet) {
352- case gameNumber: Int =>
353- match getGameState(gameNumber) {
354- case gameState: Int =>
355- if (if ((gameState == GAMESTART))
132+ else if ((betType == DONTCOMEBET))
133+ then {
134+ let playerPoint = value(parseInt(split(betDetails, "_")[6]))
135+ if ((round == 2))
136+ then if (if ((resultOfRound == 7))
356137 then true
357- else (gameState == GAMEINPROGRESS))
358- then throw("Game has to finished in order to process NON-FIELD bets")
359- else {
360- let betDetails = value(getBetDetailsResult(nextBet))
361- let betType = split(betDetails, "_")[2]
362- let betPlacer = split(betDetails, "_")[0]
363- let amount = value(parseInt(split(betDetails, "_")[1]))
364- let address = value(addressFromString(betPlacer))
365- let currentPoint = getCurrentPointDice(nextBet)
366- let firstPoint = getFirstPointDice(nextBet)
367- let updateBetDetials = (((((betPlacer + "_") + split(betDetails, "_")[1]) + "_") + split(betDetails, "_")[2]) + "_inactive_")
368- if ((betType == PASSLINEBET))
369- then if ((currentPoint == 0))
370- then if (if ((firstPoint == 7))
371- then true
372- else (firstPoint == 11))
373- then {
374- let winningAmount = (amount * 2)
375- updateBetDetailsWithWinning(updateBetDetials, gameNumber, nextBet, betPlacer, winningAmount, betType, gameBetLineLabel(nextBet), gameTotalProccedBetsLabel)
376- }
377- else udpateBetDetailsWithLost(updateBetDetials, gameNumber, nextBet, gameBetLineLabel(nextBet), gameTotalProccedBetsLabel)
378- else if ((firstPoint == currentPoint))
379- then {
380- let winningAmount = (amount * 2)
381- updateBetDetailsWithWinning(updateBetDetials, gameNumber, nextBet, betPlacer, winningAmount, betType, gameBetLineLabel(nextBet), gameTotalProccedBetsLabel)
382- }
383- else if ((currentPoint == 7))
384- then udpateBetDetailsWithLost(updateBetDetials, gameNumber, nextBet, gameBetLineLabel(nextBet), gameTotalProccedBetsLabel)
385- else udpateBetDetailsWithLost(updateBetDetials, gameNumber, nextBet, gameBetLineLabel(nextBet), gameTotalProccedBetsLabel)
386- else if ((betType == DONTPASSLINEBET))
387- then if ((currentPoint == 0))
388- then if (if ((firstPoint == 2))
389- then true
390- else (firstPoint == 3))
391- then {
392- let winningAmount = (amount * 2)
393- updateBetDetailsWithWinning(updateBetDetials, gameNumber, nextBet, betPlacer, winningAmount, betType, gameBetLineLabel(nextBet), gameTotalProccedBetsLabel)
394- }
395- else if (if ((currentPoint == 7))
396- then true
397- else (currentPoint == 11))
398- then udpateBetDetailsWithLost(updateBetDetials, gameNumber, nextBet, gameBetLineLabel(nextBet), gameTotalProccedBetsLabel)
399- else udpateBetDetailsWithLost(updateBetDetials, gameNumber, nextBet, gameBetLineLabel(nextBet), gameTotalProccedBetsLabel)
400- else if (if ((currentPoint == 2))
401- then true
402- else (currentPoint == 3))
403- then {
404- let winningAmount = (amount * 2)
405- updateBetDetailsWithWinning(updateBetDetials, gameNumber, nextBet, betPlacer, winningAmount, betType, gameBetLineLabel(nextBet), gameTotalProccedBetsLabel)
406- }
407- else if ((currentPoint == 7))
408- then udpateBetDetailsWithLost(updateBetDetials, gameNumber, nextBet, gameBetLineLabel(nextBet), gameTotalProccedBetsLabel)
409- else udpateBetDetailsWithLost(updateBetDetials, gameNumber, nextBet, gameBetLineLabel(nextBet), gameTotalProccedBetsLabel)
410- else throw((((((("Only " + PASSLINEBET) + ", ") + DONTPASSLINEBET) + " allowed in processNextBet()") + " currentBetType ") + betType))
411- }
412- case _ =>
413- throw("Game does not exist or has already ended.")
414- }
415- case _ =>
416- throw("Error")
417- }
418- case _ =>
419- throw("Game has not been initialized, next bets not found")
420- }
421- case _ =>
422- throw("Game has not been initialized, next bets not found")
138+ else (resultOfRound == 11))
139+ then [IntegerEntry("price", 0)]
140+ else if (if (if ((resultOfRound == 2))
141+ then true
142+ else (resultOfRound == 12))
143+ then true
144+ else (resultOfRound == 3))
145+ then [IntegerEntry("price", (amount * 2))]
146+ else if ((resultOfRound == playerPoint))
147+ then [IntegerEntry("price", (amount * 2))]
148+ else [IntegerEntry("price", -1)]
149+ else if ((round > 1))
150+ then if ((resultOfRound == 7))
151+ then [IntegerEntry("price", (amount * 2))]
152+ else if ((resultOfRound == playerPoint))
153+ then [IntegerEntry("price", 0)]
154+ else [IntegerEntry("price", -1)]
155+ else throw("Not Allow in The Beginning")
156+ }
157+ else [IntegerEntry("price", 0)]
423158 }
424159
425160
426161
427162 @Callable(i)
428-func processOneRoundBet () = if (authorizePermission(i.callerPublicKey))
429- then throw("processFieldBet_FORBIDDEN")
430- else match getGameTotalFieldOrOddsBets() {
431- case totalFieldBets: Int =>
432- match getGameProcessedFieldOrOddsBets() {
433- case lastFieldProcessBet: Int =>
434- let nextBet = (lastFieldProcessBet + 1)
435- if ((nextBet > totalFieldBets))
436- then throw("Next Field Bet has not been places.")
437- else match getGameFieldOrOddsBetCounter(nextBet) {
438- case gameNumber: Int =>
439- match getGameState(gameNumber) {
440- case gameState: Int =>
441- if ((gameState == GAMESTART))
442- then throw("Game has not started yet")
443- else {
444- let betDetails = value(getFieldBetDetailsResult(nextBet))
445- let betType = split(betDetails, "_")[2]
446- let betPlacer = split(betDetails, "_")[0]
447- let amount = value(parseInt(split(betDetails, "_")[1]))
448- let odd = value(parseInt(split(betDetails, "_")[5]))
449- let address = value(addressFromString(betPlacer))
450- let betOnRoll = value(getFieldOddsBetForNextDice(nextBet))
451- match getGameRollDiceWithGameNumber(gameNumber, betOnRoll) {
452- case resultOfRound: Int =>
453- let updateBetDetials = (((((betPlacer + "_") + split(betDetails, "_")[1]) + "_") + split(betDetails, "_")[2]) + "_inactive_")
454- if ((betType == FIELDBET))
455- then {
456- let winningAmount = getWinningAmountForField(amount, resultOfRound)
457- if ((winningAmount == 0))
458- then udpateBetDetailsWithLost(updateBetDetials, gameNumber, nextBet, gameFieldOrOddsBetLineLabel(gameNumber), gameTotalProccedFieldOrOddsBetsLabel)
459- else updateBetDetailsWithWinning(updateBetDetials, gameNumber, nextBet, betPlacer, winningAmount, betType, gameFieldOrOddsBetLineLabel(nextBet), gameTotalProccedFieldOrOddsBetsLabel)
460- }
461- else if ((betType == ODDSBET))
462- then {
463- let winningAmount = getWinningAmountForOdds(amount, odd, resultOfRound)
464- if ((winningAmount == 0))
465- then updateBetDetailsWithWinning((updateBetDetials + "_won_"), gameNumber, nextBet, betPlacer, winningAmount, betType, gameFieldOrOddsBetLineLabel(nextBet), gameTotalProccedFieldOrOddsBetsLabel)
466- else udpateBetDetailsWithLostWithOdd(updateBetDetials, gameNumber, nextBet, gameFieldOrOddsBetLineLabel(nextBet), gameTotalProccedFieldOrOddsBetsLabel, odd)
467- }
468- else if ((betType == BIG6OR8BET))
469- then if (if ((resultOfRound == 6))
470- then true
471- else (resultOfRound == 8))
472- then {
473- let winningAmount = (2 * amount)
474- updateBetDetailsWithWinning((updateBetDetials + "_won_"), gameNumber, nextBet, betPlacer, winningAmount, betType, gameFieldOrOddsBetLineLabel(nextBet), gameTotalProccedFieldOrOddsBetsLabel)
475- }
476- else udpateBetDetailsWithLostWithOdd(updateBetDetials, gameNumber, nextBet, gameFieldOrOddsBetLineLabel(nextBet), gameTotalProccedFieldOrOddsBetsLabel, odd)
477- else if (if ((betType == PLACEBETBUY))
478- then true
479- else (betType == PLACEBETWIN))
480- then if ((resultOfRound == 7))
481- then udpateBetDetailsWithLostWithOdd(updateBetDetials, gameNumber, nextBet, gameFieldOrOddsBetLineLabel(nextBet), gameTotalProccedFieldOrOddsBetsLabel, odd)
482- else if ((resultOfRound == odd))
483- then {
484- let winningAmount = (amount * 2)
485- updateBetDetailsWithWinning((updateBetDetials + "_won_"), gameNumber, nextBet, betPlacer, winningAmount, betType, gameFieldOrOddsBetLineLabel(nextBet), gameTotalProccedFieldOrOddsBetsLabel)
486- }
487- else storeNextRoll(gameState, amount, (totalFieldBets + 1), (lastFieldProcessBet + 1), 1, (gameNumber + 1), betType, betPlacer, odd)
488- else if (if ((betType == PLACEBETLAY))
489- then true
490- else (betType == PLACEBETLOSE))
491- then if ((resultOfRound == 7))
492- then {
493- let winningAmount = (amount * 2)
494- updateBetDetailsWithWinning(updateBetDetials, gameNumber, nextBet, betPlacer, winningAmount, betType, gameFieldOrOddsBetLineLabel(nextBet), gameTotalProccedFieldOrOddsBetsLabel)
495- }
496- else if ((resultOfRound == odd))
497- then udpateBetDetailsWithLostWithOdd(updateBetDetials, gameNumber, nextBet, gameFieldOrOddsBetLineLabel(nextBet), gameTotalProccedFieldOrOddsBetsLabel, odd)
498- else storeNextRoll(gameState, amount, (totalFieldBets + 1), (lastFieldProcessBet + 1), 1, (gameNumber + 1), betType, betPlacer, odd)
499- else if (if ((betType == COMEBET))
500- then true
501- else (betType == DONTCOMEBET))
502- then storeComeDontComeBet(gameState, betDetails, resultOfRound, amount, totalFieldBets, lastFieldProcessBet, betOnRoll, gameNumber, betType, betPlacer, odd)
503- else throw("Only Field Type of Bet can be proceed")
504- case _ =>
505- throw("There is no result for this round yet")
506- }
507- }
508- case _ =>
509- throw("Game does not exist or has already ended")
510- }
511- case _ =>
512- throw("Error")
513- }
514- case _ =>
515- throw("Game has not been initialized, next bets not found")
516- }
517- case _ =>
518- throw("Game has not been initialized, next bets not found")
519- }
520-
521-
522-
523-@Callable(i)
524-func initGame () = if (authorizePermission(i.callerPublicKey))
525- then throw("initGame_FORBIDDEN")
526- else match getGameCounter() {
527- case counter: Int =>
528- throw("INIT_ALREADY_DONE")
529- case _ =>
530-[IntegerEntry(gameCounterLabel, 0), IntegerEntry(gameTotalBetsLabel, 0), IntegerEntry(gameTotalProccedBetsLabel, 0), IntegerEntry(gameTotalFieldBetsLabel, 0), IntegerEntry(gameTotalProccedFieldOrOddsBetsLabel, 0)]
531- }
532-
533-
534-
535-@Callable(i)
536-func startGame (randomHash) = if (authorizePermission(i.callerPublicKey))
537- then throw("startGame_FORBIDDEN")
538- else match getGameCounter() {
539- case number: Int =>
540- if ((number == 0))
541- then {
542- let newNumber = (number + 1)
543-[IntegerEntry(gameCounterLabel, newNumber), IntegerEntry(gameStateLabel(newNumber), GAMESTART), IntegerEntry(gameStartHeightLabel(newNumber), lastBlock.height), IntegerEntry(gameEndHeightLabel(newNumber), (lastBlock.height + BLOCKTOPROCESSFORTHROW)), IntegerEntry(gameRollsCountBetLabel(newNumber), 0), StringEntry(gameSumShaLabel(newNumber), toBase58String(sha256(fromBase64String(randomHash))))]
544- }
545- else match getGameState(number) {
546- case state: Int =>
547- if (if ((state == GAMEINPROGRESS))
548- then true
549- else (state == GAMESTART))
550- then throw("The previous game is still in progress")
551- else {
552- let newNumber = (number + 1)
553-[IntegerEntry(gameCounterLabel, newNumber), IntegerEntry(gameStateLabel(newNumber), GAMESTART), IntegerEntry(gameStartHeightLabel(newNumber), lastBlock.height), IntegerEntry(gameEndHeightLabel(newNumber), (lastBlock.height + BLOCKTOPROCESSFORTHROW)), IntegerEntry(gameRollsCountBetLabel(newNumber), 0), StringEntry(gameSumShaLabel(newNumber), toBase58String(sha256(fromBase64String(randomHash))))]
554- }
555- case _ =>
556- throw("Error")
557- }
558- case _ =>
559- throw("INIT_NEED")
560- }
561-
562-
563-
564-@Callable(i)
565-func placeBet (typeBet) = if (validateBetName(typeBet))
566- then if ((size(i.payments) == 0))
567- then throw("Payment not attached")
568- else match getGameCounter() {
569- case GAMENUMBER: Int =>
570- let p = i.payments[0]
571- match getGameState(GAMENUMBER) {
572- case state: Int =>
573- if ((state == GAMESTART))
574- then if (if ((typeBet == PASSLINEBET))
575- then true
576- else (typeBet == DONTPASSLINEBET))
577- then storePassOrComeBet(GAMENUMBER, toString(p.amount), typeBet, toBase58String(i.caller.bytes))
578- else throw((((((("Only " + PASSLINEBET) + ", ") + DONTPASSLINEBET) + " and ") + FIELDBET) + " are allowed in the Beginning of Game"))
579- else if ((state == GAMEINPROGRESS))
580- then throw((((((("Only " + COMEBET) + ", ") + DONTCOMEBET) + " and ") + FIELDBET) + " ARE ALLOWED at Start."))
581- else if ((state == GAMEFINISHED))
582- then throw("Game already ended.")
583- else throw("Unknown Game State.")
584- case _ =>
585- throw("Game does not exist or has already ended.")
586- }
587- case _ =>
588- throw("Game has not been initialized.")
589- }
590- else throw(((((((((("Unsupported Type of Bet for Crap. Please Select one of " + PASSLINEBET) + ", ") + DONTPASSLINEBET) + ", ") + COMEBET) + ", ") + DONTCOMEBET) + ", ") + FIELDBET))
591-
592-
593-
594-@Callable(i)
595-func placeRoundBet (typeBet,oddNumber) = if (validateRoundBet(typeBet))
596- then if ((size(i.payments) == 0))
597- then throw("Payment not attached")
598- else match getGameCounter() {
599- case GAMENUMBER: Int =>
600- let p = i.payments[0]
601- match getGameState(GAMENUMBER) {
602- case state: Int =>
603- if ((state == GAMEFINISHED))
604- then throw("Game already ended.")
605- else if (if ((typeBet == COMEBET))
606- then true
607- else (typeBet == DONTCOMEBET))
608- then if ((state == GAMESTART))
609- then throw("Cannot place COME OR DONTCOME BET IF GAME HAS NOT STARTED")
610- else storeOneRoundBetTypes(GAMENUMBER, toString(p.amount), typeBet, toBase58String(i.caller.bytes), 0)
611- else storeOneRoundBetTypes(GAMENUMBER, toString(p.amount), typeBet, toBase58String(i.caller.bytes), oddNumber)
612- case _ =>
613- throw("Game does not exist or has already ended.")
614- }
615- case _ =>
616- throw("Game has not been initialized.")
617- }
618- else throw(((((((((("Unsupported Type of Bet for Crap. Please Select one of " + ODDSBET) + ", ") + DONTPASSLINEBET) + ", ") + COMEBET) + ", ") + DONTCOMEBET) + ", ") + FIELDBET))
619-
620-
621-
622-@Callable(i)
623-func throwDices (rsaSign,gameNumber) = if (authorizePermission(i.callerPublicKey))
624- then throw("throwDices_FORBIDDEN")
625- else match getGameState(gameNumber) {
626- case state: Int =>
627- if ((state == GAMEFINISHED))
628- then throw("Game is finished")
629- else {
630- let currentHeight = lastBlock.height
631- let lastHeightAllowed = value(getEndHeight(gameNumber))
632- if ((currentHeight >= lastHeightAllowed))
633- then match getGameSumSha(gameNumber) {
634- case sumSha: String =>
635- let sig = fromBase64String(rsaSign)
636- let rsaSigValid = rsaVerify(SHA256, fromBase58String(sumSha), sig, RSAPUBLIC)
637- match blockInfoByHeight((lastBlock.height - 1)) {
638- case previousBlock: BlockInfo =>
639- let randomHash = sha256((take(sig, 4) + take(previousBlock.generationSignature, 8)))
640- if (!(rsaSigValid))
641- then throw("INVALID_RSA_SIGN")
642- else {
643- let randNumber = (toInt(randomHash) % 11)
644- let number = diceNumber[randNumber]
645- match getGameRollsCount(gameNumber) {
646- case rollCountNumber: Int =>
647- let newRollCountNumber = (rollCountNumber + 1)
648- if ((state == GAMESTART))
649- then if (if (if (if (if ((number == 7))
650- then true
651- else (number == 11))
652- then true
653- else (number == 2))
654- then true
655- else (number == 3))
656- then true
657- else (number == 12))
658- then storeGameProgressPointState(gameFirstPointDiceLabel(gameNumber), gameNumber, number, newRollCountNumber, currentHeight, randomHash, GAMEFINISHED)
659- else storeGameProgressPointState(gameFirstPointDiceLabel(gameNumber), gameNumber, number, newRollCountNumber, currentHeight, randomHash, GAMEINPROGRESS)
660- else {
661- let currentPoint = value(getCurrentPointDice(gameNumber))
662- let firstPoint = value(getFirstPointDice(gameNumber))
663- if ((currentPoint == 0))
664- then if (if ((number == 7))
665- then true
666- else (firstPoint == number))
667- then storeGameProgressPointState(gameCurrentPointDiceLabel(gameNumber), gameNumber, number, newRollCountNumber, currentHeight, randomHash, GAMEFINISHED)
668- else storeGameProgressPointState(gameCurrentPointDiceLabel(gameNumber), gameNumber, number, newRollCountNumber, currentHeight, randomHash, GAMEINPROGRESS)
669- else if (if ((number == 7))
670- then true
671- else (firstPoint == number))
672- then storeGameProgressPointState(gameCurrentPointDiceLabel(gameNumber), gameNumber, number, newRollCountNumber, currentHeight, randomHash, GAMEFINISHED)
673- else storeGameProgressPointState(gameCurrentPointDiceLabel(gameNumber), gameNumber, number, newRollCountNumber, currentHeight, randomHash, GAMEINPROGRESS)
674- }
675- case _ =>
676- throw("No dices have been thrown")
677- }
678- }
679- case _ =>
680- throw("Last block doesn't exist.")
681- }
682- case _ =>
683- throw("SHA doesn't exist")
684- }
685- else throw("Throw dice not allow still waiting for block to process")
686- }
687- case _ =>
688- throw("Game does not exist or has already ended.")
163+func getWinningAmountPassLineBets (firstPoint,lastPoint,betDetails) = {
164+ let betType = split(betDetails, "_")[2]
165+ let betPlacer = split(betDetails, "_")[0]
166+ let amount = value(parseInt(split(betDetails, "_")[1]))
167+ if ((betType == PASSLINEBET))
168+ then if ((lastPoint == 0))
169+ then if (if ((firstPoint == 7))
170+ then true
171+ else (firstPoint == 11))
172+ then [IntegerEntry("price", (amount * 2))]
173+ else [IntegerEntry("price", (amount * 0))]
174+ else if ((firstPoint == lastPoint))
175+ then [IntegerEntry("price", (amount * 2))]
176+ else if ((lastPoint == 7))
177+ then [IntegerEntry("price", (amount * 0))]
178+ else [IntegerEntry("price", (amount * 0))]
179+ else if ((betType == DONTPASSLINEBET))
180+ then if ((lastPoint == 0))
181+ then if (if ((firstPoint == 2))
182+ then true
183+ else (firstPoint == 3))
184+ then [IntegerEntry("price", (amount * 2))]
185+ else if (if ((lastPoint == 7))
186+ then true
187+ else (lastPoint == 11))
188+ then [IntegerEntry("price", (amount * 0))]
189+ else [IntegerEntry("price", (amount * 0))]
190+ else if (if ((lastPoint == 2))
191+ then true
192+ else (lastPoint == 3))
193+ then [IntegerEntry("price", (amount * 2))]
194+ else if ((lastPoint == 7))
195+ then [IntegerEntry("price", (amount * 0))]
196+ else [IntegerEntry("price", (amount * 0))]
197+ else [IntegerEntry("price", (amount * 0))]
689198 }
690199
691200
Full:
OldNewDifferences
11 {-# STDLIB_VERSION 4 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
4-let gameMasterPublicKey = base58'AN4MpPP69eUoXBNDezAU1WiBE9X2oVfoN8T7XeyRxiKt'
5-
6-let diceNumber = [2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]
7-
8-let gameToken = base58'Co7gTLr7ZJvVKwToLpuZJqmkVecy5uwupYH6qCkKuhc8'
9-
10-let RSAPUBLIC = fromBase64String("base64:MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAjnt2PdN1Pdj7rsXzbapgucn9e1XffUx1o7grAlw8C6NFuv1PPj7KnQ6RtN9xhniLF4xKlc7//TYXd1uHWmx9vu9hjciYX9UMRJnhlZO2q34mxPdcgLDKhJHDN726KI0wHpFQ5dHMyzoMLdWsahFc1Wx/XxroK2Kc1y2JBWN2akRlkxSDcluqbbUcWMyrwG6iWuVlhej5xfcuerg/psK35WGn7SLF29tWuR2x+24nM+BJUsuRG7yBZUhGrYzJk2gvpucRLea6AFRvow7RdyMYAwKFrr6mgQ0VcUw2T750e1oGanY0UdU3NPsKIgvU4Ft4uibMlMMBJvcrsEbDQHfDlwIDAQAB")
11-
124 let GAMESTART = 0
135
146 let GAMEINPROGRESS = 1
157
168 let GAMEFINISHED = 2
179
1810 let BLOCKTOPROCESSFORTHROW = 1
1911
2012 let PASSLINEBET = "PASSLINEBET"
2113
2214 let DONTPASSLINEBET = "DONTPASSLINEBET"
2315
2416 let COMEBET = "COMEBET"
2517
2618 let DONTCOMEBET = "DONTCOMEBET"
2719
2820 let FIELDBET = "FIELDBET"
2921
3022 let ODDSBET = "ODDSBET"
3123
3224 let BIG6OR8BET = "BIG6OR8BET"
3325
3426 let PLACEBETBUY = "PLACEBETBUY"
3527
3628 let PLACEBETLOSE = "PLACEBETLOSE"
3729
3830 let PLACEBETLAY = "PLACEBETLAY"
3931
4032 let PLACEBETWIN = "PLACEBETWIN"
4133
42-let gameCounterLabel = "G_GAMECOUNTER"
43-
44-let gameTotalBetsLabel = "G_TOTALBETS"
45-
46-let gameTotalProccedBetsLabel = "G_PROCESSEDBETS"
47-
48-let gameTotalFieldBetsLabel = "G_TOTALFIELD_ODDS_BETS"
49-
50-let gameTotalProccedFieldOrOddsBetsLabel = "G_PROCESSEDFIEL_ODDS_BETS"
51-
52-func gameStartHeightLabel (gameCounter) = (("G_" + toString(gameCounter)) + "_STARTHEIGHT")
53-
54-
55-func gameEndHeightLabel (gameCounter) = (("G_" + toString(gameCounter)) + "_ENDHEIGHT")
56-
57-
58-func getStartHeight (gameCounter) = getInteger(this, gameStartHeightLabel(gameCounter))
59-
60-
61-func getEndHeight (gameCounter) = getInteger(this, gameEndHeightLabel(gameCounter))
62-
63-
64-func gameBetLineLabel (betNumber) = (("B_" + toString(betNumber)) + "_BETDETAILS")
65-
66-
67-func gameFieldOrOddsBetLineLabel (betNumber) = (("B_" + toString(betNumber)) + "_BETFIELODDSDDETAILS")
68-
69-
70-func getBetDetailsResult (betNumber) = getString(this, gameBetLineLabel(betNumber))
71-
72-
73-func getFieldBetDetailsResult (betNumber) = getString(this, gameFieldOrOddsBetLineLabel(betNumber))
74-
75-
76-func authorizePermission (callerPublicKey) = (callerPublicKey != gameMasterPublicKey)
77-
78-
79-func gameCurrentPointDiceLabel (gameCounter) = (("G_" + toString(gameCounter)) + "_LASTPOINT")
80-
81-
82-func gameFirstPointDiceLabel (gameCounter) = (("G_" + toString(gameCounter)) + "_FIRSTPOINT")
83-
84-
85-func gameWinningNumberBetLabel (gameCounter,betNumber,betType) = ((((((("W_" + "BET_TYPE_") + betType) + "_") + toString(betNumber)) + "_WINNING_BET_") + toString(gameCounter)) + "_GAME_NUMBER")
86-
87-
88-func gameStateLabel (gameCounter) = (("G_" + toString(gameCounter)) + "_STATE")
89-
90-
91-func gameSumShaLabel (gameCounter) = (("G_" + toString(gameCounter)) + "_SUMSHA")
92-
93-
94-func gameRandomHashLabel (gameCounter) = (("G_" + toString(gameCounter)) + "_RANDOMHASH")
95-
96-
97-func getGameTotalBets () = getInteger(this, gameTotalBetsLabel)
98-
99-
100-func getGameProcessedBets () = getInteger(this, gameTotalProccedBetsLabel)
101-
102-
103-func getGameTotalFieldOrOddsBets () = getInteger(this, gameTotalFieldBetsLabel)
104-
105-
106-func getGameProcessedFieldOrOddsBets () = getInteger(this, gameTotalProccedFieldOrOddsBetsLabel)
107-
108-
109-func getGameState (gameCounter) = getInteger(this, gameStateLabel(gameCounter))
110-
111-
112-func getGameSumSha (gameCounter) = getString(this, gameSumShaLabel(gameCounter))
113-
114-
115-func getRandomHash (gameCounter) = getString(this, gameRandomHashLabel(gameCounter))
116-
117-
118-func gameRollsCountBetLabel (gameCounter) = (("G_" + toString(gameCounter)) + "_ROLLSCOUNT")
119-
120-
121-func gameRollDiceWithGameNumberLabel (gameCounter,rollDice) = (((("G_" + toString(gameCounter)) + "_") + toString(rollDice)) + "_GAMENUMBER_ROLLDICE")
122-
123-
124-func gameFieldOrOddsBetForNextThrowLabel (betNumber) = (("B_" + toString(betNumber)) + "_FIELD_ODDS_BET_ROLLDICE")
125-
126-
127-func getGameRollsCount (gameCounter) = getInteger(this, gameRollsCountBetLabel(gameCounter))
128-
129-
130-func getGameRollDiceWithGameNumber (gameCounter,rollDice) = getInteger(this, gameRollDiceWithGameNumberLabel(gameCounter, rollDice))
131-
132-
133-func getFieldOddsBetForNextDice (betNumber) = getInteger(this, gameFieldOrOddsBetForNextThrowLabel(betNumber))
134-
135-
136-func gameBetCounterLabel (gameNumber) = (("B_" + toString(gameNumber)) + "_BET_GAMENUMBER")
137-
138-
139-func gameFieldOrOddsBetGameCounterLabel (gameNumber) = (("B_" + toString(gameNumber)) + "_FIELD_ODDS_BET_GAMENUMBER")
140-
141-
142-func getGameBetCounter (gameNumber) = getInteger(this, gameBetCounterLabel(gameNumber))
143-
144-
145-func getGameFieldOrOddsBetCounter (gameNumber) = getInteger(this, gameFieldOrOddsBetGameCounterLabel(gameNumber))
146-
147-
148-func getGameCounter () = getInteger(this, gameCounterLabel)
149-
150-
151-func getFirstPointDice (gameCounter) = getInteger(this, gameFirstPointDiceLabel(gameCounter))
152-
153-
154-func getCurrentPointDice (gameCounter) = match getInteger(this, gameCurrentPointDiceLabel(gameCounter)) {
155- case val: Int =>
156- val
157- case _ =>
158- 0
159-}
160-
161-
162-func validateBetName (betName) = if ((betName == PASSLINEBET))
163- then true
164- else if ((betName == DONTPASSLINEBET))
165- then true
166- else false
167-
168-
169-func validateRoundBet (betName) = if ((betName == FIELDBET))
170- then true
171- else if ((betName == ODDSBET))
172- then true
173- else if ((betName == BIG6OR8BET))
174- then true
175- else if ((betName == PLACEBETBUY))
34+@Callable(i)
35+func getWinningAmount (betDetails,resultOfRound,round) = {
36+ let betType = split(betDetails, "_")[2]
37+ let odd = value(parseInt(split(betDetails, "_")[5]))
38+ let amount = value(parseInt(split(betDetails, "_")[1]))
39+ if ((betType == FIELDBET))
40+ then if ((resultOfRound == 12))
41+ then [IntegerEntry("price", (amount * 4))]
42+ else if ((resultOfRound == 2))
43+ then [IntegerEntry("price", (amount * 3))]
44+ else if (if (if (if ((resultOfRound == 5))
45+ then true
46+ else (resultOfRound == 6))
47+ then true
48+ else (resultOfRound == 7))
49+ then true
50+ else (resultOfRound == 8))
51+ then [IntegerEntry("price", 0)]
52+ else [IntegerEntry("price", (amount * 2))]
53+ else if ((betType == ODDSBET))
54+ then if (if ((odd == 4))
17655 then true
177- else if ((betName == PLACEBETLAY))
56+ else (odd == 10))
57+ then [IntegerEntry("price", (amount * 7))]
58+ else if (if ((odd == 5))
17859 then true
179- else if ((betName == COMEBET))
60+ else (odd == 8))
61+ then [IntegerEntry("price", (amount * 9))]
62+ else if (if ((odd == 3))
18063 then true
181- else if ((betName == DONTCOMEBET))
64+ else (odd == 11))
65+ then [IntegerEntry("price", (amount * 15))]
66+ else if (if ((odd == 2))
18267 then true
183- else if ((betName == PLACEBETLOSE))
68+ else (odd == 12))
69+ then [IntegerEntry("price", (amount * 30))]
70+ else if (if ((odd == 10))
18471 then true
185- else if ((betName == PLACEBETWIN))
186- then true
187- else false
188-
189-
190-func getWinningAmountForOdds (amount,odd,resultOfRound) = if (if ((odd == 4))
191- then true
192- else (odd == 10))
193- then {
194- let winningAmount = (amount * 7)
195- winningAmount
196- }
197- else if (if ((odd == 5))
198- then true
199- else (odd == 8))
200- then {
201- let winningAmount = (amount * 9)
202- winningAmount
203- }
204- else if (if ((odd == 3))
205- then true
206- else (odd == 11))
207- then {
208- let winningAmount = (amount * 15)
209- winningAmount
210- }
211- else if (if ((odd == 2))
212- then true
213- else (odd == 12))
214- then {
215- let winningAmount = (amount * 30)
216- winningAmount
217- }
218- else if (if ((odd == 10))
72+ else (odd == 4))
73+ then [IntegerEntry("price", (amount * 30))]
74+ else if ((odd == 7))
75+ then [IntegerEntry("price", (amount * 4))]
76+ else if (if ((odd == 100))
77+ then if (if ((resultOfRound == 3))
78+ then true
79+ else (resultOfRound == 12))
80+ then true
81+ else (resultOfRound == 2)
82+ else false)
83+ then [IntegerEntry("price", (amount * 7))]
84+ else [IntegerEntry("price", 0)]
85+ else if ((betType == BIG6OR8BET))
86+ then if (if ((resultOfRound == 6))
21987 then true
220- else (odd == 4))
221- then {
222- let winningAmount = (amount * 30)
223- winningAmount
224- }
225- else if ((odd == 7))
226- then {
227- let winningAmount = (amount * 4)
228- winningAmount
229- }
230- else if (if ((odd == 100))
231- then if (if ((resultOfRound == 3))
232- then true
233- else (resultOfRound == 12))
234- then true
235- else (resultOfRound == 2)
236- else false)
88+ else (resultOfRound == 8))
89+ then [IntegerEntry("price", (amount * 2))]
90+ else [IntegerEntry("price", 0)]
91+ else if (if ((betType == PLACEBETLAY))
92+ then true
93+ else (betType == PLACEBETLOSE))
94+ then if ((resultOfRound == 7))
95+ then [IntegerEntry("price", (amount * 2))]
96+ else if ((resultOfRound == odd))
97+ then [IntegerEntry("price", 0)]
98+ else [IntegerEntry("price", -1)]
99+ else if (if ((betType == PLACEBETBUY))
100+ then true
101+ else (betType == PLACEBETWIN))
102+ then if ((resultOfRound == 7))
103+ then [IntegerEntry("price", 0)]
104+ else if ((resultOfRound == odd))
105+ then [IntegerEntry("price", 2)]
106+ else [IntegerEntry("price", -1)]
107+ else if ((betType == COMEBET))
237108 then {
238- let winningAmount = (amount * 7)
239- winningAmount
109+ let playerPoint = value(parseInt(split(betDetails, "_")[6]))
110+ if ((round == 2))
111+ then if (if ((resultOfRound == 7))
112+ then true
113+ else (resultOfRound == 11))
114+ then [IntegerEntry("price", (amount * 2))]
115+ else if (if (if ((resultOfRound == 2))
116+ then true
117+ else (resultOfRound == 12))
118+ then true
119+ else (resultOfRound == 3))
120+ then [IntegerEntry("price", 0)]
121+ else if ((resultOfRound == playerPoint))
122+ then [IntegerEntry("price", (amount * 2))]
123+ else [IntegerEntry("price", -1)]
124+ else if ((round > 2))
125+ then if ((resultOfRound == 7))
126+ then [IntegerEntry("price", 0)]
127+ else if ((resultOfRound == playerPoint))
128+ then [IntegerEntry("price", (amount * 2))]
129+ else [IntegerEntry("price", -1)]
130+ else throw("Not Allow in The Beginning")
240131 }
241- else 0
242-
243-
244-func getWinningAmountForField (amount,resultOfRound) = if ((resultOfRound == 12))
245- then {
246- let winningAmount = (amount * 4)
247- winningAmount
248- }
249- else if ((resultOfRound == 2))
250- then {
251- let winningAmount = (amount * 3)
252- winningAmount
253- }
254- else if (if (if (if ((resultOfRound == 5))
255- then true
256- else (resultOfRound == 6))
257- then true
258- else (resultOfRound == 7))
259- then true
260- else (resultOfRound == 8))
261- then 0
262- else {
263- let winningAmount = (amount * 2)
264- winningAmount
265- }
266-
267-
268-func storeOneRoundBetTypes (gameCounter,amount,typeBet,caller,odd) = match getGameTotalFieldOrOddsBets() {
269- case betCount: Int =>
270- match getGameRollsCount(gameCounter) {
271- case rollCount: Int =>
272- let newTotalBetCount = (betCount + 1)
273- let newRollCountForGame = (rollCount + 1)
274- if (if ((typeBet == COMEBET))
275- then true
276- else (typeBet == DONTCOMEBET))
277- then [IntegerEntry(gameFieldOrOddsBetGameCounterLabel(newTotalBetCount), gameCounter), StringEntry(gameFieldOrOddsBetLineLabel(newTotalBetCount), ((((((((caller + "_") + amount) + "_") + typeBet) + "_active_pending_") + toString(gameCounter)) + "_") + toString(newRollCountForGame))), IntegerEntry(gameTotalFieldBetsLabel, newTotalBetCount), IntegerEntry(gameFieldOrOddsBetForNextThrowLabel(newTotalBetCount), newRollCountForGame)]
278- else [IntegerEntry(gameFieldOrOddsBetGameCounterLabel(newTotalBetCount), gameCounter), StringEntry(gameFieldOrOddsBetLineLabel(newTotalBetCount), ((((((caller + "_") + amount) + "_") + typeBet) + "_active_pending_") + toString(odd))), IntegerEntry(gameTotalFieldBetsLabel, newTotalBetCount), IntegerEntry(gameFieldOrOddsBetForNextThrowLabel(newTotalBetCount), newRollCountForGame)]
279- case _ =>
280- throw("Game doesn't exist")
281- }
282- case _ =>
283- throw("Game has not bee initialized")
284-}
285-
286-
287-func rollPlaceBetIntoAnotherRoundBet (totalBets,lastFieldProcessBet,betOnRoll,gameCounter,amount,typeBet,caller,odd) = [IntegerEntry(gameFieldOrOddsBetGameCounterLabel(totalBets), gameCounter), StringEntry(gameFieldOrOddsBetLineLabel(totalBets), ((((((caller + "_") + amount) + "_") + typeBet) + "_active_pending_") + toString(odd))), StringEntry(gameFieldOrOddsBetLineLabel(lastFieldProcessBet), ((((((caller + "_") + amount) + "_") + typeBet) + "_inactive_rolled_") + toString(odd))), IntegerEntry(gameTotalProccedFieldOrOddsBetsLabel, lastFieldProcessBet), IntegerEntry(gameTotalFieldBetsLabel, totalBets), IntegerEntry(gameFieldOrOddsBetForNextThrowLabel(totalBets), betOnRoll)]
288-
289-
290-func storeNextRoll (gameState,amount,totalFieldBets,lastFieldProcessBet,betOnRoll,gameNumber,betType,betPlacer,odd) = if ((gameState == GAMEFINISHED))
291- then rollPlaceBetIntoAnotherRoundBet((totalFieldBets + 1), (lastFieldProcessBet + 1), 1, (gameNumber + 1), toString(amount), betType, betPlacer, odd)
292- else rollPlaceBetIntoAnotherRoundBet((totalFieldBets + 1), (lastFieldProcessBet + 1), (betOnRoll + 1), gameNumber, toString(amount), betType, betPlacer, odd)
293-
294-
295-func storeComeDontComeBet (gameState,betDetails,resultOfRound,amount,totalFieldBets,lastFieldProcessBet,betOnRoll,gameNumber,betType,betPlacer,odd) = {
296- let comeBetGameNumber = value(parseInt(split(betDetails, "_")[5]))
297- let comeBetRollNumber = value(parseInt(split(betDetails, "_")[6]))
298- let resultOfGame = value(getGameRollDiceWithGameNumber(comeBetGameNumber, comeBetRollNumber))
299- if ((resultOfRound == 7))
300- then if ((betDetails == COMEBET))
301- then throw("Only Field Type of Bet can be proceed")
302- else throw("Only Field Type of Bet can be proceed")
303- else if ((resultOfRound == resultOfGame))
304- then throw("Only Field Type of Bet can be proceed")
305- else if ((gameState == GAMEFINISHED))
306- then storeNextRoll(gameState, amount, (totalFieldBets + 1), (lastFieldProcessBet + 1), 1, (gameNumber + 1), betType, betPlacer, odd)
307- else storeNextRoll(gameState, amount, (totalFieldBets + 1), (lastFieldProcessBet + 1), (betOnRoll + 1), gameNumber, betType, betPlacer, odd)
308- }
309-
310-
311-func storePassOrComeBet (gameCounter,amount,typeBet,caller) = match getGameTotalBets() {
312- case number: Int =>
313- let newTotalBets = (number + 1)
314-[IntegerEntry(gameBetCounterLabel(newTotalBets), gameCounter), StringEntry(gameBetLineLabel(newTotalBets), (((((caller + "_") + amount) + "_") + typeBet) + "_active_pending")), IntegerEntry(gameTotalBetsLabel, newTotalBets)]
315- case _ =>
316- throw("Game has not bee initialized")
317-}
318-
319-
320-func udpateBetDetailsWithLost (updateBetDetials,gameNumber,lastProceedBet,betIndex,betProceedIndex) = {
321- let updateInfoBet = (updateBetDetials + "_lost")
322-[StringEntry(betIndex, updateInfoBet), IntegerEntry(betProceedIndex, lastProceedBet)]
323- }
324-
325-
326-func udpateBetDetailsWithLostWithOdd (updateBetDetials,gameNumber,lastProceedBet,betIndex,betProceedIndex,oddNumber) = {
327- let updateInfoBet = ((updateBetDetials + "_lost_") + toString(oddNumber))
328-[StringEntry(betIndex, updateInfoBet), IntegerEntry(betProceedIndex, lastProceedBet)]
329- }
330-
331-
332-func updateBetDetailsWithWinning (updateBetDetials,gameNumber,currentProceedBet,betPlacer,winningAmount,betType,betIndex,betProceedIndex) = {
333- let updateInfoBet = (updateBetDetials + "_won_")
334-[StringEntry(gameWinningNumberBetLabel(gameNumber, currentProceedBet, betType), ((betPlacer + "_amount_") + toString(winningAmount))), StringEntry(betIndex, updateBetDetials), IntegerEntry(betProceedIndex, currentProceedBet), ScriptTransfer(value(addressFromString(betPlacer)), winningAmount, unit)]
335- }
336-
337-
338-func storeGameProgressPointState (storeIndex,gameNumber,number,rollCount,currentHeight,randomHash,state) = [IntegerEntry(gameStateLabel(gameNumber), state), IntegerEntry(storeIndex, number), IntegerEntry(gameRollsCountBetLabel(gameNumber), rollCount), IntegerEntry(gameEndHeightLabel(gameNumber), (currentHeight + BLOCKTOPROCESSFORTHROW)), StringEntry(gameRandomHashLabel(gameNumber), toBase64String(randomHash)), IntegerEntry(gameRollDiceWithGameNumberLabel(gameNumber, rollCount), number)]
339-
340-
341-@Callable(i)
342-func processNextBet () = if (authorizePermission(i.callerPublicKey))
343- then throw("processFieldBet_FORBIDDEN")
344- else match getGameTotalBets() {
345- case totalBets: Int =>
346- match getGameProcessedBets() {
347- case lastProcessBet: Int =>
348- let nextBet = (lastProcessBet + 1)
349- if ((nextBet > totalBets))
350- then throw("Next bet has not been places.")
351- else match getGameBetCounter(nextBet) {
352- case gameNumber: Int =>
353- match getGameState(gameNumber) {
354- case gameState: Int =>
355- if (if ((gameState == GAMESTART))
132+ else if ((betType == DONTCOMEBET))
133+ then {
134+ let playerPoint = value(parseInt(split(betDetails, "_")[6]))
135+ if ((round == 2))
136+ then if (if ((resultOfRound == 7))
356137 then true
357- else (gameState == GAMEINPROGRESS))
358- then throw("Game has to finished in order to process NON-FIELD bets")
359- else {
360- let betDetails = value(getBetDetailsResult(nextBet))
361- let betType = split(betDetails, "_")[2]
362- let betPlacer = split(betDetails, "_")[0]
363- let amount = value(parseInt(split(betDetails, "_")[1]))
364- let address = value(addressFromString(betPlacer))
365- let currentPoint = getCurrentPointDice(nextBet)
366- let firstPoint = getFirstPointDice(nextBet)
367- let updateBetDetials = (((((betPlacer + "_") + split(betDetails, "_")[1]) + "_") + split(betDetails, "_")[2]) + "_inactive_")
368- if ((betType == PASSLINEBET))
369- then if ((currentPoint == 0))
370- then if (if ((firstPoint == 7))
371- then true
372- else (firstPoint == 11))
373- then {
374- let winningAmount = (amount * 2)
375- updateBetDetailsWithWinning(updateBetDetials, gameNumber, nextBet, betPlacer, winningAmount, betType, gameBetLineLabel(nextBet), gameTotalProccedBetsLabel)
376- }
377- else udpateBetDetailsWithLost(updateBetDetials, gameNumber, nextBet, gameBetLineLabel(nextBet), gameTotalProccedBetsLabel)
378- else if ((firstPoint == currentPoint))
379- then {
380- let winningAmount = (amount * 2)
381- updateBetDetailsWithWinning(updateBetDetials, gameNumber, nextBet, betPlacer, winningAmount, betType, gameBetLineLabel(nextBet), gameTotalProccedBetsLabel)
382- }
383- else if ((currentPoint == 7))
384- then udpateBetDetailsWithLost(updateBetDetials, gameNumber, nextBet, gameBetLineLabel(nextBet), gameTotalProccedBetsLabel)
385- else udpateBetDetailsWithLost(updateBetDetials, gameNumber, nextBet, gameBetLineLabel(nextBet), gameTotalProccedBetsLabel)
386- else if ((betType == DONTPASSLINEBET))
387- then if ((currentPoint == 0))
388- then if (if ((firstPoint == 2))
389- then true
390- else (firstPoint == 3))
391- then {
392- let winningAmount = (amount * 2)
393- updateBetDetailsWithWinning(updateBetDetials, gameNumber, nextBet, betPlacer, winningAmount, betType, gameBetLineLabel(nextBet), gameTotalProccedBetsLabel)
394- }
395- else if (if ((currentPoint == 7))
396- then true
397- else (currentPoint == 11))
398- then udpateBetDetailsWithLost(updateBetDetials, gameNumber, nextBet, gameBetLineLabel(nextBet), gameTotalProccedBetsLabel)
399- else udpateBetDetailsWithLost(updateBetDetials, gameNumber, nextBet, gameBetLineLabel(nextBet), gameTotalProccedBetsLabel)
400- else if (if ((currentPoint == 2))
401- then true
402- else (currentPoint == 3))
403- then {
404- let winningAmount = (amount * 2)
405- updateBetDetailsWithWinning(updateBetDetials, gameNumber, nextBet, betPlacer, winningAmount, betType, gameBetLineLabel(nextBet), gameTotalProccedBetsLabel)
406- }
407- else if ((currentPoint == 7))
408- then udpateBetDetailsWithLost(updateBetDetials, gameNumber, nextBet, gameBetLineLabel(nextBet), gameTotalProccedBetsLabel)
409- else udpateBetDetailsWithLost(updateBetDetials, gameNumber, nextBet, gameBetLineLabel(nextBet), gameTotalProccedBetsLabel)
410- else throw((((((("Only " + PASSLINEBET) + ", ") + DONTPASSLINEBET) + " allowed in processNextBet()") + " currentBetType ") + betType))
411- }
412- case _ =>
413- throw("Game does not exist or has already ended.")
414- }
415- case _ =>
416- throw("Error")
417- }
418- case _ =>
419- throw("Game has not been initialized, next bets not found")
420- }
421- case _ =>
422- throw("Game has not been initialized, next bets not found")
138+ else (resultOfRound == 11))
139+ then [IntegerEntry("price", 0)]
140+ else if (if (if ((resultOfRound == 2))
141+ then true
142+ else (resultOfRound == 12))
143+ then true
144+ else (resultOfRound == 3))
145+ then [IntegerEntry("price", (amount * 2))]
146+ else if ((resultOfRound == playerPoint))
147+ then [IntegerEntry("price", (amount * 2))]
148+ else [IntegerEntry("price", -1)]
149+ else if ((round > 1))
150+ then if ((resultOfRound == 7))
151+ then [IntegerEntry("price", (amount * 2))]
152+ else if ((resultOfRound == playerPoint))
153+ then [IntegerEntry("price", 0)]
154+ else [IntegerEntry("price", -1)]
155+ else throw("Not Allow in The Beginning")
156+ }
157+ else [IntegerEntry("price", 0)]
423158 }
424159
425160
426161
427162 @Callable(i)
428-func processOneRoundBet () = if (authorizePermission(i.callerPublicKey))
429- then throw("processFieldBet_FORBIDDEN")
430- else match getGameTotalFieldOrOddsBets() {
431- case totalFieldBets: Int =>
432- match getGameProcessedFieldOrOddsBets() {
433- case lastFieldProcessBet: Int =>
434- let nextBet = (lastFieldProcessBet + 1)
435- if ((nextBet > totalFieldBets))
436- then throw("Next Field Bet has not been places.")
437- else match getGameFieldOrOddsBetCounter(nextBet) {
438- case gameNumber: Int =>
439- match getGameState(gameNumber) {
440- case gameState: Int =>
441- if ((gameState == GAMESTART))
442- then throw("Game has not started yet")
443- else {
444- let betDetails = value(getFieldBetDetailsResult(nextBet))
445- let betType = split(betDetails, "_")[2]
446- let betPlacer = split(betDetails, "_")[0]
447- let amount = value(parseInt(split(betDetails, "_")[1]))
448- let odd = value(parseInt(split(betDetails, "_")[5]))
449- let address = value(addressFromString(betPlacer))
450- let betOnRoll = value(getFieldOddsBetForNextDice(nextBet))
451- match getGameRollDiceWithGameNumber(gameNumber, betOnRoll) {
452- case resultOfRound: Int =>
453- let updateBetDetials = (((((betPlacer + "_") + split(betDetails, "_")[1]) + "_") + split(betDetails, "_")[2]) + "_inactive_")
454- if ((betType == FIELDBET))
455- then {
456- let winningAmount = getWinningAmountForField(amount, resultOfRound)
457- if ((winningAmount == 0))
458- then udpateBetDetailsWithLost(updateBetDetials, gameNumber, nextBet, gameFieldOrOddsBetLineLabel(gameNumber), gameTotalProccedFieldOrOddsBetsLabel)
459- else updateBetDetailsWithWinning(updateBetDetials, gameNumber, nextBet, betPlacer, winningAmount, betType, gameFieldOrOddsBetLineLabel(nextBet), gameTotalProccedFieldOrOddsBetsLabel)
460- }
461- else if ((betType == ODDSBET))
462- then {
463- let winningAmount = getWinningAmountForOdds(amount, odd, resultOfRound)
464- if ((winningAmount == 0))
465- then updateBetDetailsWithWinning((updateBetDetials + "_won_"), gameNumber, nextBet, betPlacer, winningAmount, betType, gameFieldOrOddsBetLineLabel(nextBet), gameTotalProccedFieldOrOddsBetsLabel)
466- else udpateBetDetailsWithLostWithOdd(updateBetDetials, gameNumber, nextBet, gameFieldOrOddsBetLineLabel(nextBet), gameTotalProccedFieldOrOddsBetsLabel, odd)
467- }
468- else if ((betType == BIG6OR8BET))
469- then if (if ((resultOfRound == 6))
470- then true
471- else (resultOfRound == 8))
472- then {
473- let winningAmount = (2 * amount)
474- updateBetDetailsWithWinning((updateBetDetials + "_won_"), gameNumber, nextBet, betPlacer, winningAmount, betType, gameFieldOrOddsBetLineLabel(nextBet), gameTotalProccedFieldOrOddsBetsLabel)
475- }
476- else udpateBetDetailsWithLostWithOdd(updateBetDetials, gameNumber, nextBet, gameFieldOrOddsBetLineLabel(nextBet), gameTotalProccedFieldOrOddsBetsLabel, odd)
477- else if (if ((betType == PLACEBETBUY))
478- then true
479- else (betType == PLACEBETWIN))
480- then if ((resultOfRound == 7))
481- then udpateBetDetailsWithLostWithOdd(updateBetDetials, gameNumber, nextBet, gameFieldOrOddsBetLineLabel(nextBet), gameTotalProccedFieldOrOddsBetsLabel, odd)
482- else if ((resultOfRound == odd))
483- then {
484- let winningAmount = (amount * 2)
485- updateBetDetailsWithWinning((updateBetDetials + "_won_"), gameNumber, nextBet, betPlacer, winningAmount, betType, gameFieldOrOddsBetLineLabel(nextBet), gameTotalProccedFieldOrOddsBetsLabel)
486- }
487- else storeNextRoll(gameState, amount, (totalFieldBets + 1), (lastFieldProcessBet + 1), 1, (gameNumber + 1), betType, betPlacer, odd)
488- else if (if ((betType == PLACEBETLAY))
489- then true
490- else (betType == PLACEBETLOSE))
491- then if ((resultOfRound == 7))
492- then {
493- let winningAmount = (amount * 2)
494- updateBetDetailsWithWinning(updateBetDetials, gameNumber, nextBet, betPlacer, winningAmount, betType, gameFieldOrOddsBetLineLabel(nextBet), gameTotalProccedFieldOrOddsBetsLabel)
495- }
496- else if ((resultOfRound == odd))
497- then udpateBetDetailsWithLostWithOdd(updateBetDetials, gameNumber, nextBet, gameFieldOrOddsBetLineLabel(nextBet), gameTotalProccedFieldOrOddsBetsLabel, odd)
498- else storeNextRoll(gameState, amount, (totalFieldBets + 1), (lastFieldProcessBet + 1), 1, (gameNumber + 1), betType, betPlacer, odd)
499- else if (if ((betType == COMEBET))
500- then true
501- else (betType == DONTCOMEBET))
502- then storeComeDontComeBet(gameState, betDetails, resultOfRound, amount, totalFieldBets, lastFieldProcessBet, betOnRoll, gameNumber, betType, betPlacer, odd)
503- else throw("Only Field Type of Bet can be proceed")
504- case _ =>
505- throw("There is no result for this round yet")
506- }
507- }
508- case _ =>
509- throw("Game does not exist or has already ended")
510- }
511- case _ =>
512- throw("Error")
513- }
514- case _ =>
515- throw("Game has not been initialized, next bets not found")
516- }
517- case _ =>
518- throw("Game has not been initialized, next bets not found")
519- }
520-
521-
522-
523-@Callable(i)
524-func initGame () = if (authorizePermission(i.callerPublicKey))
525- then throw("initGame_FORBIDDEN")
526- else match getGameCounter() {
527- case counter: Int =>
528- throw("INIT_ALREADY_DONE")
529- case _ =>
530-[IntegerEntry(gameCounterLabel, 0), IntegerEntry(gameTotalBetsLabel, 0), IntegerEntry(gameTotalProccedBetsLabel, 0), IntegerEntry(gameTotalFieldBetsLabel, 0), IntegerEntry(gameTotalProccedFieldOrOddsBetsLabel, 0)]
531- }
532-
533-
534-
535-@Callable(i)
536-func startGame (randomHash) = if (authorizePermission(i.callerPublicKey))
537- then throw("startGame_FORBIDDEN")
538- else match getGameCounter() {
539- case number: Int =>
540- if ((number == 0))
541- then {
542- let newNumber = (number + 1)
543-[IntegerEntry(gameCounterLabel, newNumber), IntegerEntry(gameStateLabel(newNumber), GAMESTART), IntegerEntry(gameStartHeightLabel(newNumber), lastBlock.height), IntegerEntry(gameEndHeightLabel(newNumber), (lastBlock.height + BLOCKTOPROCESSFORTHROW)), IntegerEntry(gameRollsCountBetLabel(newNumber), 0), StringEntry(gameSumShaLabel(newNumber), toBase58String(sha256(fromBase64String(randomHash))))]
544- }
545- else match getGameState(number) {
546- case state: Int =>
547- if (if ((state == GAMEINPROGRESS))
548- then true
549- else (state == GAMESTART))
550- then throw("The previous game is still in progress")
551- else {
552- let newNumber = (number + 1)
553-[IntegerEntry(gameCounterLabel, newNumber), IntegerEntry(gameStateLabel(newNumber), GAMESTART), IntegerEntry(gameStartHeightLabel(newNumber), lastBlock.height), IntegerEntry(gameEndHeightLabel(newNumber), (lastBlock.height + BLOCKTOPROCESSFORTHROW)), IntegerEntry(gameRollsCountBetLabel(newNumber), 0), StringEntry(gameSumShaLabel(newNumber), toBase58String(sha256(fromBase64String(randomHash))))]
554- }
555- case _ =>
556- throw("Error")
557- }
558- case _ =>
559- throw("INIT_NEED")
560- }
561-
562-
563-
564-@Callable(i)
565-func placeBet (typeBet) = if (validateBetName(typeBet))
566- then if ((size(i.payments) == 0))
567- then throw("Payment not attached")
568- else match getGameCounter() {
569- case GAMENUMBER: Int =>
570- let p = i.payments[0]
571- match getGameState(GAMENUMBER) {
572- case state: Int =>
573- if ((state == GAMESTART))
574- then if (if ((typeBet == PASSLINEBET))
575- then true
576- else (typeBet == DONTPASSLINEBET))
577- then storePassOrComeBet(GAMENUMBER, toString(p.amount), typeBet, toBase58String(i.caller.bytes))
578- else throw((((((("Only " + PASSLINEBET) + ", ") + DONTPASSLINEBET) + " and ") + FIELDBET) + " are allowed in the Beginning of Game"))
579- else if ((state == GAMEINPROGRESS))
580- then throw((((((("Only " + COMEBET) + ", ") + DONTCOMEBET) + " and ") + FIELDBET) + " ARE ALLOWED at Start."))
581- else if ((state == GAMEFINISHED))
582- then throw("Game already ended.")
583- else throw("Unknown Game State.")
584- case _ =>
585- throw("Game does not exist or has already ended.")
586- }
587- case _ =>
588- throw("Game has not been initialized.")
589- }
590- else throw(((((((((("Unsupported Type of Bet for Crap. Please Select one of " + PASSLINEBET) + ", ") + DONTPASSLINEBET) + ", ") + COMEBET) + ", ") + DONTCOMEBET) + ", ") + FIELDBET))
591-
592-
593-
594-@Callable(i)
595-func placeRoundBet (typeBet,oddNumber) = if (validateRoundBet(typeBet))
596- then if ((size(i.payments) == 0))
597- then throw("Payment not attached")
598- else match getGameCounter() {
599- case GAMENUMBER: Int =>
600- let p = i.payments[0]
601- match getGameState(GAMENUMBER) {
602- case state: Int =>
603- if ((state == GAMEFINISHED))
604- then throw("Game already ended.")
605- else if (if ((typeBet == COMEBET))
606- then true
607- else (typeBet == DONTCOMEBET))
608- then if ((state == GAMESTART))
609- then throw("Cannot place COME OR DONTCOME BET IF GAME HAS NOT STARTED")
610- else storeOneRoundBetTypes(GAMENUMBER, toString(p.amount), typeBet, toBase58String(i.caller.bytes), 0)
611- else storeOneRoundBetTypes(GAMENUMBER, toString(p.amount), typeBet, toBase58String(i.caller.bytes), oddNumber)
612- case _ =>
613- throw("Game does not exist or has already ended.")
614- }
615- case _ =>
616- throw("Game has not been initialized.")
617- }
618- else throw(((((((((("Unsupported Type of Bet for Crap. Please Select one of " + ODDSBET) + ", ") + DONTPASSLINEBET) + ", ") + COMEBET) + ", ") + DONTCOMEBET) + ", ") + FIELDBET))
619-
620-
621-
622-@Callable(i)
623-func throwDices (rsaSign,gameNumber) = if (authorizePermission(i.callerPublicKey))
624- then throw("throwDices_FORBIDDEN")
625- else match getGameState(gameNumber) {
626- case state: Int =>
627- if ((state == GAMEFINISHED))
628- then throw("Game is finished")
629- else {
630- let currentHeight = lastBlock.height
631- let lastHeightAllowed = value(getEndHeight(gameNumber))
632- if ((currentHeight >= lastHeightAllowed))
633- then match getGameSumSha(gameNumber) {
634- case sumSha: String =>
635- let sig = fromBase64String(rsaSign)
636- let rsaSigValid = rsaVerify(SHA256, fromBase58String(sumSha), sig, RSAPUBLIC)
637- match blockInfoByHeight((lastBlock.height - 1)) {
638- case previousBlock: BlockInfo =>
639- let randomHash = sha256((take(sig, 4) + take(previousBlock.generationSignature, 8)))
640- if (!(rsaSigValid))
641- then throw("INVALID_RSA_SIGN")
642- else {
643- let randNumber = (toInt(randomHash) % 11)
644- let number = diceNumber[randNumber]
645- match getGameRollsCount(gameNumber) {
646- case rollCountNumber: Int =>
647- let newRollCountNumber = (rollCountNumber + 1)
648- if ((state == GAMESTART))
649- then if (if (if (if (if ((number == 7))
650- then true
651- else (number == 11))
652- then true
653- else (number == 2))
654- then true
655- else (number == 3))
656- then true
657- else (number == 12))
658- then storeGameProgressPointState(gameFirstPointDiceLabel(gameNumber), gameNumber, number, newRollCountNumber, currentHeight, randomHash, GAMEFINISHED)
659- else storeGameProgressPointState(gameFirstPointDiceLabel(gameNumber), gameNumber, number, newRollCountNumber, currentHeight, randomHash, GAMEINPROGRESS)
660- else {
661- let currentPoint = value(getCurrentPointDice(gameNumber))
662- let firstPoint = value(getFirstPointDice(gameNumber))
663- if ((currentPoint == 0))
664- then if (if ((number == 7))
665- then true
666- else (firstPoint == number))
667- then storeGameProgressPointState(gameCurrentPointDiceLabel(gameNumber), gameNumber, number, newRollCountNumber, currentHeight, randomHash, GAMEFINISHED)
668- else storeGameProgressPointState(gameCurrentPointDiceLabel(gameNumber), gameNumber, number, newRollCountNumber, currentHeight, randomHash, GAMEINPROGRESS)
669- else if (if ((number == 7))
670- then true
671- else (firstPoint == number))
672- then storeGameProgressPointState(gameCurrentPointDiceLabel(gameNumber), gameNumber, number, newRollCountNumber, currentHeight, randomHash, GAMEFINISHED)
673- else storeGameProgressPointState(gameCurrentPointDiceLabel(gameNumber), gameNumber, number, newRollCountNumber, currentHeight, randomHash, GAMEINPROGRESS)
674- }
675- case _ =>
676- throw("No dices have been thrown")
677- }
678- }
679- case _ =>
680- throw("Last block doesn't exist.")
681- }
682- case _ =>
683- throw("SHA doesn't exist")
684- }
685- else throw("Throw dice not allow still waiting for block to process")
686- }
687- case _ =>
688- throw("Game does not exist or has already ended.")
163+func getWinningAmountPassLineBets (firstPoint,lastPoint,betDetails) = {
164+ let betType = split(betDetails, "_")[2]
165+ let betPlacer = split(betDetails, "_")[0]
166+ let amount = value(parseInt(split(betDetails, "_")[1]))
167+ if ((betType == PASSLINEBET))
168+ then if ((lastPoint == 0))
169+ then if (if ((firstPoint == 7))
170+ then true
171+ else (firstPoint == 11))
172+ then [IntegerEntry("price", (amount * 2))]
173+ else [IntegerEntry("price", (amount * 0))]
174+ else if ((firstPoint == lastPoint))
175+ then [IntegerEntry("price", (amount * 2))]
176+ else if ((lastPoint == 7))
177+ then [IntegerEntry("price", (amount * 0))]
178+ else [IntegerEntry("price", (amount * 0))]
179+ else if ((betType == DONTPASSLINEBET))
180+ then if ((lastPoint == 0))
181+ then if (if ((firstPoint == 2))
182+ then true
183+ else (firstPoint == 3))
184+ then [IntegerEntry("price", (amount * 2))]
185+ else if (if ((lastPoint == 7))
186+ then true
187+ else (lastPoint == 11))
188+ then [IntegerEntry("price", (amount * 0))]
189+ else [IntegerEntry("price", (amount * 0))]
190+ else if (if ((lastPoint == 2))
191+ then true
192+ else (lastPoint == 3))
193+ then [IntegerEntry("price", (amount * 2))]
194+ else if ((lastPoint == 7))
195+ then [IntegerEntry("price", (amount * 0))]
196+ else [IntegerEntry("price", (amount * 0))]
197+ else [IntegerEntry("price", (amount * 0))]
689198 }
690199
691200
692201 @Verifier(tx)
693202 func verify () = match tx {
694203 case _ =>
695204 sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey)
696205 }
697206

github/deemru/w8io/169f3d6 
61.16 ms