tx · Bx6s2W9sv91RCp19DALgsMeR5t43NJQC1ZZzZ68Ju6aE 3NCCNgEjGtWKLt78jWc9DiA3Jd2jmfg7BZX: -0.10000000 Waves 2022.01.14 02:19 [1877836] smart account 3NCCNgEjGtWKLt78jWc9DiA3Jd2jmfg7BZX > SELF 0.00000000 Waves
{ "type": 13, "id": "Bx6s2W9sv91RCp19DALgsMeR5t43NJQC1ZZzZ68Ju6aE", "fee": 10000000, "feeAssetId": null, "timestamp": 1642115985188, "version": 2, "chainId": 84, "sender": "3NCCNgEjGtWKLt78jWc9DiA3Jd2jmfg7BZX", "senderPublicKey": "AcdhXSF5aWK6Lmdtv3cyCZ7vehbxsNNGagWCd2FpZo1M", "proofs": [ "Qj7FkmL5oXMfrYNznp35HjLnMWVYZNVXURBDz7My9qahzk6YZtdehRynWBWvW9RrkDzvUSdVBeHcmiJDvReqFVc" ], "script": "base64:AAIEAAAAAAAAACkIAhIFCgMBCAgSABIAEgUKAwEICBIECgIBARIHCgUBCAgICBIECgIBAQAAACIAAAAAE2dhbWVNYXN0ZXJQdWJsaWNLZXkBAAAAIIdjXkgFFtrkHsQ9EVCCVH0dcNZ4QrNMHlHueDDmJyUCAAAAAAlSU0FQVUJMSUMJAAJbAAAAAQIAAAGPYmFzZTY0Ok1JSUJJakFOQmdrcWhraUc5dzBCQVFFRkFBT0NBUThBTUlJQkNnS0NBUUVBeGk1enkxSDZUMnBReDdxZ01waDlzNy9XZzgxOXNvYjlBdlFzR3NjM0R6ejVaalRraHZOTFFQZjF3dFEralZDSVQ4U0FqZ1BWV1dQM1lJOG96R3pLVzQ5U3FMaWFTcW1VNUduNHBqUjlOWUlxc05ESm1YKzlHTXBGMWRlcm1QVjVIRVl4Qk1RMk5Ba01zV0ExWElZYy9hSWEwZi93VmdNZTIwOU1VTTJvVXd5RUtBMXFBRUptc1FrWENqSk9BQWtVUUhpNkhUeXVvUXFqdDVPWmxvUytpeDJ3Tnl5ZnRCajN3cE5nUTh3K0phSTZodGc3Tm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AAAAAFAAAAA25pbAAAAAEAAAACdHgBAAAABnZlcmlmeQAAAAAJAAH0AAAAAwgFAAAAAnR4AAAACWJvZHlCeXRlcwkAAZEAAAACCAUAAAACdHgAAAAGcHJvb2ZzAAAAAAAAAAAACAUAAAACdHgAAAAPc2VuZGVyUHVibGljS2V5yeXbeA==", "height": 1877836, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 9zgD8NoTc6ZJ1zbBFLpqNarUF5BXD7PenxGTucHDMARM Next: aor7LFVpHayLX9ZCExAuiPS5SXEm1MvkFMG2tmvqZr7 Diff:
Old | New | Differences | |
---|---|---|---|
1 | - | {-# STDLIB_VERSION | |
1 | + | {-# STDLIB_VERSION 4 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | - | let gameMasterPublicKey = base58' | |
4 | + | let gameMasterPublicKey = base58'A7VvRHtZro8bvGa9KAahiP9xovdKJ5hGsTjHLMa6nRPo' | |
5 | 5 | ||
6 | - | let RSAPUBLIC = fromBase64String("base64:MIIBIzANBgkqhkiG9w0BAQEFAAOCARAAMIIBCwKCAQIA+CpbzMBKpq+7VarSDHLW0wQSoh2LTbgl1rAhfruZGCjt6MO4o1v1iLqKyNH3FJsvwlLUqmqE7E2Wl7LbIPA26PxO2XCDfvj0OWp7cEJkUBEiyPYCn+iuPXUPwudoFgM4WHf0IPbDJ2O6OgzQlBBmNu6Owr7naITiJrPAvakPgAdmUPv4rOzcu6BR0T8GwszwprvwWZlKF6Ad00omLFDmx66HvBE51sRBiXIRbJnjDhlopize4LoR1FIrQaAu1sfs5bEHLA33jvKybne+IDawCsiINZYdPZV1WWcURC+XAFfBiYCw4PYyguxaBRHotzLc2dOsBV1HDNIjLKVoRknyt50CAwEAAQ==") | |
6 | + | let RSAPUBLIC = fromBase64String("base64:MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAxi5zy1H6T2pQx7qgMph9s7/Wg819sob9AvQsGsc3Dzz5ZjTkhvNLQPf1wtQ+jVCIT8SAjgPVWWP3YI8ozGzKW49SqLiaSqmU5Gn4pjR9NYIqsNDJmX+9GMpF1dermPV5HEYxBMQ2NAkMsWA1XIYc/aIa0f/wVgMe209MUM2oUwyEKA1qAEJmsQkXCjJOAAkUQHi6HTyuoQqjt5OZloS+ix2wNyyftBj3wpNgQ8w+JaI6htg7Nml7/NeoukuIdtUSz9nJi4asGco9jYr7q0tgVDQl6NlBHMN6CNJahpPZN/YNAb+CzAitZGlNcWIawLFec1fZOO8hbaHTuQ843j6jVQIDAQAB") | |
7 | + | ||
8 | + | let gameToken = base58'AJRyxpsv9Z4v46eg9b5TpnVXn3DteJYPHRJSbMckYPWw' | |
7 | 9 | ||
8 | 10 | let setupGamesCounterLabel = "G_SETUPGAMESCOUNTER" | |
9 | 11 | ||
13 | 15 | ||
14 | 16 | let gameMaxBetLabel = "G_MAXBET" | |
15 | 17 | ||
18 | + | let gameMinBetLabel = "G_MINBET" | |
19 | + | ||
20 | + | func gamesMaxBet () = getInteger(this, gameMaxBetLabel) | |
21 | + | ||
22 | + | ||
23 | + | func gamesMinBet () = getInteger(this, gameMinBetLabel) | |
24 | + | ||
25 | + | ||
16 | 26 | func gamesSetupGetCounter () = getInteger(this, setupGamesCounterLabel) | |
17 | 27 | ||
18 | 28 | ||
19 | 29 | func gamesUsedGetCounter () = getInteger(this, usedGamesCounterLabel) | |
20 | 30 | ||
21 | 31 | ||
32 | + | func getDealerQueue () = getString(this, dealerQueueLabel) | |
33 | + | ||
34 | + | ||
22 | 35 | func checkPermission (callerPublicKey) = (callerPublicKey != gameMasterPublicKey) | |
23 | 36 | ||
24 | 37 | ||
38 | + | func getGameBetAmountLabel (gameNumber) = (("G_" + toString(gameNumber)) + "_BETAMOUNT") | |
39 | + | ||
40 | + | ||
41 | + | func getGameTieAmountLabel (gameNumber) = (("G_" + toString(gameNumber)) + "_TIEAMOUNT") | |
42 | + | ||
43 | + | ||
44 | + | func getGamePlayerLabel (gameNumber) = (("G_" + toString(gameNumber)) + "_PLAYER") | |
45 | + | ||
46 | + | ||
47 | + | func getGamePayoutLabel (gameNumber) = (("G_" + toString(gameNumber)) + "_PAYOUT") | |
48 | + | ||
49 | + | ||
50 | + | func getGameStateLabel (gameNumber) = (("G_" + toString(gameNumber)) + "_STATE") | |
51 | + | ||
52 | + | ||
53 | + | func getGameShuffelOffesetLabel (gameNumber) = (("G_" + toString(gameNumber)) + "_OFFSET") | |
54 | + | ||
55 | + | ||
25 | 56 | func getGameCardsSignatureLabel (gameNumber,card) = ((("G_" + toString(gameNumber)) + "_CARDSIGNATURE_") + toString(card)) | |
57 | + | ||
58 | + | ||
59 | + | func getPlayerCurrentGameLabel (address) = (("P_" + address) + "_CURRENTGAME") | |
60 | + | ||
61 | + | ||
62 | + | func getPlayerCurrentGame (address) = getInteger(this, getPlayerCurrentGameLabel(address)) | |
63 | + | ||
64 | + | ||
65 | + | func getGameBetAmount (gameNumber) = getInteger(this, getGameBetAmountLabel(gameNumber)) | |
66 | + | ||
67 | + | ||
68 | + | func getGameTieAmount (gameNumber) = getInteger(this, getGameTieAmountLabel(gameNumber)) | |
69 | + | ||
70 | + | ||
71 | + | func getGameState (gameNumber) = getInteger(this, getGameStateLabel(gameNumber)) | |
72 | + | ||
73 | + | ||
74 | + | func getGamePlayer (gameNumber) = getString(this, getGamePlayerLabel(gameNumber)) | |
26 | 75 | ||
27 | 76 | ||
28 | 77 | func getGameCardsSignature (gameNumber,card) = getString(this, getGameCardsSignatureLabel(gameNumber, card)) | |
31 | 80 | func getGameCardsLabel (gameNumber,card) = ((("G_" + toString(gameNumber)) + "_CARD_") + toString(card)) | |
32 | 81 | ||
33 | 82 | ||
34 | - | func getGameStateLabel (gameNumber) = (("G_" + toString(gameNumber)) + "_STATE") | |
35 | - | ||
36 | - | ||
37 | - | func getGameShuffelOffesetLabel (gameNumber) = (("G_" + toString(gameNumber)) + "_OFFSET") | |
38 | - | ||
39 | - | ||
40 | 83 | func getGameSetup (gameNumber,randomizer,cards0,cards1,cards2,cards3) = [IntegerEntry(setupGamesCounterLabel, gameNumber), IntegerEntry(getGameStateLabel(gameNumber), 0), IntegerEntry(getGameShuffelOffesetLabel(gameNumber), randomizer), StringEntry(getGameCardsSignatureLabel(gameNumber, 0), cards0), StringEntry(getGameCardsSignatureLabel(gameNumber, 1), cards1), StringEntry(getGameCardsSignatureLabel(gameNumber, 2), cards2), StringEntry(getGameCardsSignatureLabel(gameNumber, 3), cards3)] | |
41 | 84 | ||
42 | 85 | ||
86 | + | func createGameMetadata (address,betAmount,tieAmount) = { | |
87 | + | let gameToReserve = (value(gamesUsedGetCounter()) + 1) | |
88 | + | let dealerQueue = value(getDealerQueue()) | |
89 | + | [IntegerEntry(usedGamesCounterLabel, gameToReserve), IntegerEntry(getPlayerCurrentGameLabel(address), gameToReserve), IntegerEntry(getGameStateLabel(gameToReserve), 1), IntegerEntry(getGameBetAmountLabel(gameToReserve), betAmount), IntegerEntry(getGameTieAmountLabel(gameToReserve), tieAmount), StringEntry(dealerQueueLabel, ((value(getDealerQueue()) + ",") + toString(gameToReserve))), StringEntry(getGamePlayerLabel(gameToReserve), address)] | |
90 | + | } | |
91 | + | ||
92 | + | ||
93 | + | func getCardValue (stringCard) = parseIntValue(take(stringCard, 2)) | |
94 | + | ||
95 | + | ||
96 | + | func getPayments (i) = if ((size(i.payments) == 0)) | |
97 | + | then throw("Payment must be attached") | |
98 | + | else if ((size(i.payments) == 1)) | |
99 | + | then { | |
100 | + | let pmt = i.payments[0] | |
101 | + | pmt.amount | |
102 | + | } | |
103 | + | else throw("There should be only one payment") | |
104 | + | ||
105 | + | ||
106 | + | func verifyCard (card,gameNumber,cardNumber) = rsaVerify_16Kb(SHA256, toBytes(card), fromBase64String(split(value(getGameCardsSignature(gameNumber, cardNumber)), " ")[0]), RSAPUBLIC) | |
107 | + | ||
108 | + | ||
43 | 109 | @Callable(i) | |
44 | - | func verifyCard (card,gameNumber,cardNumber) = { | |
45 | - | let t = rsaVerify_16Kb(SHA256, toBytes(card), fromBase64String(split(value(getGameCardsSignature(gameNumber, cardNumber)), " ")[0]), RSAPUBLIC) | |
46 | - | throw(toString(t)) | |
110 | + | func revealRound2 (currentGame,card2,card3) = if (checkPermission(i.callerPublicKey)) | |
111 | + | then throw("revealRound2_FORBBIDEN") | |
112 | + | else { | |
113 | + | let dealerQueue = value(getDealerQueue()) | |
114 | + | let nextGameToProcess = split(dealerQueue, ",")[1] | |
115 | + | if ((nextGameToProcess == toString(currentGame))) | |
116 | + | then if (if (if ((value(getGameState(currentGame)) == 3)) | |
117 | + | then verifyCard(card2, currentGame, 2) | |
118 | + | else false) | |
119 | + | then verifyCard(card3, currentGame, 3) | |
120 | + | else false) | |
121 | + | then { | |
122 | + | let cardPlayer = getCardValue(split(card2, "+")[2]) | |
123 | + | let cardCasino = getCardValue(split(card3, "+")[2]) | |
124 | + | if ((cardPlayer >= cardCasino)) | |
125 | + | then { | |
126 | + | let normalBet = value(getGameBetAmount(currentGame)) | |
127 | + | let address = value(addressFromString(value(getGamePlayer(currentGame)))) | |
128 | + | [StringEntry(getGameCardsLabel(currentGame, 2), card2), StringEntry(getGameCardsLabel(currentGame, 3), card3), IntegerEntry(getGameStateLabel(currentGame), 6), StringEntry(dealerQueueLabel, takeRight(dealerQueue, (size(dealerQueue) - (1 + size(toString(currentGame)))))), ScriptTransfer(address, ((normalBet * 2) + (normalBet - i.fee)), unit)] | |
129 | + | } | |
130 | + | else [StringEntry(getGameCardsLabel(currentGame, 2), card2), StringEntry(getGameCardsLabel(currentGame, 3), card3), IntegerEntry(getGameStateLabel(currentGame), 6), StringEntry(dealerQueueLabel, takeRight(dealerQueue, (size(dealerQueue) - (1 + size(toString(currentGame))))))] | |
131 | + | } | |
132 | + | else throw("One of the cards failed to be verified or game is not in state 1.") | |
133 | + | else throw(("The next game to process is " + nextGameToProcess)) | |
134 | + | } | |
135 | + | ||
136 | + | ||
137 | + | ||
138 | + | @Callable(i) | |
139 | + | func war () = { | |
140 | + | let address = toBase58String(i.caller.bytes) | |
141 | + | let currentGame = value(getPlayerCurrentGame(address)) | |
142 | + | if ((value(getGameState(currentGame)) != 2)) | |
143 | + | then throw("Game is not in correct state.") | |
144 | + | else { | |
145 | + | let betAmount = value(getGameBetAmount(currentGame)) | |
146 | + | let p = getPayments(i) | |
147 | + | if (((p + i.fee) != betAmount)) | |
148 | + | then throw((("Payment must me same as the original bet (" + toString(betAmount)) + ")")) | |
149 | + | else [IntegerEntry(getGameStateLabel(currentGame), 3), StringEntry(dealerQueueLabel, ((value(getDealerQueue()) + ",") + toString(currentGame)))] | |
150 | + | } | |
47 | 151 | } | |
48 | 152 | ||
49 | 153 | ||
50 | 154 | ||
51 | 155 | @Callable(i) | |
52 | - | func initGame () = if (checkPermission(i.callerPublicKey)) | |
53 | - | then throw("initGame_FORBBIDEN") | |
54 | - | else match gamesSetupGetCounter() { | |
55 | - | case GAMESCOUNTER: Int => | |
56 | - | throw("INIT_ALREADY_DONE") | |
57 | - | case _ => | |
58 | - | [IntegerEntry(setupGamesCounterLabel, 0), IntegerEntry(usedGamesCounterLabel, 0), IntegerEntry(gameMaxBetLabel, 100000000), StringEntry(dealerQueueLabel, "")] | |
156 | + | func surrender () = { | |
157 | + | let address = toBase58String(i.caller.bytes) | |
158 | + | let currentGame = value(getPlayerCurrentGame(address)) | |
159 | + | if ((value(getGameState(currentGame)) != 2)) | |
160 | + | then throw("Game is not in correct state.") | |
161 | + | else { | |
162 | + | let betAmount = value(getGameBetAmount(currentGame)) | |
163 | + | let dealerQueue = value(getDealerQueue()) | |
164 | + | [IntegerEntry(getGameStateLabel(currentGame), 5), ScriptTransfer(i.caller, (betAmount / 2), unit)] | |
165 | + | } | |
59 | 166 | } | |
60 | 167 | ||
61 | 168 | ||
62 | 169 | ||
63 | 170 | @Callable(i) | |
64 | - | func setupGame (gameNumber,cards0,cards1,cards2,cards3) = if (checkPermission(i.callerPublicKey)) | |
65 | - | then throw("setupGame_FORBIDEN") | |
171 | + | func revealRound1 (currentGame,card0,card1) = if (checkPermission(i.callerPublicKey)) | |
172 | + | then throw("revealRound1_FORBBIDEN") | |
173 | + | else { | |
174 | + | let dealerQueue = value(getDealerQueue()) | |
175 | + | let nextGameToProcess = split(dealerQueue, ",")[1] | |
176 | + | if ((nextGameToProcess == toString(currentGame))) | |
177 | + | then if (if (if ((value(getGameState(currentGame)) == 1)) | |
178 | + | then verifyCard(card0, currentGame, 0) | |
179 | + | else false) | |
180 | + | then verifyCard(card1, currentGame, 1) | |
181 | + | else false) | |
182 | + | then { | |
183 | + | let cardPlayer = getCardValue(split(card0, "+")[2]) | |
184 | + | let cardCasino = getCardValue(split(card1, "+")[2]) | |
185 | + | if ((cardPlayer == cardCasino)) | |
186 | + | then { | |
187 | + | let tieBet = value(getGameTieAmount(currentGame)) | |
188 | + | let address = value(addressFromString(value(getGamePlayer(currentGame)))) | |
189 | + | if ((tieBet != 0)) | |
190 | + | then [StringEntry(getGameCardsLabel(currentGame, 0), card0), StringEntry(getGameCardsLabel(currentGame, 1), card1), IntegerEntry(getGameStateLabel(currentGame), 2), StringEntry(dealerQueueLabel, takeRight(dealerQueue, (size(dealerQueue) - (1 + size(toString(currentGame)))))), ScriptTransfer(address, ((tieBet * 10) + tieBet), unit)] | |
191 | + | else [StringEntry(getGameCardsLabel(currentGame, 0), card0), StringEntry(getGameCardsLabel(currentGame, 1), card1), IntegerEntry(getGameStateLabel(currentGame), 2), StringEntry(dealerQueueLabel, takeRight(dealerQueue, (size(dealerQueue) - (1 + size(toString(currentGame))))))] | |
192 | + | } | |
193 | + | else if ((cardPlayer > cardCasino)) | |
194 | + | then { | |
195 | + | let normalBet = value(getGameBetAmount(currentGame)) | |
196 | + | let address = value(addressFromString(value(getGamePlayer(currentGame)))) | |
197 | + | [StringEntry(getGameCardsLabel(currentGame, 0), card0), StringEntry(getGameCardsLabel(currentGame, 1), card1), IntegerEntry(getGameStateLabel(currentGame), 4), StringEntry(dealerQueueLabel, takeRight(dealerQueue, (size(dealerQueue) - (1 + size(toString(currentGame)))))), ScriptTransfer(address, normalBet, unit)] | |
198 | + | } | |
199 | + | else [StringEntry(getGameCardsLabel(currentGame, 0), card0), StringEntry(getGameCardsLabel(currentGame, 1), card1), IntegerEntry(getGameStateLabel(currentGame), 4), StringEntry(dealerQueueLabel, takeRight(dealerQueue, (size(dealerQueue) - (1 + size(toString(currentGame))))))] | |
200 | + | } | |
201 | + | else throw("One of the cards failed to be verified or game is not in state 1.") | |
202 | + | else throw(("The next game to process is " + nextGameToProcess)) | |
203 | + | } | |
204 | + | ||
205 | + | ||
206 | + | ||
207 | + | @Callable(i) | |
208 | + | func bet (normalBet,tieBet) = { | |
209 | + | let callerAddress = toBase58String(i.caller.bytes) | |
210 | + | let p = getPayments(i) | |
211 | + | let betAmount = (normalBet + i.fee) | |
212 | + | let tieAmount = tieBet | |
213 | + | let address = toBase58String(i.caller.bytes) | |
214 | + | if ((p != (normalBet + tieBet))) | |
215 | + | then throw("normal bet + tie bet should be equal to the payment") | |
216 | + | else if (if ((value(gamesMinBet()) > p)) | |
217 | + | then true | |
218 | + | else (p > value(gamesMaxBet()))) | |
219 | + | then throw((((("Payment needs to be in the following interval [" + toString(value(gamesMinBet()))) + " ") + toString(value(gamesMaxBet()))) + "]")) | |
220 | + | else if ((value(gamesUsedGetCounter()) >= value(gamesSetupGetCounter()))) | |
221 | + | then throw("No available set up games to use.") | |
222 | + | else match getPlayerCurrentGame(address) { | |
223 | + | case CURRENTGAME: Int => | |
224 | + | if ((4 > value(getGameState(CURRENTGAME)))) | |
225 | + | then throw((("Game " + toString(CURRENTGAME)) + " is still in progress.")) | |
226 | + | else createGameMetadata(address, betAmount, tieAmount) | |
227 | + | case _: Unit => | |
228 | + | createGameMetadata(address, betAmount, tieAmount) | |
229 | + | case _ => | |
230 | + | throw("Match error") | |
231 | + | } | |
232 | + | } | |
233 | + | ||
234 | + | ||
235 | + | ||
236 | + | @Callable(i) | |
237 | + | func setupGame (gameNumber,card0,card1,card2,card3) = if (checkPermission(i.callerPublicKey)) | |
238 | + | then throw("setupGame_FORBBIDEN") | |
66 | 239 | else match gamesSetupGetCounter() { | |
67 | 240 | case SETUPGAMESCOUNTER: Int => | |
68 | 241 | let randomizer = (toInt(sha256((take(lastBlock.generationSignature, 16) + take(i.transactionId, 16)))) % 2) | |
69 | 242 | let currentGame = (SETUPGAMESCOUNTER + 1) | |
70 | 243 | if ((gameNumber != currentGame)) | |
71 | 244 | then throw("Wrong game number.") | |
72 | - | else getGameSetup(currentGame, randomizer, cards0, cards1, cards2, cards3) | |
245 | + | else if (((randomizer % 2) == 1)) | |
246 | + | then getGameSetup(currentGame, randomizer, card3, card2, card1, card0) | |
247 | + | else getGameSetup(currentGame, randomizer, card0, card1, card2, card3) | |
73 | 248 | case _ => | |
74 | 249 | throw("InitGame Required") | |
250 | + | } | |
251 | + | ||
252 | + | ||
253 | + | ||
254 | + | @Callable(i) | |
255 | + | func initGame (maxBet,minBet) = if (checkPermission(i.callerPublicKey)) | |
256 | + | then throw("initGame_FORBBIDEN") | |
257 | + | else match gamesSetupGetCounter() { | |
258 | + | case GAMESCOUNTER: Int => | |
259 | + | throw("INIT_ALREADY_DONE") | |
260 | + | case _ => | |
261 | + | [IntegerEntry(setupGamesCounterLabel, 0), IntegerEntry(usedGamesCounterLabel, 0), IntegerEntry(gameMaxBetLabel, maxBet), IntegerEntry(gameMinBetLabel, minBet), StringEntry(dealerQueueLabel, "")] | |
75 | 262 | } | |
76 | 263 | ||
77 | 264 |
Old | New | Differences | |
---|---|---|---|
1 | - | {-# STDLIB_VERSION | |
1 | + | {-# STDLIB_VERSION 4 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | - | let gameMasterPublicKey = base58' | |
4 | + | let gameMasterPublicKey = base58'A7VvRHtZro8bvGa9KAahiP9xovdKJ5hGsTjHLMa6nRPo' | |
5 | 5 | ||
6 | - | let RSAPUBLIC = fromBase64String("base64:MIIBIzANBgkqhkiG9w0BAQEFAAOCARAAMIIBCwKCAQIA+CpbzMBKpq+7VarSDHLW0wQSoh2LTbgl1rAhfruZGCjt6MO4o1v1iLqKyNH3FJsvwlLUqmqE7E2Wl7LbIPA26PxO2XCDfvj0OWp7cEJkUBEiyPYCn+iuPXUPwudoFgM4WHf0IPbDJ2O6OgzQlBBmNu6Owr7naITiJrPAvakPgAdmUPv4rOzcu6BR0T8GwszwprvwWZlKF6Ad00omLFDmx66HvBE51sRBiXIRbJnjDhlopize4LoR1FIrQaAu1sfs5bEHLA33jvKybne+IDawCsiINZYdPZV1WWcURC+XAFfBiYCw4PYyguxaBRHotzLc2dOsBV1HDNIjLKVoRknyt50CAwEAAQ==") | |
6 | + | let RSAPUBLIC = fromBase64String("base64:MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAxi5zy1H6T2pQx7qgMph9s7/Wg819sob9AvQsGsc3Dzz5ZjTkhvNLQPf1wtQ+jVCIT8SAjgPVWWP3YI8ozGzKW49SqLiaSqmU5Gn4pjR9NYIqsNDJmX+9GMpF1dermPV5HEYxBMQ2NAkMsWA1XIYc/aIa0f/wVgMe209MUM2oUwyEKA1qAEJmsQkXCjJOAAkUQHi6HTyuoQqjt5OZloS+ix2wNyyftBj3wpNgQ8w+JaI6htg7Nml7/NeoukuIdtUSz9nJi4asGco9jYr7q0tgVDQl6NlBHMN6CNJahpPZN/YNAb+CzAitZGlNcWIawLFec1fZOO8hbaHTuQ843j6jVQIDAQAB") | |
7 | + | ||
8 | + | let gameToken = base58'AJRyxpsv9Z4v46eg9b5TpnVXn3DteJYPHRJSbMckYPWw' | |
7 | 9 | ||
8 | 10 | let setupGamesCounterLabel = "G_SETUPGAMESCOUNTER" | |
9 | 11 | ||
10 | 12 | let usedGamesCounterLabel = "G_USEDGAMESCOUNTER" | |
11 | 13 | ||
12 | 14 | let dealerQueueLabel = "G_DEALERQUEUE" | |
13 | 15 | ||
14 | 16 | let gameMaxBetLabel = "G_MAXBET" | |
15 | 17 | ||
18 | + | let gameMinBetLabel = "G_MINBET" | |
19 | + | ||
20 | + | func gamesMaxBet () = getInteger(this, gameMaxBetLabel) | |
21 | + | ||
22 | + | ||
23 | + | func gamesMinBet () = getInteger(this, gameMinBetLabel) | |
24 | + | ||
25 | + | ||
16 | 26 | func gamesSetupGetCounter () = getInteger(this, setupGamesCounterLabel) | |
17 | 27 | ||
18 | 28 | ||
19 | 29 | func gamesUsedGetCounter () = getInteger(this, usedGamesCounterLabel) | |
20 | 30 | ||
21 | 31 | ||
32 | + | func getDealerQueue () = getString(this, dealerQueueLabel) | |
33 | + | ||
34 | + | ||
22 | 35 | func checkPermission (callerPublicKey) = (callerPublicKey != gameMasterPublicKey) | |
23 | 36 | ||
24 | 37 | ||
38 | + | func getGameBetAmountLabel (gameNumber) = (("G_" + toString(gameNumber)) + "_BETAMOUNT") | |
39 | + | ||
40 | + | ||
41 | + | func getGameTieAmountLabel (gameNumber) = (("G_" + toString(gameNumber)) + "_TIEAMOUNT") | |
42 | + | ||
43 | + | ||
44 | + | func getGamePlayerLabel (gameNumber) = (("G_" + toString(gameNumber)) + "_PLAYER") | |
45 | + | ||
46 | + | ||
47 | + | func getGamePayoutLabel (gameNumber) = (("G_" + toString(gameNumber)) + "_PAYOUT") | |
48 | + | ||
49 | + | ||
50 | + | func getGameStateLabel (gameNumber) = (("G_" + toString(gameNumber)) + "_STATE") | |
51 | + | ||
52 | + | ||
53 | + | func getGameShuffelOffesetLabel (gameNumber) = (("G_" + toString(gameNumber)) + "_OFFSET") | |
54 | + | ||
55 | + | ||
25 | 56 | func getGameCardsSignatureLabel (gameNumber,card) = ((("G_" + toString(gameNumber)) + "_CARDSIGNATURE_") + toString(card)) | |
57 | + | ||
58 | + | ||
59 | + | func getPlayerCurrentGameLabel (address) = (("P_" + address) + "_CURRENTGAME") | |
60 | + | ||
61 | + | ||
62 | + | func getPlayerCurrentGame (address) = getInteger(this, getPlayerCurrentGameLabel(address)) | |
63 | + | ||
64 | + | ||
65 | + | func getGameBetAmount (gameNumber) = getInteger(this, getGameBetAmountLabel(gameNumber)) | |
66 | + | ||
67 | + | ||
68 | + | func getGameTieAmount (gameNumber) = getInteger(this, getGameTieAmountLabel(gameNumber)) | |
69 | + | ||
70 | + | ||
71 | + | func getGameState (gameNumber) = getInteger(this, getGameStateLabel(gameNumber)) | |
72 | + | ||
73 | + | ||
74 | + | func getGamePlayer (gameNumber) = getString(this, getGamePlayerLabel(gameNumber)) | |
26 | 75 | ||
27 | 76 | ||
28 | 77 | func getGameCardsSignature (gameNumber,card) = getString(this, getGameCardsSignatureLabel(gameNumber, card)) | |
29 | 78 | ||
30 | 79 | ||
31 | 80 | func getGameCardsLabel (gameNumber,card) = ((("G_" + toString(gameNumber)) + "_CARD_") + toString(card)) | |
32 | 81 | ||
33 | 82 | ||
34 | - | func getGameStateLabel (gameNumber) = (("G_" + toString(gameNumber)) + "_STATE") | |
35 | - | ||
36 | - | ||
37 | - | func getGameShuffelOffesetLabel (gameNumber) = (("G_" + toString(gameNumber)) + "_OFFSET") | |
38 | - | ||
39 | - | ||
40 | 83 | func getGameSetup (gameNumber,randomizer,cards0,cards1,cards2,cards3) = [IntegerEntry(setupGamesCounterLabel, gameNumber), IntegerEntry(getGameStateLabel(gameNumber), 0), IntegerEntry(getGameShuffelOffesetLabel(gameNumber), randomizer), StringEntry(getGameCardsSignatureLabel(gameNumber, 0), cards0), StringEntry(getGameCardsSignatureLabel(gameNumber, 1), cards1), StringEntry(getGameCardsSignatureLabel(gameNumber, 2), cards2), StringEntry(getGameCardsSignatureLabel(gameNumber, 3), cards3)] | |
41 | 84 | ||
42 | 85 | ||
86 | + | func createGameMetadata (address,betAmount,tieAmount) = { | |
87 | + | let gameToReserve = (value(gamesUsedGetCounter()) + 1) | |
88 | + | let dealerQueue = value(getDealerQueue()) | |
89 | + | [IntegerEntry(usedGamesCounterLabel, gameToReserve), IntegerEntry(getPlayerCurrentGameLabel(address), gameToReserve), IntegerEntry(getGameStateLabel(gameToReserve), 1), IntegerEntry(getGameBetAmountLabel(gameToReserve), betAmount), IntegerEntry(getGameTieAmountLabel(gameToReserve), tieAmount), StringEntry(dealerQueueLabel, ((value(getDealerQueue()) + ",") + toString(gameToReserve))), StringEntry(getGamePlayerLabel(gameToReserve), address)] | |
90 | + | } | |
91 | + | ||
92 | + | ||
93 | + | func getCardValue (stringCard) = parseIntValue(take(stringCard, 2)) | |
94 | + | ||
95 | + | ||
96 | + | func getPayments (i) = if ((size(i.payments) == 0)) | |
97 | + | then throw("Payment must be attached") | |
98 | + | else if ((size(i.payments) == 1)) | |
99 | + | then { | |
100 | + | let pmt = i.payments[0] | |
101 | + | pmt.amount | |
102 | + | } | |
103 | + | else throw("There should be only one payment") | |
104 | + | ||
105 | + | ||
106 | + | func verifyCard (card,gameNumber,cardNumber) = rsaVerify_16Kb(SHA256, toBytes(card), fromBase64String(split(value(getGameCardsSignature(gameNumber, cardNumber)), " ")[0]), RSAPUBLIC) | |
107 | + | ||
108 | + | ||
43 | 109 | @Callable(i) | |
44 | - | func verifyCard (card,gameNumber,cardNumber) = { | |
45 | - | let t = rsaVerify_16Kb(SHA256, toBytes(card), fromBase64String(split(value(getGameCardsSignature(gameNumber, cardNumber)), " ")[0]), RSAPUBLIC) | |
46 | - | throw(toString(t)) | |
110 | + | func revealRound2 (currentGame,card2,card3) = if (checkPermission(i.callerPublicKey)) | |
111 | + | then throw("revealRound2_FORBBIDEN") | |
112 | + | else { | |
113 | + | let dealerQueue = value(getDealerQueue()) | |
114 | + | let nextGameToProcess = split(dealerQueue, ",")[1] | |
115 | + | if ((nextGameToProcess == toString(currentGame))) | |
116 | + | then if (if (if ((value(getGameState(currentGame)) == 3)) | |
117 | + | then verifyCard(card2, currentGame, 2) | |
118 | + | else false) | |
119 | + | then verifyCard(card3, currentGame, 3) | |
120 | + | else false) | |
121 | + | then { | |
122 | + | let cardPlayer = getCardValue(split(card2, "+")[2]) | |
123 | + | let cardCasino = getCardValue(split(card3, "+")[2]) | |
124 | + | if ((cardPlayer >= cardCasino)) | |
125 | + | then { | |
126 | + | let normalBet = value(getGameBetAmount(currentGame)) | |
127 | + | let address = value(addressFromString(value(getGamePlayer(currentGame)))) | |
128 | + | [StringEntry(getGameCardsLabel(currentGame, 2), card2), StringEntry(getGameCardsLabel(currentGame, 3), card3), IntegerEntry(getGameStateLabel(currentGame), 6), StringEntry(dealerQueueLabel, takeRight(dealerQueue, (size(dealerQueue) - (1 + size(toString(currentGame)))))), ScriptTransfer(address, ((normalBet * 2) + (normalBet - i.fee)), unit)] | |
129 | + | } | |
130 | + | else [StringEntry(getGameCardsLabel(currentGame, 2), card2), StringEntry(getGameCardsLabel(currentGame, 3), card3), IntegerEntry(getGameStateLabel(currentGame), 6), StringEntry(dealerQueueLabel, takeRight(dealerQueue, (size(dealerQueue) - (1 + size(toString(currentGame))))))] | |
131 | + | } | |
132 | + | else throw("One of the cards failed to be verified or game is not in state 1.") | |
133 | + | else throw(("The next game to process is " + nextGameToProcess)) | |
134 | + | } | |
135 | + | ||
136 | + | ||
137 | + | ||
138 | + | @Callable(i) | |
139 | + | func war () = { | |
140 | + | let address = toBase58String(i.caller.bytes) | |
141 | + | let currentGame = value(getPlayerCurrentGame(address)) | |
142 | + | if ((value(getGameState(currentGame)) != 2)) | |
143 | + | then throw("Game is not in correct state.") | |
144 | + | else { | |
145 | + | let betAmount = value(getGameBetAmount(currentGame)) | |
146 | + | let p = getPayments(i) | |
147 | + | if (((p + i.fee) != betAmount)) | |
148 | + | then throw((("Payment must me same as the original bet (" + toString(betAmount)) + ")")) | |
149 | + | else [IntegerEntry(getGameStateLabel(currentGame), 3), StringEntry(dealerQueueLabel, ((value(getDealerQueue()) + ",") + toString(currentGame)))] | |
150 | + | } | |
47 | 151 | } | |
48 | 152 | ||
49 | 153 | ||
50 | 154 | ||
51 | 155 | @Callable(i) | |
52 | - | func initGame () = if (checkPermission(i.callerPublicKey)) | |
53 | - | then throw("initGame_FORBBIDEN") | |
54 | - | else match gamesSetupGetCounter() { | |
55 | - | case GAMESCOUNTER: Int => | |
56 | - | throw("INIT_ALREADY_DONE") | |
57 | - | case _ => | |
58 | - | [IntegerEntry(setupGamesCounterLabel, 0), IntegerEntry(usedGamesCounterLabel, 0), IntegerEntry(gameMaxBetLabel, 100000000), StringEntry(dealerQueueLabel, "")] | |
156 | + | func surrender () = { | |
157 | + | let address = toBase58String(i.caller.bytes) | |
158 | + | let currentGame = value(getPlayerCurrentGame(address)) | |
159 | + | if ((value(getGameState(currentGame)) != 2)) | |
160 | + | then throw("Game is not in correct state.") | |
161 | + | else { | |
162 | + | let betAmount = value(getGameBetAmount(currentGame)) | |
163 | + | let dealerQueue = value(getDealerQueue()) | |
164 | + | [IntegerEntry(getGameStateLabel(currentGame), 5), ScriptTransfer(i.caller, (betAmount / 2), unit)] | |
165 | + | } | |
59 | 166 | } | |
60 | 167 | ||
61 | 168 | ||
62 | 169 | ||
63 | 170 | @Callable(i) | |
64 | - | func setupGame (gameNumber,cards0,cards1,cards2,cards3) = if (checkPermission(i.callerPublicKey)) | |
65 | - | then throw("setupGame_FORBIDEN") | |
171 | + | func revealRound1 (currentGame,card0,card1) = if (checkPermission(i.callerPublicKey)) | |
172 | + | then throw("revealRound1_FORBBIDEN") | |
173 | + | else { | |
174 | + | let dealerQueue = value(getDealerQueue()) | |
175 | + | let nextGameToProcess = split(dealerQueue, ",")[1] | |
176 | + | if ((nextGameToProcess == toString(currentGame))) | |
177 | + | then if (if (if ((value(getGameState(currentGame)) == 1)) | |
178 | + | then verifyCard(card0, currentGame, 0) | |
179 | + | else false) | |
180 | + | then verifyCard(card1, currentGame, 1) | |
181 | + | else false) | |
182 | + | then { | |
183 | + | let cardPlayer = getCardValue(split(card0, "+")[2]) | |
184 | + | let cardCasino = getCardValue(split(card1, "+")[2]) | |
185 | + | if ((cardPlayer == cardCasino)) | |
186 | + | then { | |
187 | + | let tieBet = value(getGameTieAmount(currentGame)) | |
188 | + | let address = value(addressFromString(value(getGamePlayer(currentGame)))) | |
189 | + | if ((tieBet != 0)) | |
190 | + | then [StringEntry(getGameCardsLabel(currentGame, 0), card0), StringEntry(getGameCardsLabel(currentGame, 1), card1), IntegerEntry(getGameStateLabel(currentGame), 2), StringEntry(dealerQueueLabel, takeRight(dealerQueue, (size(dealerQueue) - (1 + size(toString(currentGame)))))), ScriptTransfer(address, ((tieBet * 10) + tieBet), unit)] | |
191 | + | else [StringEntry(getGameCardsLabel(currentGame, 0), card0), StringEntry(getGameCardsLabel(currentGame, 1), card1), IntegerEntry(getGameStateLabel(currentGame), 2), StringEntry(dealerQueueLabel, takeRight(dealerQueue, (size(dealerQueue) - (1 + size(toString(currentGame))))))] | |
192 | + | } | |
193 | + | else if ((cardPlayer > cardCasino)) | |
194 | + | then { | |
195 | + | let normalBet = value(getGameBetAmount(currentGame)) | |
196 | + | let address = value(addressFromString(value(getGamePlayer(currentGame)))) | |
197 | + | [StringEntry(getGameCardsLabel(currentGame, 0), card0), StringEntry(getGameCardsLabel(currentGame, 1), card1), IntegerEntry(getGameStateLabel(currentGame), 4), StringEntry(dealerQueueLabel, takeRight(dealerQueue, (size(dealerQueue) - (1 + size(toString(currentGame)))))), ScriptTransfer(address, normalBet, unit)] | |
198 | + | } | |
199 | + | else [StringEntry(getGameCardsLabel(currentGame, 0), card0), StringEntry(getGameCardsLabel(currentGame, 1), card1), IntegerEntry(getGameStateLabel(currentGame), 4), StringEntry(dealerQueueLabel, takeRight(dealerQueue, (size(dealerQueue) - (1 + size(toString(currentGame))))))] | |
200 | + | } | |
201 | + | else throw("One of the cards failed to be verified or game is not in state 1.") | |
202 | + | else throw(("The next game to process is " + nextGameToProcess)) | |
203 | + | } | |
204 | + | ||
205 | + | ||
206 | + | ||
207 | + | @Callable(i) | |
208 | + | func bet (normalBet,tieBet) = { | |
209 | + | let callerAddress = toBase58String(i.caller.bytes) | |
210 | + | let p = getPayments(i) | |
211 | + | let betAmount = (normalBet + i.fee) | |
212 | + | let tieAmount = tieBet | |
213 | + | let address = toBase58String(i.caller.bytes) | |
214 | + | if ((p != (normalBet + tieBet))) | |
215 | + | then throw("normal bet + tie bet should be equal to the payment") | |
216 | + | else if (if ((value(gamesMinBet()) > p)) | |
217 | + | then true | |
218 | + | else (p > value(gamesMaxBet()))) | |
219 | + | then throw((((("Payment needs to be in the following interval [" + toString(value(gamesMinBet()))) + " ") + toString(value(gamesMaxBet()))) + "]")) | |
220 | + | else if ((value(gamesUsedGetCounter()) >= value(gamesSetupGetCounter()))) | |
221 | + | then throw("No available set up games to use.") | |
222 | + | else match getPlayerCurrentGame(address) { | |
223 | + | case CURRENTGAME: Int => | |
224 | + | if ((4 > value(getGameState(CURRENTGAME)))) | |
225 | + | then throw((("Game " + toString(CURRENTGAME)) + " is still in progress.")) | |
226 | + | else createGameMetadata(address, betAmount, tieAmount) | |
227 | + | case _: Unit => | |
228 | + | createGameMetadata(address, betAmount, tieAmount) | |
229 | + | case _ => | |
230 | + | throw("Match error") | |
231 | + | } | |
232 | + | } | |
233 | + | ||
234 | + | ||
235 | + | ||
236 | + | @Callable(i) | |
237 | + | func setupGame (gameNumber,card0,card1,card2,card3) = if (checkPermission(i.callerPublicKey)) | |
238 | + | then throw("setupGame_FORBBIDEN") | |
66 | 239 | else match gamesSetupGetCounter() { | |
67 | 240 | case SETUPGAMESCOUNTER: Int => | |
68 | 241 | let randomizer = (toInt(sha256((take(lastBlock.generationSignature, 16) + take(i.transactionId, 16)))) % 2) | |
69 | 242 | let currentGame = (SETUPGAMESCOUNTER + 1) | |
70 | 243 | if ((gameNumber != currentGame)) | |
71 | 244 | then throw("Wrong game number.") | |
72 | - | else getGameSetup(currentGame, randomizer, cards0, cards1, cards2, cards3) | |
245 | + | else if (((randomizer % 2) == 1)) | |
246 | + | then getGameSetup(currentGame, randomizer, card3, card2, card1, card0) | |
247 | + | else getGameSetup(currentGame, randomizer, card0, card1, card2, card3) | |
73 | 248 | case _ => | |
74 | 249 | throw("InitGame Required") | |
250 | + | } | |
251 | + | ||
252 | + | ||
253 | + | ||
254 | + | @Callable(i) | |
255 | + | func initGame (maxBet,minBet) = if (checkPermission(i.callerPublicKey)) | |
256 | + | then throw("initGame_FORBBIDEN") | |
257 | + | else match gamesSetupGetCounter() { | |
258 | + | case GAMESCOUNTER: Int => | |
259 | + | throw("INIT_ALREADY_DONE") | |
260 | + | case _ => | |
261 | + | [IntegerEntry(setupGamesCounterLabel, 0), IntegerEntry(usedGamesCounterLabel, 0), IntegerEntry(gameMaxBetLabel, maxBet), IntegerEntry(gameMinBetLabel, minBet), StringEntry(dealerQueueLabel, "")] | |
75 | 262 | } | |
76 | 263 | ||
77 | 264 | ||
78 | 265 | @Verifier(tx) | |
79 | 266 | func verify () = sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey) | |
80 | 267 |
github/deemru/w8io/026f985 36.63 ms ◑