tx · F2kS4LccRVAChi2rK44KWyBkn5tK6ML2TWm8Xej7yimR

3NCFV4YSBFCEBXDYHwCuh6X5SqMeQXFgEaf:  -0.01500000 Waves

2021.06.03 17:17 [1554296] smart account 3NCFV4YSBFCEBXDYHwCuh6X5SqMeQXFgEaf > SELF 0.00000000 Waves

{ "type": 13, "id": "F2kS4LccRVAChi2rK44KWyBkn5tK6ML2TWm8Xej7yimR", "fee": 1500000, "feeAssetId": null, "timestamp": 1622729863783, "version": 2, "chainId": 84, "sender": "3NCFV4YSBFCEBXDYHwCuh6X5SqMeQXFgEaf", "senderPublicKey": "6zkdpCUGZybpbh7mrJvMphWq6fUvbGoyxafdsQjtwsWA", "proofs": [ "3YFBiS5EqBTZ8dfTbGAJczNBVZwurkgcsPSUJm8Vcbh8wnUahV58kqs7YwaDgszFsNmrMkkRQptGwfgBdXQjdxvh" ], "script": "base64:AAIEAAAAAAAAABAIAhIFCgMIAQESBQoDAQEIAAAADwAAAAAJR0FNRVNUQVJUAAAAAAAAAAAAAAAAAA5HQU1FSU5QUk9HUkVTUwAAAAAAAAAAAQAAAAAMR0FNRUZJTklTSEVEAAAAAAAAAAACAAAAABZCTE9DS1RPUFJPQ0VTU0ZPUlRIUk9XAAAAAAAAAAABAAAAAAtQQVNTTElORUJFVAIAAAALUEFTU0xJTkVCRVQAAAAAD0RPTlRQQVNTTElORUJFVAIAAAAPRE9OVFBBU1NMSU5FQkVUAAAAAAdDT01FQkVUAgAAAAdDT01FQkVUAAAAAAtET05UQ09NRUJFVAIAAAALRE9OVENPTUVCRVQAAAAACEZJRUxEQkVUAgAAAAhGSUVMREJFVAAAAAAHT0REU0JFVAIAAAAHT0REU0JFVAAAAAAKQklHNk9SOEJFVAIAAAAKQklHNk9SOEJFVAAAAAALUExBQ0VCRVRCVVkCAAAAC1BMQUNFQkVUQlVZAAAAAAxQTEFDRUJFVExPU0UCAAAADFBMQUNFQkVUTE9TRQAAAAALUExBQ0VCRVRMQVkCAAAAC1BMQUNFQk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eded", "spentComplexity": 0 } View: original | compacted Prev: EjWyTuQ1c4zPNjgSUa8dvAkRMQBCGkeUderSJDZQqniP Next: 7ydyujAjFYHi5VnmgEvEMYwLnpRqqWGXbvWkiKxj12U3 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 (amount * 7)
194- else if (if ((odd == 5))
195- then true
196- else (odd == 8))
197- then (amount * 9)
198- else if (if ((odd == 3))
199- then true
200- else (odd == 11))
201- then (amount * 15)
202- else if (if ((odd == 2))
203- then true
204- else (odd == 12))
205- then (amount * 30)
206- 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))
20787 then true
208- else (odd == 4))
209- then (amount * 30)
210- else if ((odd == 7))
211- then (amount * 4)
212- else if (if ((odd == 100))
213- then if (if ((resultOfRound == 3))
214- then true
215- else (resultOfRound == 12))
216- then true
217- else (resultOfRound == 2)
218- else false)
219- then (amount * 7)
220- else 0
221-
222-
223-func getWinningAmountForField (amount,resultOfRound) = if ((resultOfRound == 12))
224- then (amount * 4)
225- else if ((resultOfRound == 2))
226- then (amount * 3)
227- else if (if (if (if ((resultOfRound == 5))
228- then true
229- else (resultOfRound == 6))
230- then true
231- else (resultOfRound == 7))
232- then true
233- else (resultOfRound == 8))
234- then 0
235- else (amount * 2)
236-
237-
238-func storeOneRoundBetTypes (gameCounter,amount,typeBet,caller,odd) = match getGameTotalFieldOrOddsBets() {
239- case betCount: Int =>
240- match getGameRollsCount(gameCounter) {
241- case rollCount: Int =>
242- let newTotalBetCount = (betCount + 1)
243- let newRollCountForGame = (rollCount + 1)
244- if (if ((typeBet == COMEBET))
88+ else (resultOfRound == 8))
89+ then [IntegerEntry("price", (amount * 2))]
90+ else [IntegerEntry("price", 0)]
91+ else if (if ((betType == PLACEBETLAY))
24592 then true
246- else (typeBet == DONTCOMEBET))
247- then [IntegerEntry(gameFieldOrOddsBetGameCounterLabel(newTotalBetCount), gameCounter), StringEntry(gameFieldOrOddsBetLineLabel(newTotalBetCount), ((((((((caller + "_") + amount) + "_") + typeBet) + "_active_pending_") + toString(gameCounter)) + "_") + toString(newRollCountForGame))), IntegerEntry(gameTotalFieldBetsLabel, newTotalBetCount), IntegerEntry(gameFieldOrOddsBetForNextThrowLabel(newTotalBetCount), newRollCountForGame)]
248- else [IntegerEntry(gameFieldOrOddsBetGameCounterLabel(newTotalBetCount), gameCounter), StringEntry(gameFieldOrOddsBetLineLabel(newTotalBetCount), ((((((caller + "_") + amount) + "_") + typeBet) + "_active_pending_") + toString(odd))), IntegerEntry(gameTotalFieldBetsLabel, newTotalBetCount), IntegerEntry(gameFieldOrOddsBetForNextThrowLabel(newTotalBetCount), newRollCountForGame)]
249- case _ =>
250- throw("Game doesn't exist")
251- }
252- case _ =>
253- throw("Game has not bee initialized")
254-}
255-
256-
257-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)]
258-
259-
260-func storeNextRoll (gameState,amount,totalFieldBets,lastFieldProcessBet,betOnRoll,gameNumber,betType,betPlacer,odd) = if ((gameState == GAMEFINISHED))
261- then rollPlaceBetIntoAnotherRoundBet((totalFieldBets + 1), (lastFieldProcessBet + 1), 1, (gameNumber + 1), toString(amount), betType, betPlacer, odd)
262- else rollPlaceBetIntoAnotherRoundBet((totalFieldBets + 1), (lastFieldProcessBet + 1), (betOnRoll + 1), gameNumber, toString(amount), betType, betPlacer, odd)
263-
264-
265-func storePassBet (gameCounter,amount,typeBet,caller) = match getGameTotalBets() {
266- case number: Int =>
267- let newTotalBets = (number + 1)
268-[IntegerEntry(gameBetCounterLabel(newTotalBets), gameCounter), StringEntry(gameBetLineLabel(newTotalBets), (((((caller + "_") + amount) + "_") + typeBet) + "_active_pending")), IntegerEntry(gameTotalBetsLabel, newTotalBets)]
269- case _ =>
270- throw("Game has not bee initialized")
271-}
272-
273-
274-func udpateBetDetailsWithLost (updateBetDetials,gameNumber,lastProceedBet,betIndex,betProceedIndex) = {
275- let updateInfoBet = (updateBetDetials + "_lost")
276-[StringEntry(betIndex, updateInfoBet), IntegerEntry(betProceedIndex, lastProceedBet)]
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))
108+ then {
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")
131+ }
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))
137+ then true
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)]
277158 }
278159
279160
280-func udpateBetDetailsWithLostWithOdd (updateBetDetials,gameNumber,lastProceedBet,betIndex,betProceedIndex,oddNumber) = {
281- let updateInfoBet = ((updateBetDetials + "_lost_") + toString(oddNumber))
282-[StringEntry(betIndex, updateInfoBet), IntegerEntry(betProceedIndex, lastProceedBet)]
283- }
284161
285-
286-func updateBetDetailsWithWinning (updateBetDetials,gameNumber,currentProceedBet,betPlacer,winningAmount,betType,betIndex,betProceedIndex) = {
287- let updateInfoBet = (updateBetDetials + "_won_")
288-[StringEntry(gameWinningNumberBetLabel(gameNumber, currentProceedBet, betType), ((betPlacer + "_amount_") + toString(winningAmount))), StringEntry(betIndex, updateBetDetials), IntegerEntry(betProceedIndex, currentProceedBet), ScriptTransfer(value(addressFromString(betPlacer)), winningAmount, unit)]
289- }
290-
291-
292-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)]
293-
294-
162+@Callable(i)
295163 func getWinningAmountPassLineBets (firstPoint,lastPoint,betDetails) = {
296164 let betType = split(betDetails, "_")[2]
297165 let betPlacer = split(betDetails, "_")[0]
301169 then if (if ((firstPoint == 7))
302170 then true
303171 else (firstPoint == 11))
304- then (amount * 2)
305- else 0
172+ then [IntegerEntry("price", (amount * 2))]
173+ else [IntegerEntry("price", (amount * 0))]
306174 else if ((firstPoint == lastPoint))
307- then (amount * 2)
175+ then [IntegerEntry("price", (amount * 2))]
308176 else if ((lastPoint == 7))
309- then 0
310- else 0
177+ then [IntegerEntry("price", (amount * 0))]
178+ else [IntegerEntry("price", (amount * 0))]
311179 else if ((betType == DONTPASSLINEBET))
312180 then if ((lastPoint == 0))
313181 then if (if ((firstPoint == 2))
314182 then true
315183 else (firstPoint == 3))
316- then (amount * 2)
184+ then [IntegerEntry("price", (amount * 2))]
317185 else if (if ((lastPoint == 7))
318186 then true
319187 else (lastPoint == 11))
320- then 0
321- else 0
188+ then [IntegerEntry("price", (amount * 0))]
189+ else [IntegerEntry("price", (amount * 0))]
322190 else if (if ((lastPoint == 2))
323191 then true
324192 else (lastPoint == 3))
325- then (amount * 2)
193+ then [IntegerEntry("price", (amount * 2))]
326194 else if ((lastPoint == 7))
327- then 0
328- else 0
329- else 0
195+ then [IntegerEntry("price", (amount * 0))]
196+ else [IntegerEntry("price", (amount * 0))]
197+ else [IntegerEntry("price", (amount * 0))]
330198 }
331199
332-
333-func getWinningAmountOneRoundBets (betDetails,resultOfRound,round) = {
334- let betType = split(betDetails, "_")[2]
335- let odd = value(parseInt(split(betDetails, "_")[5]))
336- let amount = value(parseInt(split(betDetails, "_")[1]))
337- if ((betType == FIELDBET))
338- then if ((resultOfRound == 12))
339- then (amount * 4)
340- else if ((resultOfRound == 2))
341- then (amount * 3)
342- else if (if (if (if ((resultOfRound == 5))
343- then true
344- else (resultOfRound == 6))
345- then true
346- else (resultOfRound == 7))
347- then true
348- else (resultOfRound == 8))
349- then 0
350- else (amount * 2)
351- else if ((betType == ODDSBET))
352- then if (if ((odd == 4))
353- then true
354- else (odd == 10))
355- then (amount * 7)
356- else if (if ((odd == 5))
357- then true
358- else (odd == 8))
359- then (amount * 9)
360- else if (if ((odd == 3))
361- then true
362- else (odd == 11))
363- then (amount * 15)
364- else if (if ((odd == 2))
365- then true
366- else (odd == 12))
367- then (amount * 30)
368- else if (if ((odd == 10))
369- then true
370- else (odd == 4))
371- then (amount * 30)
372- else if ((odd == 7))
373- then (amount * 4)
374- else if (if ((odd == 100))
375- then if (if ((resultOfRound == 3))
376- then true
377- else (resultOfRound == 12))
378- then true
379- else (resultOfRound == 2)
380- else false)
381- then (amount * 7)
382- else 0
383- else if ((betType == BIG6OR8BET))
384- then if (if ((resultOfRound == 6))
385- then true
386- else (resultOfRound == 8))
387- then (2 * amount)
388- else 0
389- else if (if ((betType == PLACEBETLAY))
390- then true
391- else (betType == PLACEBETLOSE))
392- then if ((resultOfRound == 7))
393- then (amount * 2)
394- else if ((resultOfRound == odd))
395- then 0
396- else -1
397- else if (if ((betType == PLACEBETBUY))
398- then true
399- else (betType == PLACEBETWIN))
400- then if ((resultOfRound == 7))
401- then 0
402- else if ((resultOfRound == odd))
403- then (amount * 2)
404- else -1
405- else if ((betType == COMEBET))
406- then {
407- let playerPoint = value(parseInt(split(betDetails, "_")[6]))
408- if ((round == 2))
409- then if (if ((resultOfRound == 7))
410- then true
411- else (resultOfRound == 11))
412- then (amount * 2)
413- else if (if (if ((resultOfRound == 2))
414- then true
415- else (resultOfRound == 12))
416- then true
417- else (resultOfRound == 3))
418- then 0
419- else if ((resultOfRound == playerPoint))
420- then (amount * 2)
421- else -1
422- else if ((round > 2))
423- then if ((resultOfRound == 7))
424- then 0
425- else if ((resultOfRound == playerPoint))
426- then (amount * 2)
427- else -1
428- else throw("Not Allow in The Beginning")
429- }
430- else if ((betType == DONTCOMEBET))
431- then {
432- let playerPoint = value(parseInt(split(betDetails, "_")[6]))
433- if ((round == 2))
434- then if (if ((resultOfRound == 7))
435- then true
436- else (resultOfRound == 11))
437- then 0
438- else if (if (if ((resultOfRound == 2))
439- then true
440- else (resultOfRound == 12))
441- then true
442- else (resultOfRound == 3))
443- then (amount * 2)
444- else if ((resultOfRound == playerPoint))
445- then (amount * 2)
446- else -1
447- else if ((round > 1))
448- then if ((resultOfRound == 7))
449- then (amount * 2)
450- else if ((resultOfRound == playerPoint))
451- then 0
452- else -1
453- else throw("Not Allow in The Beginning")
454- }
455- else 0
456- }
457-
458-
459-@Callable(i)
460-func processNextBet () = if (authorizePermission(i.callerPublicKey))
461- then throw("processFieldBet_FORBIDDEN")
462- else match getGameTotalBets() {
463- case totalBets: Int =>
464- match getGameProcessedBets() {
465- case lastProcessBet: Int =>
466- let nextBet = (lastProcessBet + 1)
467- if ((nextBet > totalBets))
468- then throw("Next bet has not been places.")
469- else match getGameBetCounter(nextBet) {
470- case gameNumber: Int =>
471- match getGameState(gameNumber) {
472- case gameState: Int =>
473- if (if ((gameState == GAMESTART))
474- then true
475- else (gameState == GAMEINPROGRESS))
476- then throw("Game has to finished in order to process NON-FIELD bets")
477- else {
478- let betDetails = value(getBetDetailsResult(nextBet))
479- let address = value(addressFromString(split(betDetails, "_")[0]))
480- let currentPoint = getCurrentPointDice(nextBet)
481- let firstPoint = value(getFirstPointDice(nextBet))
482- let updateBetDetials = (((((split(betDetails, "_")[0] + "_") + split(betDetails, "_")[1]) + "_") + split(betDetails, "_")[2]) + "_inactive_")
483- let winningAmountResult = getWinningAmountPassLineBets(firstPoint, currentPoint, betDetails)
484- if ((winningAmountResult == 0))
485- then udpateBetDetailsWithLost(updateBetDetials, gameNumber, nextBet, gameBetLineLabel(nextBet), gameTotalProccedBetsLabel)
486- else if ((winningAmountResult > 0))
487- then updateBetDetailsWithWinning(updateBetDetials, gameNumber, nextBet, split(betDetails, "_")[0], winningAmountResult, split(betDetails, "_")[2], gameBetLineLabel(nextBet), gameTotalProccedBetsLabel)
488- else throw((((((("Only " + PASSLINEBET) + ", ") + DONTPASSLINEBET) + " allowed in processNextBet()") + " currentBetType ") + split(betDetails, "_")[2]))
489- }
490- case _ =>
491- throw("Game does not exist or has already ended.")
492- }
493- case _ =>
494- throw("Error")
495- }
496- case _ =>
497- throw("Game has not been initialized, next bets not found")
498- }
499- case _ =>
500- throw("Game has not been initialized, next bets not found")
501- }
502-
503-
504-
505-@Callable(i)
506-func processOneRoundBet () = if (authorizePermission(i.callerPublicKey))
507- then throw("processFieldBet_FORBIDDEN")
508- else match getGameTotalFieldOrOddsBets() {
509- case totalFieldBets: Int =>
510- match getGameProcessedFieldOrOddsBets() {
511- case lastFieldProcessBet: Int =>
512- let nextBet = (lastFieldProcessBet + 1)
513- if ((nextBet > totalFieldBets))
514- then throw("Next Field Bet has not been places.")
515- else match getGameFieldOrOddsBetCounter(nextBet) {
516- case gameNumber: Int =>
517- match getGameState(gameNumber) {
518- case gameState: Int =>
519- if ((gameState == GAMESTART))
520- then throw("Game has not started yet")
521- else {
522- let betDetails = value(getFieldBetDetailsResult(nextBet))
523- let betType = split(betDetails, "_")[2]
524- let betPlacer = split(betDetails, "_")[0]
525- let amount = value(parseInt(split(betDetails, "_")[1]))
526- let odd = value(parseInt(split(betDetails, "_")[5]))
527- let address = value(addressFromString(betPlacer))
528- let betOnRoll = value(getFieldOddsBetForNextDice(nextBet))
529- let updateBetDetials = (((((betPlacer + "_") + split(betDetails, "_")[1]) + "_") + split(betDetails, "_")[2]) + "_inactive_")
530- match getGameRollDiceWithGameNumber(gameNumber, betOnRoll) {
531- case resultOfRound: Int =>
532- let roundRole = value(parseInt(gameRollsCountBetLabel(gameNumber)))
533- let winningAmountOneRoundBet = getWinningAmountOneRoundBets(betDetails, resultOfRound, roundRole)
534- if ((winningAmountOneRoundBet == -1))
535- then storeNextRoll(gameState, amount, totalFieldBets, lastFieldProcessBet, betOnRoll, gameNumber, betType, betPlacer, odd)
536- else if ((winningAmountOneRoundBet == 0))
537- then udpateBetDetailsWithLostWithOdd(updateBetDetials, gameNumber, nextBet, gameFieldOrOddsBetLineLabel(gameNumber), gameTotalProccedFieldOrOddsBetsLabel, odd)
538- else updateBetDetailsWithWinning((updateBetDetials + "_won_"), gameNumber, nextBet, betPlacer, winningAmountOneRoundBet, betType, gameFieldOrOddsBetLineLabel(nextBet), gameTotalProccedFieldOrOddsBetsLabel)
539- case _ =>
540- throw("There is no result for this round yet")
541- }
542- }
543- case _ =>
544- throw("Game does not exist or has already ended")
545- }
546- case _ =>
547- throw("Error")
548- }
549- case _ =>
550- throw("Game has not been initialized, next bets not found")
551- }
552- case _ =>
553- throw("Game has not been initialized, next bets not found")
554- }
555-
556-
557-
558-@Callable(i)
559-func initGame () = if (authorizePermission(i.callerPublicKey))
560- then throw("initGame_FORBIDDEN")
561- else match getGameCounter() {
562- case counter: Int =>
563- throw("INIT_ALREADY_DONE")
564- case _ =>
565-[IntegerEntry(gameCounterLabel, 0), IntegerEntry(gameTotalBetsLabel, 0), IntegerEntry(gameTotalProccedBetsLabel, 0), IntegerEntry(gameTotalFieldBetsLabel, 0), IntegerEntry(gameTotalProccedFieldOrOddsBetsLabel, 0)]
566- }
567-
568-
569-
570-@Callable(i)
571-func startGame (randomHash) = if (authorizePermission(i.callerPublicKey))
572- then throw("startGame_FORBIDDEN")
573- else match getGameCounter() {
574- case number: Int =>
575- if ((number == 0))
576- then {
577- let newNumber = (number + 1)
578-[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))))]
579- }
580- else match getGameState(number) {
581- case state: Int =>
582- if (if ((state == GAMEINPROGRESS))
583- then true
584- else (state == GAMESTART))
585- then throw("The previous game is still in progress")
586- else {
587- let newNumber = (number + 1)
588-[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))))]
589- }
590- case _ =>
591- throw("Error")
592- }
593- case _ =>
594- throw("INIT_NEED")
595- }
596-
597-
598-
599-@Callable(i)
600-func placeBet (typeBet) = if (validateBetName(typeBet))
601- then if ((size(i.payments) == 0))
602- then throw("Payment not attached")
603- else match getGameCounter() {
604- case GAMENUMBER: Int =>
605- let p = i.payments[0]
606- match getGameState(GAMENUMBER) {
607- case state: Int =>
608- if ((state == GAMESTART))
609- then if (if ((typeBet == PASSLINEBET))
610- then true
611- else (typeBet == DONTPASSLINEBET))
612- then storePassBet(GAMENUMBER, toString(p.amount), typeBet, toBase58String(i.caller.bytes))
613- else throw((((((("Only " + PASSLINEBET) + ", ") + DONTPASSLINEBET) + " and ") + FIELDBET) + " are allowed in the Beginning of Game"))
614- else if ((state == GAMEINPROGRESS))
615- then throw((((((("Only " + COMEBET) + ", ") + DONTCOMEBET) + " and ") + FIELDBET) + " ARE ALLOWED at Start."))
616- else if ((state == GAMEFINISHED))
617- then throw("Game already ended.")
618- else throw("Unknown Game State.")
619- case _ =>
620- throw("Game does not exist or has already ended.")
621- }
622- case _ =>
623- throw("Game has not been initialized.")
624- }
625- else throw(((((((((("Unsupported Type of Bet for Crap. Please Select one of " + PASSLINEBET) + ", ") + DONTPASSLINEBET) + ", ") + COMEBET) + ", ") + DONTCOMEBET) + ", ") + FIELDBET))
626-
627-
628-
629-@Callable(i)
630-func placeRoundBet (typeBet,oddNumber) = if (validateRoundBet(typeBet))
631- then if ((size(i.payments) == 0))
632- then throw("Payment not attached")
633- else match getGameCounter() {
634- case GAMENUMBER: Int =>
635- let p = i.payments[0]
636- match getGameState(GAMENUMBER) {
637- case state: Int =>
638- if ((state == GAMEFINISHED))
639- then throw("Game already ended.")
640- else if (if ((typeBet == COMEBET))
641- then true
642- else (typeBet == DONTCOMEBET))
643- then if ((state == GAMESTART))
644- then throw("Cannot place COME OR DONTCOME BET IF GAME HAS NOT STARTED")
645- else storeOneRoundBetTypes(GAMENUMBER, toString(p.amount), typeBet, toBase58String(i.caller.bytes), 0)
646- else storeOneRoundBetTypes(GAMENUMBER, toString(p.amount), typeBet, toBase58String(i.caller.bytes), oddNumber)
647- case _ =>
648- throw("Game does not exist or has already ended.")
649- }
650- case _ =>
651- throw("Game has not been initialized.")
652- }
653- else throw(((((((((("Unsupported Type of Bet for Crap. Please Select one of " + ODDSBET) + ", ") + DONTPASSLINEBET) + ", ") + COMEBET) + ", ") + DONTCOMEBET) + ", ") + FIELDBET))
654-
655-
656-
657-@Callable(i)
658-func throwDices (rsaSign,gameNumber) = if (authorizePermission(i.callerPublicKey))
659- then throw("throwDices_FORBIDDEN")
660- else match getGameState(gameNumber) {
661- case state: Int =>
662- if ((state == GAMEFINISHED))
663- then throw("Game is finished")
664- else {
665- let currentHeight = lastBlock.height
666- let lastHeightAllowed = value(getEndHeight(gameNumber))
667- if ((currentHeight >= lastHeightAllowed))
668- then match getGameSumSha(gameNumber) {
669- case sumSha: String =>
670- let sig = fromBase64String(rsaSign)
671- let rsaSigValid = rsaVerify(SHA256, fromBase58String(sumSha), sig, RSAPUBLIC)
672- match blockInfoByHeight((lastBlock.height - 1)) {
673- case previousBlock: BlockInfo =>
674- let randomHash = sha256((take(sig, 4) + take(previousBlock.generationSignature, 8)))
675- if (!(rsaSigValid))
676- then throw("INVALID_RSA_SIGN")
677- else {
678- let randNumber = (toInt(randomHash) % 11)
679- let number = diceNumber[randNumber]
680- match getGameRollsCount(gameNumber) {
681- case rollCountNumber: Int =>
682- let newRollCountNumber = (rollCountNumber + 1)
683- if ((state == GAMESTART))
684- then if (if (if (if (if ((number == 7))
685- then true
686- else (number == 11))
687- then true
688- else (number == 2))
689- then true
690- else (number == 3))
691- then true
692- else (number == 12))
693- then storeGameProgressPointState(gameFirstPointDiceLabel(gameNumber), gameNumber, number, newRollCountNumber, currentHeight, randomHash, GAMEFINISHED)
694- else storeGameProgressPointState(gameFirstPointDiceLabel(gameNumber), gameNumber, number, newRollCountNumber, currentHeight, randomHash, GAMEINPROGRESS)
695- else {
696- let currentPoint = value(getCurrentPointDice(gameNumber))
697- let firstPoint = value(getFirstPointDice(gameNumber))
698- if ((currentPoint == 0))
699- then if (if ((number == 7))
700- then true
701- else (firstPoint == number))
702- then storeGameProgressPointState(gameCurrentPointDiceLabel(gameNumber), gameNumber, number, newRollCountNumber, currentHeight, randomHash, GAMEFINISHED)
703- else storeGameProgressPointState(gameCurrentPointDiceLabel(gameNumber), gameNumber, number, newRollCountNumber, currentHeight, randomHash, GAMEINPROGRESS)
704- else if (if ((number == 7))
705- then true
706- else (firstPoint == number))
707- then storeGameProgressPointState(gameCurrentPointDiceLabel(gameNumber), gameNumber, number, newRollCountNumber, currentHeight, randomHash, GAMEFINISHED)
708- else storeGameProgressPointState(gameCurrentPointDiceLabel(gameNumber), gameNumber, number, newRollCountNumber, currentHeight, randomHash, GAMEINPROGRESS)
709- }
710- case _ =>
711- throw("No dices have been thrown")
712- }
713- }
714- case _ =>
715- throw("Last block doesn't exist.")
716- }
717- case _ =>
718- throw("SHA doesn't exist")
719- }
720- else throw("Throw dice not allow still waiting for block to process")
721- }
722- case _ =>
723- throw("Game does not exist or has already ended.")
724- }
725-
726-
727-@Verifier(tx)
728-func verify () = match tx {
729- case _ =>
730- sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey)
731-}
732200
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 (amount * 7)
194- else if (if ((odd == 5))
195- then true
196- else (odd == 8))
197- then (amount * 9)
198- else if (if ((odd == 3))
199- then true
200- else (odd == 11))
201- then (amount * 15)
202- else if (if ((odd == 2))
203- then true
204- else (odd == 12))
205- then (amount * 30)
206- 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))
20787 then true
208- else (odd == 4))
209- then (amount * 30)
210- else if ((odd == 7))
211- then (amount * 4)
212- else if (if ((odd == 100))
213- then if (if ((resultOfRound == 3))
214- then true
215- else (resultOfRound == 12))
216- then true
217- else (resultOfRound == 2)
218- else false)
219- then (amount * 7)
220- else 0
221-
222-
223-func getWinningAmountForField (amount,resultOfRound) = if ((resultOfRound == 12))
224- then (amount * 4)
225- else if ((resultOfRound == 2))
226- then (amount * 3)
227- else if (if (if (if ((resultOfRound == 5))
228- then true
229- else (resultOfRound == 6))
230- then true
231- else (resultOfRound == 7))
232- then true
233- else (resultOfRound == 8))
234- then 0
235- else (amount * 2)
236-
237-
238-func storeOneRoundBetTypes (gameCounter,amount,typeBet,caller,odd) = match getGameTotalFieldOrOddsBets() {
239- case betCount: Int =>
240- match getGameRollsCount(gameCounter) {
241- case rollCount: Int =>
242- let newTotalBetCount = (betCount + 1)
243- let newRollCountForGame = (rollCount + 1)
244- if (if ((typeBet == COMEBET))
88+ else (resultOfRound == 8))
89+ then [IntegerEntry("price", (amount * 2))]
90+ else [IntegerEntry("price", 0)]
91+ else if (if ((betType == PLACEBETLAY))
24592 then true
246- else (typeBet == DONTCOMEBET))
247- then [IntegerEntry(gameFieldOrOddsBetGameCounterLabel(newTotalBetCount), gameCounter), StringEntry(gameFieldOrOddsBetLineLabel(newTotalBetCount), ((((((((caller + "_") + amount) + "_") + typeBet) + "_active_pending_") + toString(gameCounter)) + "_") + toString(newRollCountForGame))), IntegerEntry(gameTotalFieldBetsLabel, newTotalBetCount), IntegerEntry(gameFieldOrOddsBetForNextThrowLabel(newTotalBetCount), newRollCountForGame)]
248- else [IntegerEntry(gameFieldOrOddsBetGameCounterLabel(newTotalBetCount), gameCounter), StringEntry(gameFieldOrOddsBetLineLabel(newTotalBetCount), ((((((caller + "_") + amount) + "_") + typeBet) + "_active_pending_") + toString(odd))), IntegerEntry(gameTotalFieldBetsLabel, newTotalBetCount), IntegerEntry(gameFieldOrOddsBetForNextThrowLabel(newTotalBetCount), newRollCountForGame)]
249- case _ =>
250- throw("Game doesn't exist")
251- }
252- case _ =>
253- throw("Game has not bee initialized")
254-}
255-
256-
257-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)]
258-
259-
260-func storeNextRoll (gameState,amount,totalFieldBets,lastFieldProcessBet,betOnRoll,gameNumber,betType,betPlacer,odd) = if ((gameState == GAMEFINISHED))
261- then rollPlaceBetIntoAnotherRoundBet((totalFieldBets + 1), (lastFieldProcessBet + 1), 1, (gameNumber + 1), toString(amount), betType, betPlacer, odd)
262- else rollPlaceBetIntoAnotherRoundBet((totalFieldBets + 1), (lastFieldProcessBet + 1), (betOnRoll + 1), gameNumber, toString(amount), betType, betPlacer, odd)
263-
264-
265-func storePassBet (gameCounter,amount,typeBet,caller) = match getGameTotalBets() {
266- case number: Int =>
267- let newTotalBets = (number + 1)
268-[IntegerEntry(gameBetCounterLabel(newTotalBets), gameCounter), StringEntry(gameBetLineLabel(newTotalBets), (((((caller + "_") + amount) + "_") + typeBet) + "_active_pending")), IntegerEntry(gameTotalBetsLabel, newTotalBets)]
269- case _ =>
270- throw("Game has not bee initialized")
271-}
272-
273-
274-func udpateBetDetailsWithLost (updateBetDetials,gameNumber,lastProceedBet,betIndex,betProceedIndex) = {
275- let updateInfoBet = (updateBetDetials + "_lost")
276-[StringEntry(betIndex, updateInfoBet), IntegerEntry(betProceedIndex, lastProceedBet)]
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))
108+ then {
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")
131+ }
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))
137+ then true
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)]
277158 }
278159
279160
280-func udpateBetDetailsWithLostWithOdd (updateBetDetials,gameNumber,lastProceedBet,betIndex,betProceedIndex,oddNumber) = {
281- let updateInfoBet = ((updateBetDetials + "_lost_") + toString(oddNumber))
282-[StringEntry(betIndex, updateInfoBet), IntegerEntry(betProceedIndex, lastProceedBet)]
283- }
284161
285-
286-func updateBetDetailsWithWinning (updateBetDetials,gameNumber,currentProceedBet,betPlacer,winningAmount,betType,betIndex,betProceedIndex) = {
287- let updateInfoBet = (updateBetDetials + "_won_")
288-[StringEntry(gameWinningNumberBetLabel(gameNumber, currentProceedBet, betType), ((betPlacer + "_amount_") + toString(winningAmount))), StringEntry(betIndex, updateBetDetials), IntegerEntry(betProceedIndex, currentProceedBet), ScriptTransfer(value(addressFromString(betPlacer)), winningAmount, unit)]
289- }
290-
291-
292-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)]
293-
294-
162+@Callable(i)
295163 func getWinningAmountPassLineBets (firstPoint,lastPoint,betDetails) = {
296164 let betType = split(betDetails, "_")[2]
297165 let betPlacer = split(betDetails, "_")[0]
298166 let amount = value(parseInt(split(betDetails, "_")[1]))
299167 if ((betType == PASSLINEBET))
300168 then if ((lastPoint == 0))
301169 then if (if ((firstPoint == 7))
302170 then true
303171 else (firstPoint == 11))
304- then (amount * 2)
305- else 0
172+ then [IntegerEntry("price", (amount * 2))]
173+ else [IntegerEntry("price", (amount * 0))]
306174 else if ((firstPoint == lastPoint))
307- then (amount * 2)
175+ then [IntegerEntry("price", (amount * 2))]
308176 else if ((lastPoint == 7))
309- then 0
310- else 0
177+ then [IntegerEntry("price", (amount * 0))]
178+ else [IntegerEntry("price", (amount * 0))]
311179 else if ((betType == DONTPASSLINEBET))
312180 then if ((lastPoint == 0))
313181 then if (if ((firstPoint == 2))
314182 then true
315183 else (firstPoint == 3))
316- then (amount * 2)
184+ then [IntegerEntry("price", (amount * 2))]
317185 else if (if ((lastPoint == 7))
318186 then true
319187 else (lastPoint == 11))
320- then 0
321- else 0
188+ then [IntegerEntry("price", (amount * 0))]
189+ else [IntegerEntry("price", (amount * 0))]
322190 else if (if ((lastPoint == 2))
323191 then true
324192 else (lastPoint == 3))
325- then (amount * 2)
193+ then [IntegerEntry("price", (amount * 2))]
326194 else if ((lastPoint == 7))
327- then 0
328- else 0
329- else 0
195+ then [IntegerEntry("price", (amount * 0))]
196+ else [IntegerEntry("price", (amount * 0))]
197+ else [IntegerEntry("price", (amount * 0))]
330198 }
331199
332-
333-func getWinningAmountOneRoundBets (betDetails,resultOfRound,round) = {
334- let betType = split(betDetails, "_")[2]
335- let odd = value(parseInt(split(betDetails, "_")[5]))
336- let amount = value(parseInt(split(betDetails, "_")[1]))
337- if ((betType == FIELDBET))
338- then if ((resultOfRound == 12))
339- then (amount * 4)
340- else if ((resultOfRound == 2))
341- then (amount * 3)
342- else if (if (if (if ((resultOfRound == 5))
343- then true
344- else (resultOfRound == 6))
345- then true
346- else (resultOfRound == 7))
347- then true
348- else (resultOfRound == 8))
349- then 0
350- else (amount * 2)
351- else if ((betType == ODDSBET))
352- then if (if ((odd == 4))
353- then true
354- else (odd == 10))
355- then (amount * 7)
356- else if (if ((odd == 5))
357- then true
358- else (odd == 8))
359- then (amount * 9)
360- else if (if ((odd == 3))
361- then true
362- else (odd == 11))
363- then (amount * 15)
364- else if (if ((odd == 2))
365- then true
366- else (odd == 12))
367- then (amount * 30)
368- else if (if ((odd == 10))
369- then true
370- else (odd == 4))
371- then (amount * 30)
372- else if ((odd == 7))
373- then (amount * 4)
374- else if (if ((odd == 100))
375- then if (if ((resultOfRound == 3))
376- then true
377- else (resultOfRound == 12))
378- then true
379- else (resultOfRound == 2)
380- else false)
381- then (amount * 7)
382- else 0
383- else if ((betType == BIG6OR8BET))
384- then if (if ((resultOfRound == 6))
385- then true
386- else (resultOfRound == 8))
387- then (2 * amount)
388- else 0
389- else if (if ((betType == PLACEBETLAY))
390- then true
391- else (betType == PLACEBETLOSE))
392- then if ((resultOfRound == 7))
393- then (amount * 2)
394- else if ((resultOfRound == odd))
395- then 0
396- else -1
397- else if (if ((betType == PLACEBETBUY))
398- then true
399- else (betType == PLACEBETWIN))
400- then if ((resultOfRound == 7))
401- then 0
402- else if ((resultOfRound == odd))
403- then (amount * 2)
404- else -1
405- else if ((betType == COMEBET))
406- then {
407- let playerPoint = value(parseInt(split(betDetails, "_")[6]))
408- if ((round == 2))
409- then if (if ((resultOfRound == 7))
410- then true
411- else (resultOfRound == 11))
412- then (amount * 2)
413- else if (if (if ((resultOfRound == 2))
414- then true
415- else (resultOfRound == 12))
416- then true
417- else (resultOfRound == 3))
418- then 0
419- else if ((resultOfRound == playerPoint))
420- then (amount * 2)
421- else -1
422- else if ((round > 2))
423- then if ((resultOfRound == 7))
424- then 0
425- else if ((resultOfRound == playerPoint))
426- then (amount * 2)
427- else -1
428- else throw("Not Allow in The Beginning")
429- }
430- else if ((betType == DONTCOMEBET))
431- then {
432- let playerPoint = value(parseInt(split(betDetails, "_")[6]))
433- if ((round == 2))
434- then if (if ((resultOfRound == 7))
435- then true
436- else (resultOfRound == 11))
437- then 0
438- else if (if (if ((resultOfRound == 2))
439- then true
440- else (resultOfRound == 12))
441- then true
442- else (resultOfRound == 3))
443- then (amount * 2)
444- else if ((resultOfRound == playerPoint))
445- then (amount * 2)
446- else -1
447- else if ((round > 1))
448- then if ((resultOfRound == 7))
449- then (amount * 2)
450- else if ((resultOfRound == playerPoint))
451- then 0
452- else -1
453- else throw("Not Allow in The Beginning")
454- }
455- else 0
456- }
457-
458-
459-@Callable(i)
460-func processNextBet () = if (authorizePermission(i.callerPublicKey))
461- then throw("processFieldBet_FORBIDDEN")
462- else match getGameTotalBets() {
463- case totalBets: Int =>
464- match getGameProcessedBets() {
465- case lastProcessBet: Int =>
466- let nextBet = (lastProcessBet + 1)
467- if ((nextBet > totalBets))
468- then throw("Next bet has not been places.")
469- else match getGameBetCounter(nextBet) {
470- case gameNumber: Int =>
471- match getGameState(gameNumber) {
472- case gameState: Int =>
473- if (if ((gameState == GAMESTART))
474- then true
475- else (gameState == GAMEINPROGRESS))
476- then throw("Game has to finished in order to process NON-FIELD bets")
477- else {
478- let betDetails = value(getBetDetailsResult(nextBet))
479- let address = value(addressFromString(split(betDetails, "_")[0]))
480- let currentPoint = getCurrentPointDice(nextBet)
481- let firstPoint = value(getFirstPointDice(nextBet))
482- let updateBetDetials = (((((split(betDetails, "_")[0] + "_") + split(betDetails, "_")[1]) + "_") + split(betDetails, "_")[2]) + "_inactive_")
483- let winningAmountResult = getWinningAmountPassLineBets(firstPoint, currentPoint, betDetails)
484- if ((winningAmountResult == 0))
485- then udpateBetDetailsWithLost(updateBetDetials, gameNumber, nextBet, gameBetLineLabel(nextBet), gameTotalProccedBetsLabel)
486- else if ((winningAmountResult > 0))
487- then updateBetDetailsWithWinning(updateBetDetials, gameNumber, nextBet, split(betDetails, "_")[0], winningAmountResult, split(betDetails, "_")[2], gameBetLineLabel(nextBet), gameTotalProccedBetsLabel)
488- else throw((((((("Only " + PASSLINEBET) + ", ") + DONTPASSLINEBET) + " allowed in processNextBet()") + " currentBetType ") + split(betDetails, "_")[2]))
489- }
490- case _ =>
491- throw("Game does not exist or has already ended.")
492- }
493- case _ =>
494- throw("Error")
495- }
496- case _ =>
497- throw("Game has not been initialized, next bets not found")
498- }
499- case _ =>
500- throw("Game has not been initialized, next bets not found")
501- }
502-
503-
504-
505-@Callable(i)
506-func processOneRoundBet () = if (authorizePermission(i.callerPublicKey))
507- then throw("processFieldBet_FORBIDDEN")
508- else match getGameTotalFieldOrOddsBets() {
509- case totalFieldBets: Int =>
510- match getGameProcessedFieldOrOddsBets() {
511- case lastFieldProcessBet: Int =>
512- let nextBet = (lastFieldProcessBet + 1)
513- if ((nextBet > totalFieldBets))
514- then throw("Next Field Bet has not been places.")
515- else match getGameFieldOrOddsBetCounter(nextBet) {
516- case gameNumber: Int =>
517- match getGameState(gameNumber) {
518- case gameState: Int =>
519- if ((gameState == GAMESTART))
520- then throw("Game has not started yet")
521- else {
522- let betDetails = value(getFieldBetDetailsResult(nextBet))
523- let betType = split(betDetails, "_")[2]
524- let betPlacer = split(betDetails, "_")[0]
525- let amount = value(parseInt(split(betDetails, "_")[1]))
526- let odd = value(parseInt(split(betDetails, "_")[5]))
527- let address = value(addressFromString(betPlacer))
528- let betOnRoll = value(getFieldOddsBetForNextDice(nextBet))
529- let updateBetDetials = (((((betPlacer + "_") + split(betDetails, "_")[1]) + "_") + split(betDetails, "_")[2]) + "_inactive_")
530- match getGameRollDiceWithGameNumber(gameNumber, betOnRoll) {
531- case resultOfRound: Int =>
532- let roundRole = value(parseInt(gameRollsCountBetLabel(gameNumber)))
533- let winningAmountOneRoundBet = getWinningAmountOneRoundBets(betDetails, resultOfRound, roundRole)
534- if ((winningAmountOneRoundBet == -1))
535- then storeNextRoll(gameState, amount, totalFieldBets, lastFieldProcessBet, betOnRoll, gameNumber, betType, betPlacer, odd)
536- else if ((winningAmountOneRoundBet == 0))
537- then udpateBetDetailsWithLostWithOdd(updateBetDetials, gameNumber, nextBet, gameFieldOrOddsBetLineLabel(gameNumber), gameTotalProccedFieldOrOddsBetsLabel, odd)
538- else updateBetDetailsWithWinning((updateBetDetials + "_won_"), gameNumber, nextBet, betPlacer, winningAmountOneRoundBet, betType, gameFieldOrOddsBetLineLabel(nextBet), gameTotalProccedFieldOrOddsBetsLabel)
539- case _ =>
540- throw("There is no result for this round yet")
541- }
542- }
543- case _ =>
544- throw("Game does not exist or has already ended")
545- }
546- case _ =>
547- throw("Error")
548- }
549- case _ =>
550- throw("Game has not been initialized, next bets not found")
551- }
552- case _ =>
553- throw("Game has not been initialized, next bets not found")
554- }
555-
556-
557-
558-@Callable(i)
559-func initGame () = if (authorizePermission(i.callerPublicKey))
560- then throw("initGame_FORBIDDEN")
561- else match getGameCounter() {
562- case counter: Int =>
563- throw("INIT_ALREADY_DONE")
564- case _ =>
565-[IntegerEntry(gameCounterLabel, 0), IntegerEntry(gameTotalBetsLabel, 0), IntegerEntry(gameTotalProccedBetsLabel, 0), IntegerEntry(gameTotalFieldBetsLabel, 0), IntegerEntry(gameTotalProccedFieldOrOddsBetsLabel, 0)]
566- }
567-
568-
569-
570-@Callable(i)
571-func startGame (randomHash) = if (authorizePermission(i.callerPublicKey))
572- then throw("startGame_FORBIDDEN")
573- else match getGameCounter() {
574- case number: Int =>
575- if ((number == 0))
576- then {
577- let newNumber = (number + 1)
578-[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))))]
579- }
580- else match getGameState(number) {
581- case state: Int =>
582- if (if ((state == GAMEINPROGRESS))
583- then true
584- else (state == GAMESTART))
585- then throw("The previous game is still in progress")
586- else {
587- let newNumber = (number + 1)
588-[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))))]
589- }
590- case _ =>
591- throw("Error")
592- }
593- case _ =>
594- throw("INIT_NEED")
595- }
596-
597-
598-
599-@Callable(i)
600-func placeBet (typeBet) = if (validateBetName(typeBet))
601- then if ((size(i.payments) == 0))
602- then throw("Payment not attached")
603- else match getGameCounter() {
604- case GAMENUMBER: Int =>
605- let p = i.payments[0]
606- match getGameState(GAMENUMBER) {
607- case state: Int =>
608- if ((state == GAMESTART))
609- then if (if ((typeBet == PASSLINEBET))
610- then true
611- else (typeBet == DONTPASSLINEBET))
612- then storePassBet(GAMENUMBER, toString(p.amount), typeBet, toBase58String(i.caller.bytes))
613- else throw((((((("Only " + PASSLINEBET) + ", ") + DONTPASSLINEBET) + " and ") + FIELDBET) + " are allowed in the Beginning of Game"))
614- else if ((state == GAMEINPROGRESS))
615- then throw((((((("Only " + COMEBET) + ", ") + DONTCOMEBET) + " and ") + FIELDBET) + " ARE ALLOWED at Start."))
616- else if ((state == GAMEFINISHED))
617- then throw("Game already ended.")
618- else throw("Unknown Game State.")
619- case _ =>
620- throw("Game does not exist or has already ended.")
621- }
622- case _ =>
623- throw("Game has not been initialized.")
624- }
625- else throw(((((((((("Unsupported Type of Bet for Crap. Please Select one of " + PASSLINEBET) + ", ") + DONTPASSLINEBET) + ", ") + COMEBET) + ", ") + DONTCOMEBET) + ", ") + FIELDBET))
626-
627-
628-
629-@Callable(i)
630-func placeRoundBet (typeBet,oddNumber) = if (validateRoundBet(typeBet))
631- then if ((size(i.payments) == 0))
632- then throw("Payment not attached")
633- else match getGameCounter() {
634- case GAMENUMBER: Int =>
635- let p = i.payments[0]
636- match getGameState(GAMENUMBER) {
637- case state: Int =>
638- if ((state == GAMEFINISHED))
639- then throw("Game already ended.")
640- else if (if ((typeBet == COMEBET))
641- then true
642- else (typeBet == DONTCOMEBET))
643- then if ((state == GAMESTART))
644- then throw("Cannot place COME OR DONTCOME BET IF GAME HAS NOT STARTED")
645- else storeOneRoundBetTypes(GAMENUMBER, toString(p.amount), typeBet, toBase58String(i.caller.bytes), 0)
646- else storeOneRoundBetTypes(GAMENUMBER, toString(p.amount), typeBet, toBase58String(i.caller.bytes), oddNumber)
647- case _ =>
648- throw("Game does not exist or has already ended.")
649- }
650- case _ =>
651- throw("Game has not been initialized.")
652- }
653- else throw(((((((((("Unsupported Type of Bet for Crap. Please Select one of " + ODDSBET) + ", ") + DONTPASSLINEBET) + ", ") + COMEBET) + ", ") + DONTCOMEBET) + ", ") + FIELDBET))
654-
655-
656-
657-@Callable(i)
658-func throwDices (rsaSign,gameNumber) = if (authorizePermission(i.callerPublicKey))
659- then throw("throwDices_FORBIDDEN")
660- else match getGameState(gameNumber) {
661- case state: Int =>
662- if ((state == GAMEFINISHED))
663- then throw("Game is finished")
664- else {
665- let currentHeight = lastBlock.height
666- let lastHeightAllowed = value(getEndHeight(gameNumber))
667- if ((currentHeight >= lastHeightAllowed))
668- then match getGameSumSha(gameNumber) {
669- case sumSha: String =>
670- let sig = fromBase64String(rsaSign)
671- let rsaSigValid = rsaVerify(SHA256, fromBase58String(sumSha), sig, RSAPUBLIC)
672- match blockInfoByHeight((lastBlock.height - 1)) {
673- case previousBlock: BlockInfo =>
674- let randomHash = sha256((take(sig, 4) + take(previousBlock.generationSignature, 8)))
675- if (!(rsaSigValid))
676- then throw("INVALID_RSA_SIGN")
677- else {
678- let randNumber = (toInt(randomHash) % 11)
679- let number = diceNumber[randNumber]
680- match getGameRollsCount(gameNumber) {
681- case rollCountNumber: Int =>
682- let newRollCountNumber = (rollCountNumber + 1)
683- if ((state == GAMESTART))
684- then if (if (if (if (if ((number == 7))
685- then true
686- else (number == 11))
687- then true
688- else (number == 2))
689- then true
690- else (number == 3))
691- then true
692- else (number == 12))
693- then storeGameProgressPointState(gameFirstPointDiceLabel(gameNumber), gameNumber, number, newRollCountNumber, currentHeight, randomHash, GAMEFINISHED)
694- else storeGameProgressPointState(gameFirstPointDiceLabel(gameNumber), gameNumber, number, newRollCountNumber, currentHeight, randomHash, GAMEINPROGRESS)
695- else {
696- let currentPoint = value(getCurrentPointDice(gameNumber))
697- let firstPoint = value(getFirstPointDice(gameNumber))
698- if ((currentPoint == 0))
699- then if (if ((number == 7))
700- then true
701- else (firstPoint == number))
702- then storeGameProgressPointState(gameCurrentPointDiceLabel(gameNumber), gameNumber, number, newRollCountNumber, currentHeight, randomHash, GAMEFINISHED)
703- else storeGameProgressPointState(gameCurrentPointDiceLabel(gameNumber), gameNumber, number, newRollCountNumber, currentHeight, randomHash, GAMEINPROGRESS)
704- else if (if ((number == 7))
705- then true
706- else (firstPoint == number))
707- then storeGameProgressPointState(gameCurrentPointDiceLabel(gameNumber), gameNumber, number, newRollCountNumber, currentHeight, randomHash, GAMEFINISHED)
708- else storeGameProgressPointState(gameCurrentPointDiceLabel(gameNumber), gameNumber, number, newRollCountNumber, currentHeight, randomHash, GAMEINPROGRESS)
709- }
710- case _ =>
711- throw("No dices have been thrown")
712- }
713- }
714- case _ =>
715- throw("Last block doesn't exist.")
716- }
717- case _ =>
718- throw("SHA doesn't exist")
719- }
720- else throw("Throw dice not allow still waiting for block to process")
721- }
722- case _ =>
723- throw("Game does not exist or has already ended.")
724- }
725-
726-
727-@Verifier(tx)
728-func verify () = match tx {
729- case _ =>
730- sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey)
731-}
732200

github/deemru/w8io/873ac7e 
83.41 ms