tx · A9CYWVzAXZK6d3siYTnguqjwG1yca73bNAdqaNSJ88uB 3MsGBnTzBhrNe6w1KpLYPkzdDdxWudm4U89: -0.01400000 Waves 2019.08.24 13:30 [645100] smart account 3MsGBnTzBhrNe6w1KpLYPkzdDdxWudm4U89 > SELF 0.00000000 Waves
{ "type": 13, "id": "A9CYWVzAXZK6d3siYTnguqjwG1yca73bNAdqaNSJ88uB", "fee": 1400000, "feeAssetId": null, "timestamp": 1566642633765, "version": 1, "sender": "3MsGBnTzBhrNe6w1KpLYPkzdDdxWudm4U89", "senderPublicKey": "FgbqvGasMMrXxbhwrsgEiCgJLjXPjgn8kHxsZiVmLrkb", "proofs": [ "2LdsgqnCgTegy69y57wt5jFK3nQM493mFHfNLUfASbBvsBpJa3H3zLLfyxFxfW9FhruNAY2EkTwWK8ic8jwwPBGe" ], "script": "base64:AAIDAAAAAAAAAAAAAAAsAAAAAAlSU0FQVUJMSUMJAAJbAAAAAQIAAAN0TFMwdExTMUNSVWRKVGlCRFJWSlVTVVpKUTBGVVJTMHRMUzB0Q2sxSlNVSjJWRU5EUVZOWlEwTlJSRFUxWms1Nll6QlhSamRVUVU1Q1oydHhhR3RwUnpsM01FSkJVVlZHUVVSQmFrMVJjM2REVVZsRVZsRlJSMFYzU2tzS1ZVUkZWVTFDU1VkQk1WVkZRMmhOVEUxRVFYUldSVlpVVmtNeFUxVXdSWGRJYUdOT1RWUkJkMDVVU1RSTlJFbDNUMFJWZUZkb1kwNU5ha0YzVGxSSk1RcE5SRWwzVDBSVmVGZHFRV3BOVVhOM1ExRlpSRlpSVVVkRmQwcExWVVJGVlUxQ1NVZEJNVlZGUTJoTlRFMUVRWFJXUlZaVVZrTXhVMVV3UlhkbldqaDNDa1JSV1VwTGIxcEphSFpqVGtGUlJVSkNVVUZFWjFrd1FVMUpSMHBCYjBkQ1FVNUhSVmxZZEdablJGSnNWMVZUUkc0emFHRlpORTVXVmxGcFMwazVRM29LVkdodmRXRTVLMFI0U25WcGMyVjVlb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FJlc2VydmVzBAAAAAdyYW5kSW50CQEAAAAPR2VuZXJhdGVSYW5kSW50AAAAAgUAAAAGZ2FtZUlkBQAAAAdyc2FTaWduBAAAAAdyYW5kU3RyCQEAAAAJUmFuZFRvU3RyAAAAAQUAAAAHcmFuZEludAMJAQAAAAtJc1BsYXllcldpbgAAAAIFAAAADHBsYXllckNob2ljZQUAAAAHcmFuZFN0cgQAAAAObmV3R2FtZURhdGFTdHIJAQAAABFGb3JtYXRHYW1lRGF0YVN0cgAAAAYFAAAACFNUQVRFV09OBQAAAAxwbGF5ZXJDaG9pY2UFAAAADnBsYXllclB1YktleTU4BQAAAA1zdGFydGVkSGVpZ2h0BQAAAAZ3aW5BbXQFAAAAB3JhbmRTdHIJAQAAAAxXaW5TY3JpcHRTZXQAAAAGBQAAAAZnYW1lSWQFAAAADXBsYXllckFkZHJlc3MFAAAABndpbkFtdAUAAAAObmV3R2FtZURhdGFTdHIFAAAADHdpbkJ5VGltZW91dAUAAAARZGVjcmVhc2VkUmVzZXJ2ZXMEAAAADm5ld0dhbWVEYXRhU3RyCQEAAAARRm9ybWF0R2FtZURhdGFTdHIAAAAGBQAAAAlTVEFURUxPU1QFAAAADHBsYXllckNob2ljZQUAAAAOcGxheWVyUHViS2V5NTgFAAAADXN0YXJ0ZWRIZWlnaHQFAAAABndpbkFtdAUAAAAHcmFuZFN0cgkBAAAACFdyaXRlU2V0AAAAAQkABEwAAAACCQEAAAAJRGF0YUVudHJ5AAAAAgUAAAAGZ2FtZUlkBQAAAA5uZXdHYW1lRGF0YVN0cgkABEwAAAACBQAAABFkZWNyZWFzZWRSZXNlcnZlcwUAAAADbmlsAAAAAGhSVSw=", "chainId": 84, "height": 645100, "spentComplexity": 0 } View: original | compacted Prev: GcHJTdZxhKzhVin24jFkp1fwVYt9ubJdnHdQnVDYSexi Next: CEfkDDCEVBTm83r1dci8usyHeSJRUvK6j2reM8puAWmq Diff:
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VER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ue("3NAPoUBwL7jaPW3ngVF3dT5b68q4eaHAiiC") | |
7 | 7 | ||
281 | 281 | ||
282 | 282 | @Callable(i) | |
283 | 283 | func bet (playerChoice) = { | |
284 | - | let bb = toBase64String(toBytes("-----BEGIN CERTIFICATE----- | |
285 | - | MIIBvTCCASYCCQD55fNzc0WF7TANBgkqhkiG9w0BAQUFADAjMQswCQYDVQQGEwJK | |
286 | - | UDEUMBIGA1UEChMLMDAtVEVTVC1SU0EwHhcNMTAwNTI4MDIwODUxWhcNMjAwNTI1 | |
287 | - | MDIwODUxWjAjMQswCQYDVQQGEwJKUDEUMBIGA1UEChMLMDAtVEVTVC1SU0EwgZ8w | |
288 | - | DQYJKoZIhvcNAQEBBQADgY0AMIGJAoGBANGEYXtfgDRlWUSDn3haY4NVVQiKI9Cz | |
289 | - | Thoua9+DxJuiseyzmBBe7Roh1RPqdvmtOHmEPbJ+kXZYhbozzPRbFGHCJyBfCLzQ | |
290 | - | fVos9/qUQ88u83b0SFA2MGmQWQAlRtLy66EkR4rDRwTj2DzR4EEXgEKpIvo8VBs/ | |
291 | - | 3+sHLF3ESgAhAgMBAAEwDQYJKoZIhvcNAQEFBQADgYEAEZ6mXFFq3AzfaqWHmCy1 | |
292 | - | ARjlauYAa8ZmUFnLm0emg9dkVBJ63aEqARhtok6bDQDzSJxiLpCEF6G4b/Nv/M/M | |
293 | - | LyhP+OoOTmETMegAVQMq71choVJyOFE5BtQa6M/lCHEOya5QUfoRF2HF9EjRF44K | |
294 | - | 3OK+u3ivTSj3zwjtpudY5Xo= | |
295 | - | -----END CERTIFICATE-----")) | |
296 | - | let RSAPUBLIC1 = fromBase64String(bb) | |
297 | - | throw(("PEM:" + toUtf8String(RSAPUBLIC1))) | |
284 | + | let newGameNum = IncrementGameNum() | |
285 | + | let gameId = toBase58String(i.transactionId) | |
286 | + | let pmt = extract(i.payment) | |
287 | + | let betNotInWaves = isDefined(pmt.assetId) | |
288 | + | let feeNotInWaves = isDefined(pmt.assetId) | |
289 | + | let winAmt = ValidateBetAndDefineWinAmt(pmt.amount, playerChoice) | |
290 | + | let txIdUsed = isDefined(getString(this, gameId)) | |
291 | + | if (betNotInWaves) | |
292 | + | then throw("Bet amount must be in Waves") | |
293 | + | else if (feeNotInWaves) | |
294 | + | then throw("Transaction's fee must be in Waves") | |
295 | + | else if (txIdUsed) | |
296 | + | then throw("Passed txId had been used before. Game aborted.") | |
297 | + | else { | |
298 | + | let playerPubKey58 = toBase58String(i.callerPublicKey) | |
299 | + | let gameDataStr = FormatGameDataStr(STATESUBMITTED, playerChoice, playerPubKey58, height, winAmt, "") | |
300 | + | let readableGameData = ((((((((STATESUBMITTED + "_") + playerChoice) + "_") + playerPubKey58) + "_") + toString(height)) + "_") + toString(winAmt)) | |
301 | + | let serverTransfer = [ScriptTransfer(SERVER, COMMISSION, unit)] | |
302 | + | let betData = [DataEntry(RESERVATIONKEY, ValidateAndIncreaseReservedAmt(winAmt)), DataEntry(GAMESCOUNTERKEY, newGameNum), DataEntry(gameId, gameDataStr)] | |
303 | + | ScriptResult(WriteSet(betData), TransferSet(serverTransfer)) | |
304 | + | } | |
298 | 305 | } | |
299 | 306 | ||
300 | 307 |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 3 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | - | let RSAPUBLIC = fromBase64String(" | |
4 | + | let RSAPUBLIC = fromBase64String("LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCk1JSUJ2VENDQVNZQ0NRRDU1Zk56YzBXRjdUQU5CZ2txaGtpRzl3MEJBUVVGQURBak1Rc3dDUVlEVlFRR0V3SksKVURFVU1CSUdBMVVFQ2hNTE1EQXRWRVZUVkMxU1UwRXdIaGNOTVRBd05USTRNREl3T0RVeFdoY05NakF3TlRJMQpNREl3T0RVeFdqQWpNUXN3Q1FZRFZRUUdFd0pLVURFVU1CSUdBMVVFQ2hNTE1EQXRWRVZUVkMxU1UwRXdnWjh3CkRRWUpLb1pJaHZjTkFRRUJCUUFEZ1kwQU1JR0pBb0dCQU5HRVlYdGZnRFJsV1VTRG4zaGFZNE5WVlFpS0k5Q3oKVGhvdWE5K0R4SnVpc2V5em1CQmU3Um9oMVJQcWR2bXRPSG1FUGJKK2tYWlloYm96elBSYkZHSENKeUJmQ0x6UQpmVm9zOS9xVVE4OHU4M2IwU0ZBMk1HbVFXUUFsUnRMeTY2RWtSNHJEUndUajJEelI0RUVYZ0VLcEl2bzhWQnMvCjMrc0hMRjNFU2dBaEFnTUJBQUV3RFFZSktvWklodmNOQVFFRkJRQURnWUVBRVo2bVhGRnEzQXpmYXFXSG1DeTEKQVJqbGF1WUFhOFptVUZuTG0wZW1nOWRrVkJKNjNhRXFBUmh0b2s2YkRRRHpTSnhpTHBDRUY2RzRiL052L00vTQpMeWhQK09vT1RtRVRNZWdBVlFNcTcxY2hvVkp5T0ZFNUJ0UWE2TS9sQ0hFT3lhNVFVZm9SRjJIRjlFalJGNDRLCjNPSyt1M2l2VFNqM3p3anRwdWRZNVhvPQotLS0tLUVORCBDRVJUSUZJQ0FURS0tLS0t") | |
5 | 5 | ||
6 | 6 | let SERVER = addressFromStringValue("3NAPoUBwL7jaPW3ngVF3dT5b68q4eaHAiiC") | |
7 | 7 | ||
8 | 8 | let RANDORACLETIMEFRAME = 4320 | |
9 | 9 | ||
10 | 10 | let WAVELET = ((100 * 1000) * 1000) | |
11 | 11 | ||
12 | 12 | let COMMISSION = ((9 * WAVELET) / 1000) | |
13 | 13 | ||
14 | 14 | let BET1 = (1 * WAVELET) | |
15 | 15 | ||
16 | 16 | let BET2 = (2 * WAVELET) | |
17 | 17 | ||
18 | 18 | let BET4 = (4 * WAVELET) | |
19 | 19 | ||
20 | 20 | let BET8 = (8 * WAVELET) | |
21 | 21 | ||
22 | 22 | let BET14 = (14 * WAVELET) | |
23 | 23 | ||
24 | 24 | let RATEMULT = 10000 | |
25 | 25 | ||
26 | 26 | let RATE1 = 39655 | |
27 | 27 | ||
28 | 28 | let RATE2 = 24600 | |
29 | 29 | ||
30 | 30 | let RATE3 = 19000 | |
31 | 31 | ||
32 | 32 | let RATE4 = 14200 | |
33 | 33 | ||
34 | 34 | let RATE5 = 11400 | |
35 | 35 | ||
36 | 36 | let IdxGameState = 0 | |
37 | 37 | ||
38 | 38 | let IdxPlayerChoice = 1 | |
39 | 39 | ||
40 | 40 | let IdxPlayerPubKey58 = 2 | |
41 | 41 | ||
42 | 42 | let IdxStartedHeight = 3 | |
43 | 43 | ||
44 | 44 | let IdxWinAmt = 4 | |
45 | 45 | ||
46 | 46 | let IdxRandOrEmpty = 5 | |
47 | 47 | ||
48 | 48 | let GAMESCOUNTERKEY = "$GAME_NUM" | |
49 | 49 | ||
50 | 50 | let RESERVATIONKEY = "$RESERVED_AMOUNT" | |
51 | 51 | ||
52 | 52 | let STATESUBMITTED = "SUBMITTED" | |
53 | 53 | ||
54 | 54 | let STATEWON = "WON" | |
55 | 55 | ||
56 | 56 | let STATELOST = "LOST" | |
57 | 57 | ||
58 | 58 | func getAnswer (playerChoice) = BET14 | |
59 | 59 | ||
60 | 60 | ||
61 | 61 | func GenerateRandInt (gameId,rsaSign) = { | |
62 | 62 | let rsaSigValid = rsaVerify(SHA256, toBytes(gameId), rsaSign, RSAPUBLIC) | |
63 | 63 | if (rsaSigValid) | |
64 | 64 | then { | |
65 | 65 | let rand = (toInt(sha256(rsaSign)) % 6) | |
66 | 66 | if ((0 > rand)) | |
67 | 67 | then ((-1 * rand) + 1) | |
68 | 68 | else (rand + 1) | |
69 | 69 | } | |
70 | 70 | else throw("Invalid RSA signature") | |
71 | 71 | } | |
72 | 72 | ||
73 | 73 | ||
74 | 74 | func RemoveUnderscoreIfPresent (remaining) = if ((size(remaining) > 0)) | |
75 | 75 | then drop(remaining, 1) | |
76 | 76 | else remaining | |
77 | 77 | ||
78 | 78 | ||
79 | 79 | func ParseNextAttribute (remaining) = { | |
80 | 80 | let s = size(remaining) | |
81 | 81 | if ((s > 0)) | |
82 | 82 | then { | |
83 | 83 | let nn = parseIntValue(take(remaining, 2)) | |
84 | 84 | let v = take(drop(remaining, 2), nn) | |
85 | 85 | let tmpRemaining = drop(remaining, (nn + 2)) | |
86 | 86 | let remainingState = RemoveUnderscoreIfPresent(tmpRemaining) | |
87 | 87 | [v, remainingState] | |
88 | 88 | } | |
89 | 89 | else throw("Empty string was passed into parseNextAttribute func") | |
90 | 90 | } | |
91 | 91 | ||
92 | 92 | ||
93 | 93 | func ParseGameRawDataStr (rawStateStr) = { | |
94 | 94 | let gameState = ParseNextAttribute(rawStateStr) | |
95 | 95 | let playerChoice = ParseNextAttribute(gameState[1]) | |
96 | 96 | let playerPubKey58 = ParseNextAttribute(playerChoice[1]) | |
97 | 97 | let startedHeight = ParseNextAttribute(playerPubKey58[1]) | |
98 | 98 | let winAmt = ParseNextAttribute(startedHeight[1]) | |
99 | 99 | [gameState[0], playerChoice[0], playerPubKey58[0], startedHeight[0], winAmt[0]] | |
100 | 100 | } | |
101 | 101 | ||
102 | 102 | ||
103 | 103 | func ExtractGameDataList (gameId) = { | |
104 | 104 | let rawDataStr = match getString(this, gameId) { | |
105 | 105 | case str: String => | |
106 | 106 | str | |
107 | 107 | case _ => | |
108 | 108 | throw(("Couldn't find game by " + gameId)) | |
109 | 109 | } | |
110 | 110 | ParseGameRawDataStr(rawDataStr) | |
111 | 111 | } | |
112 | 112 | ||
113 | 113 | ||
114 | 114 | func ExtractReservedAmt () = match getInteger(this, RESERVATIONKEY) { | |
115 | 115 | case a: Int => | |
116 | 116 | a | |
117 | 117 | case _ => | |
118 | 118 | 0 | |
119 | 119 | } | |
120 | 120 | ||
121 | 121 | ||
122 | 122 | func ValidateAndIncreaseReservedAmt (winAmt) = { | |
123 | 123 | let newReservedAmount = (ExtractReservedAmt() + winAmt) | |
124 | 124 | let balance = wavesBalance(this) | |
125 | 125 | if ((newReservedAmount > balance)) | |
126 | 126 | then throw("Insufficient funds on Russian Roulette account. Transaction was rejected for your safety.") | |
127 | 127 | else newReservedAmount | |
128 | 128 | } | |
129 | 129 | ||
130 | 130 | ||
131 | 131 | func IncrementGameNum () = { | |
132 | 132 | let gameNum = match getInteger(this, GAMESCOUNTERKEY) { | |
133 | 133 | case num: Int => | |
134 | 134 | num | |
135 | 135 | case _ => | |
136 | 136 | 0 | |
137 | 137 | } | |
138 | 138 | (gameNum + 1) | |
139 | 139 | } | |
140 | 140 | ||
141 | 141 | ||
142 | 142 | func DecreaseReservedAmt (gameId,winAmt) = { | |
143 | 143 | let newReservedAmount = (ExtractReservedAmt() - winAmt) | |
144 | 144 | if ((0 > newReservedAmount)) | |
145 | 145 | then throw("Invalid Russian Roulette account state - reserved amount is less than 0") | |
146 | 146 | else DataEntry(RESERVATIONKEY, newReservedAmount) | |
147 | 147 | } | |
148 | 148 | ||
149 | 149 | ||
150 | 150 | func FormatGameDataParam (p) = { | |
151 | 151 | let s = size(p) | |
152 | 152 | if ((s == 0)) | |
153 | 153 | then throw("Parameter size must be greater then 0") | |
154 | 154 | else if ((s > 99)) | |
155 | 155 | then throw("Parameter size must be less then 100") | |
156 | 156 | else if ((10 > s)) | |
157 | 157 | then (("0" + toString(s)) + p) | |
158 | 158 | else (toString(s) + p) | |
159 | 159 | } | |
160 | 160 | ||
161 | 161 | ||
162 | 162 | func FormatGameDataStr (gameState,playerChoice,playerPubKey58,startedHeight,winAmt,randOrEmpty) = { | |
163 | 163 | let fullStateStr = ((((((((FormatGameDataParam(gameState) + "_") + FormatGameDataParam(playerChoice)) + "_") + FormatGameDataParam(playerPubKey58)) + "_") + FormatGameDataParam(toString(startedHeight))) + "_") + FormatGameDataParam(toString(winAmt))) | |
164 | 164 | if ((randOrEmpty == "")) | |
165 | 165 | then fullStateStr | |
166 | 166 | else ((fullStateStr + "_") + FormatGameDataParam(randOrEmpty)) | |
167 | 167 | } | |
168 | 168 | ||
169 | 169 | ||
170 | 170 | func RandToStr (r) = if ((r == 1)) | |
171 | 171 | then "1" | |
172 | 172 | else if ((r == 2)) | |
173 | 173 | then "2" | |
174 | 174 | else if ((r == 3)) | |
175 | 175 | then "3" | |
176 | 176 | else if ((r == 4)) | |
177 | 177 | then "4" | |
178 | 178 | else if ((r == 5)) | |
179 | 179 | then "5" | |
180 | 180 | else if ((r == 6)) | |
181 | 181 | then "6" | |
182 | 182 | else throw(("Unsupported r parameter passed: expected=[1,...,6] actual=" + toString(r))) | |
183 | 183 | ||
184 | 184 | ||
185 | 185 | func ValidateBetAndDefineWinAmt (betAmt,playerChoice) = { | |
186 | 186 | let betAmtValid = if (if (if (if (if ((betAmt == (BET1 + COMMISSION))) | |
187 | 187 | then true | |
188 | 188 | else (betAmt == (BET2 + COMMISSION))) | |
189 | 189 | then true | |
190 | 190 | else (betAmt == (BET4 + COMMISSION))) | |
191 | 191 | then true | |
192 | 192 | else (betAmt == (BET8 + COMMISSION))) | |
193 | 193 | then true | |
194 | 194 | else (betAmt == (BET14 + COMMISSION))) | |
195 | 195 | then true | |
196 | 196 | else false | |
197 | 197 | if (betAmtValid) | |
198 | 198 | then { | |
199 | 199 | let bulletsCount = size(playerChoice) | |
200 | 200 | let bet = (betAmt - COMMISSION) | |
201 | 201 | let b1 = parseIntValue(take(playerChoice, 1)) | |
202 | 202 | let forB2 = drop(playerChoice, 1) | |
203 | 203 | let b2 = parseIntValue(take(forB2, 1)) | |
204 | 204 | let forB3 = drop(forB2, 1) | |
205 | 205 | let b3 = parseIntValue(take(forB3, 1)) | |
206 | 206 | let forB4 = drop(forB3, 1) | |
207 | 207 | let b4 = parseIntValue(take(forB4, 1)) | |
208 | 208 | let forB5 = drop(forB4, 1) | |
209 | 209 | let b5 = parseIntValue(take(forB5, 1)) | |
210 | 210 | let forB6 = drop(forB5, 1) | |
211 | 211 | let b6 = parseIntValue(take(forB6, 1)) | |
212 | 212 | let activeBullets = (((((b1 + b2) + b3) + b4) + b5) + b6) | |
213 | 213 | if ((activeBullets == 5)) | |
214 | 214 | then ((bet * RATE1) / RATEMULT) | |
215 | 215 | else if ((activeBullets == 4)) | |
216 | 216 | then ((bet * RATE2) / RATEMULT) | |
217 | 217 | else if ((activeBullets == 3)) | |
218 | 218 | then ((bet * RATE3) / RATEMULT) | |
219 | 219 | else if ((activeBullets == 2)) | |
220 | 220 | then ((bet * RATE4) / RATEMULT) | |
221 | 221 | else if ((activeBullets == 1)) | |
222 | 222 | then ((bet * RATE5) / RATEMULT) | |
223 | 223 | else throw(("Invalid player's choice, active bullets = " + toString(activeBullets))) | |
224 | 224 | } | |
225 | 225 | else throw("Bet amount is not in range") | |
226 | 226 | } | |
227 | 227 | ||
228 | 228 | ||
229 | 229 | func getWinStr (playerChoice) = { | |
230 | 230 | let b1 = parseIntValue(take(playerChoice, 1)) | |
231 | 231 | let forB2 = drop(playerChoice, 1) | |
232 | 232 | let b2 = parseIntValue(take(forB2, 1)) | |
233 | 233 | let forB3 = drop(playerChoice, 1) | |
234 | 234 | let b3 = parseIntValue(take(forB3, 1)) | |
235 | 235 | let forB4 = drop(playerChoice, 1) | |
236 | 236 | let b4 = parseIntValue(take(forB4, 1)) | |
237 | 237 | let forB5 = drop(playerChoice, 1) | |
238 | 238 | let b5 = parseIntValue(take(forB5, 1)) | |
239 | 239 | let forB6 = drop(playerChoice, 1) | |
240 | 240 | let b6 = parseIntValue(take(forB6, 1)) | |
241 | 241 | if ((b1 == 0)) | |
242 | 242 | then "1" | |
243 | 243 | else if ((b2 == 0)) | |
244 | 244 | then "2" | |
245 | 245 | else if ((b3 == 0)) | |
246 | 246 | then "3" | |
247 | 247 | else if ((b4 == 0)) | |
248 | 248 | then "4" | |
249 | 249 | else if ((b5 == 0)) | |
250 | 250 | then "5" | |
251 | 251 | else if ((b6 == 0)) | |
252 | 252 | then "6" | |
253 | 253 | else throw("Bet amount is not in range") | |
254 | 254 | } | |
255 | 255 | ||
256 | 256 | ||
257 | 257 | func IsPlayerWin (playerChoice,randStr) = { | |
258 | 258 | let randInt = parseIntValue(randStr) | |
259 | 259 | let choiceArray = split(playerChoice, "") | |
260 | 260 | if ((choiceArray[(randInt - 1)] == "0")) | |
261 | 261 | then true | |
262 | 262 | else false | |
263 | 263 | } | |
264 | 264 | ||
265 | 265 | ||
266 | 266 | func WinScriptSet (gameId,playerAddress,winAmt,newGameDataStr,winByTimeout,decreasedReserves) = { | |
267 | 267 | let wSetCommonData = [decreasedReserves] | |
268 | 268 | let tSetCommonData = [ScriptTransfer(playerAddress, winAmt, unit)] | |
269 | 269 | if (winByTimeout) | |
270 | 270 | then { | |
271 | 271 | let newGameDataStrAdjusted = ((newGameDataStr + "_") + FormatGameDataParam("TIMEOUT")) | |
272 | 272 | let gameData = DataEntry(gameId, newGameDataStrAdjusted) | |
273 | 273 | ScriptResult(WriteSet(gameData :: wSetCommonData), TransferSet(tSetCommonData)) | |
274 | 274 | } | |
275 | 275 | else { | |
276 | 276 | let gameData = DataEntry(gameId, newGameDataStr) | |
277 | 277 | ScriptResult(WriteSet(gameData :: wSetCommonData), TransferSet(tSetCommonData)) | |
278 | 278 | } | |
279 | 279 | } | |
280 | 280 | ||
281 | 281 | ||
282 | 282 | @Callable(i) | |
283 | 283 | func bet (playerChoice) = { | |
284 | - | let bb = toBase64String(toBytes("-----BEGIN CERTIFICATE----- | |
285 | - | MIIBvTCCASYCCQD55fNzc0WF7TANBgkqhkiG9w0BAQUFADAjMQswCQYDVQQGEwJK | |
286 | - | UDEUMBIGA1UEChMLMDAtVEVTVC1SU0EwHhcNMTAwNTI4MDIwODUxWhcNMjAwNTI1 | |
287 | - | MDIwODUxWjAjMQswCQYDVQQGEwJKUDEUMBIGA1UEChMLMDAtVEVTVC1SU0EwgZ8w | |
288 | - | DQYJKoZIhvcNAQEBBQADgY0AMIGJAoGBANGEYXtfgDRlWUSDn3haY4NVVQiKI9Cz | |
289 | - | Thoua9+DxJuiseyzmBBe7Roh1RPqdvmtOHmEPbJ+kXZYhbozzPRbFGHCJyBfCLzQ | |
290 | - | fVos9/qUQ88u83b0SFA2MGmQWQAlRtLy66EkR4rDRwTj2DzR4EEXgEKpIvo8VBs/ | |
291 | - | 3+sHLF3ESgAhAgMBAAEwDQYJKoZIhvcNAQEFBQADgYEAEZ6mXFFq3AzfaqWHmCy1 | |
292 | - | ARjlauYAa8ZmUFnLm0emg9dkVBJ63aEqARhtok6bDQDzSJxiLpCEF6G4b/Nv/M/M | |
293 | - | LyhP+OoOTmETMegAVQMq71choVJyOFE5BtQa6M/lCHEOya5QUfoRF2HF9EjRF44K | |
294 | - | 3OK+u3ivTSj3zwjtpudY5Xo= | |
295 | - | -----END CERTIFICATE-----")) | |
296 | - | let RSAPUBLIC1 = fromBase64String(bb) | |
297 | - | throw(("PEM:" + toUtf8String(RSAPUBLIC1))) | |
284 | + | let newGameNum = IncrementGameNum() | |
285 | + | let gameId = toBase58String(i.transactionId) | |
286 | + | let pmt = extract(i.payment) | |
287 | + | let betNotInWaves = isDefined(pmt.assetId) | |
288 | + | let feeNotInWaves = isDefined(pmt.assetId) | |
289 | + | let winAmt = ValidateBetAndDefineWinAmt(pmt.amount, playerChoice) | |
290 | + | let txIdUsed = isDefined(getString(this, gameId)) | |
291 | + | if (betNotInWaves) | |
292 | + | then throw("Bet amount must be in Waves") | |
293 | + | else if (feeNotInWaves) | |
294 | + | then throw("Transaction's fee must be in Waves") | |
295 | + | else if (txIdUsed) | |
296 | + | then throw("Passed txId had been used before. Game aborted.") | |
297 | + | else { | |
298 | + | let playerPubKey58 = toBase58String(i.callerPublicKey) | |
299 | + | let gameDataStr = FormatGameDataStr(STATESUBMITTED, playerChoice, playerPubKey58, height, winAmt, "") | |
300 | + | let readableGameData = ((((((((STATESUBMITTED + "_") + playerChoice) + "_") + playerPubKey58) + "_") + toString(height)) + "_") + toString(winAmt)) | |
301 | + | let serverTransfer = [ScriptTransfer(SERVER, COMMISSION, unit)] | |
302 | + | let betData = [DataEntry(RESERVATIONKEY, ValidateAndIncreaseReservedAmt(winAmt)), DataEntry(GAMESCOUNTERKEY, newGameNum), DataEntry(gameId, gameDataStr)] | |
303 | + | ScriptResult(WriteSet(betData), TransferSet(serverTransfer)) | |
304 | + | } | |
298 | 305 | } | |
299 | 306 | ||
300 | 307 | ||
301 | 308 | ||
302 | 309 | @Callable(i) | |
303 | 310 | func withdraw (gameId,rsaSign) = { | |
304 | 311 | let gameDataList = ExtractGameDataList(gameId) | |
305 | 312 | let gameState = gameDataList[IdxGameState] | |
306 | 313 | let playerChoice = gameDataList[IdxPlayerChoice] | |
307 | 314 | let startedHeight = parseIntValue(gameDataList[IdxStartedHeight]) | |
308 | 315 | let winAmt = parseIntValue(gameDataList[IdxWinAmt]) | |
309 | 316 | let playerPubKey58 = gameDataList[IdxPlayerPubKey58] | |
310 | 317 | let playerAddress = addressFromPublicKey(fromBase58String(playerPubKey58)) | |
311 | 318 | let winByTimeout = ((height - startedHeight) > RANDORACLETIMEFRAME) | |
312 | 319 | let decreasedReserves = DecreaseReservedAmt(gameId, winAmt) | |
313 | 320 | if ((gameState != STATESUBMITTED)) | |
314 | 321 | then throw("Invalid game state for passed gameId") | |
315 | 322 | else if (winByTimeout) | |
316 | 323 | then { | |
317 | 324 | let randStr = getWinStr(playerChoice) | |
318 | 325 | let newGameDataStr = FormatGameDataStr(STATEWON, playerChoice, playerPubKey58, startedHeight, winAmt, randStr) | |
319 | 326 | WinScriptSet(gameId, playerAddress, winAmt, newGameDataStr, winByTimeout, decreasedReserves) | |
320 | 327 | } | |
321 | 328 | else { | |
322 | 329 | let randInt = GenerateRandInt(gameId, rsaSign) | |
323 | 330 | let randStr = RandToStr(randInt) | |
324 | 331 | if (IsPlayerWin(playerChoice, randStr)) | |
325 | 332 | then { | |
326 | 333 | let newGameDataStr = FormatGameDataStr(STATEWON, playerChoice, playerPubKey58, startedHeight, winAmt, randStr) | |
327 | 334 | WinScriptSet(gameId, playerAddress, winAmt, newGameDataStr, winByTimeout, decreasedReserves) | |
328 | 335 | } | |
329 | 336 | else { | |
330 | 337 | let newGameDataStr = FormatGameDataStr(STATELOST, playerChoice, playerPubKey58, startedHeight, winAmt, randStr) | |
331 | 338 | WriteSet([DataEntry(gameId, newGameDataStr), decreasedReserves]) | |
332 | 339 | } | |
333 | 340 | } | |
334 | 341 | } | |
335 | 342 | ||
336 | 343 |
github/deemru/w8io/169f3d6 53.63 ms ◑