tx · 8grEGtQLZFPHu5TNrVYrYLGcT3b7oYDcAZHm58CsBk4z 3N8NLvRGsbGhgoXy7EdigPbAz6N2i7ygBcZ: -0.01800000 Waves 2023.12.14 20:20 [2886687] smart account 3N8NLvRGsbGhgoXy7EdigPbAz6N2i7ygBcZ > SELF 0.00000000 Waves
{ "type": 13, "id": "8grEGtQLZFPHu5TNrVYrYLGcT3b7oYDcAZHm58CsBk4z", "fee": 1800000, "feeAssetId": null, "timestamp": 1702574438525, "version": 2, "chainId": 84, "sender": "3N8NLvRGsbGhgoXy7EdigPbAz6N2i7ygBcZ", "senderPublicKey": "CQoe8BRHR78TuPQLcK3Ykv39w9CeNLhjKdj6TNbJ5FrM", "proofs": [ "4dbMuFKHRgrVoxptSjpGAkTyztc14N9u21SfoycFQpeLoSqXEyW9LAxPRL3TJXd891JrGPcTPiuaLF1BZFvnGzUY" ], "script": "base64:BgIaCAISBgoECAgBCBIDCgEEEgMKAQgSBAoCCAJJAANTRVACAl9fAAdXQVZFU0lEAQQTq9kzAAZXQVZFU0QAgMLXLwAJR0FNRV9OQU1FAglYbWFzIFRyZWUADFJBTkRPTV9SQU5HRQAFAAhOVU1fQkVUUwABAA9NQVhfREVDT1JBVElPTlMADwEMZ2V0U3RyT3JGYWlsAgdhZGRyZXNzA2tleQkBE3ZhbHVlT3JFcnJvck1lc3NhZ2UCCQCdCAIFB2FkZHJlc3MFA2tleQkAuQkCCQDMCAICCm1hbmRhdG9yeSAJAMwIAgkApQgBBQdhZGRyZXNzCQDMCAICAS4JAMwIAgUDa2V5CQDMCAICDyBpcyBub3QgZGVmaW5lZAUDbmlsAgABDGdldEludE9yRmFpbAIHYWRkcmVzcwNrZXkJARN2YWx1ZU9yRXJyb3JNZXNzYWdlAgkAmggCBQdhZGRyZXNzBQNrZXkJALkJAgkAzAgCAgptYW5kYXRvcnkgCQDMCAIJAKUIAQUHYWRkcmVzcwkAzAgCAgEuCQDMCAIFA2tleQkAzAgCAg8gaXMgbm90IGRlZmluZ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JGYwXzICAiRhAiRpAwkAZwIFAiRpBQIkcwUCJGEJAAIBAhRMaXN0IHNpemUgZXhjZWVkcyAxMAkBBSRmMF8yAgkBBSRmMF8xAgkBBSRmMF8xAgkBBSRmMF8xAgkBBSRmMF8xAgkBBSRmMF8xAgkBBSRmMF8xAgkBBSRmMF8xAgkBBSRmMF8xAgkBBSRmMF8xAgkBBSRmMF8xAgUFJGFjYzAAAAABAAIAAwAEAAUABgAHAAgACQAKAwkAAQIFByRtYXRjaDACF0ludm9rZVNjcmlwdFRyYW5zYWN0aW9uBANpdHgFByRtYXRjaDADCQAAAggFA2l0eARkQXBwBQR0aGlzCQAAAggFA2l0eAhmdW5jdGlvbgINY29uc3RydWN0b3JWMQcHB1SKKnM=", "height": 2886687, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 4neXrpr5EyYMunFVKJQWmdRCAiZ76sai4w8zcWjoLoWu Next: mL53EgciGKFPYUNGQ99pTkZj6kX3KLPQLmHsBPLwp4P Full:
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 6 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let SEP = "__" | |
5 | 5 | ||
6 | 6 | let WAVESID = base58'WAVES' | |
7 | 7 | ||
8 | 8 | let WAVESD = 100000000 | |
9 | 9 | ||
10 | 10 | let GAME_NAME = "Xmas Tree" | |
11 | 11 | ||
12 | 12 | let RANDOM_RANGE = 5 | |
13 | 13 | ||
14 | 14 | let NUM_BETS = 1 | |
15 | 15 | ||
16 | 16 | let MAX_DECORATIONS = 15 | |
17 | 17 | ||
18 | 18 | func getStrOrFail (address,key) = valueOrErrorMessage(getString(address, key), makeString(["mandatory ", toString(address), ".", key, " is not defined"], "")) | |
19 | 19 | ||
20 | 20 | ||
21 | 21 | func getIntOrFail (address,key) = valueOrErrorMessage(getInteger(address, key), makeString(["mandatory ", toString(address), ".", key, " is not defined"], "")) | |
22 | 22 | ||
23 | 23 | ||
24 | 24 | func getBoolOrFail (address,key) = valueOrErrorMessage(getBoolean(address, key), makeString(["mandatory ", toString(address), ".", key, " is not defined"], "")) | |
25 | 25 | ||
26 | 26 | ||
27 | 27 | let allowedAssetsKey = "%s%s__cfg__allowedAssets" | |
28 | 28 | ||
29 | 29 | let assetsDecimalsKey = "%s%s__cfg__assetsDecimals" | |
30 | 30 | ||
31 | 31 | let betDividersKey = "%s%s__cfg__assetsBetDividers" | |
32 | 32 | ||
33 | 33 | let RSAPUBLIC64KEY = "%s%s__cfg__rsaPublic64" | |
34 | 34 | ||
35 | 35 | let SERVERADDRESSKEY = "%s%s__cfg__benzAddress" | |
36 | 36 | ||
37 | 37 | let RANDTIMEFRAMEKEY = "%s%s__cfg__withdrawTimeFrame" | |
38 | 38 | ||
39 | 39 | let GAMESCOUNTERKEY = "%s%s__runtime__gameNum" | |
40 | 40 | ||
41 | 41 | let blockedKey = "%s%s__runtime__contractIsBlocked" | |
42 | 42 | ||
43 | 43 | let reservedAmountsKey = "%s%s__runtime__reservedAmounts" | |
44 | 44 | ||
45 | 45 | let historyKey = "%s%s__runtime__decorationsHistory" | |
46 | 46 | ||
47 | 47 | func getIntArray (key) = { | |
48 | 48 | let a = getStrOrFail(this, key) | |
49 | 49 | func filler (acc,el) = (acc :+ parseIntValue(el)) | |
50 | 50 | ||
51 | 51 | let $l = split(a, SEP) | |
52 | 52 | let $s = size($l) | |
53 | 53 | let $acc0 = nil | |
54 | 54 | func $f0_1 ($a,$i) = if (($i >= $s)) | |
55 | 55 | then $a | |
56 | 56 | else filler($a, $l[$i]) | |
57 | 57 | ||
58 | 58 | func $f0_2 ($a,$i) = if (($i >= $s)) | |
59 | 59 | then $a | |
60 | 60 | else throw("List size exceeds 10") | |
61 | 61 | ||
62 | 62 | $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5), 6), 7), 8), 9), 10) | |
63 | 63 | } | |
64 | 64 | ||
65 | 65 | ||
66 | 66 | let ASSETS = split(getStrOrFail(this, allowedAssetsKey), SEP) | |
67 | 67 | ||
68 | 68 | let DECIMALS = getIntArray(assetsDecimalsKey) | |
69 | 69 | ||
70 | 70 | let BETDIVIDERS = getIntArray(betDividersKey) | |
71 | 71 | ||
72 | 72 | func keyReservationByAssetStr (assetStr) = ("$RESERVED_AMOUNT_" + assetStr) | |
73 | 73 | ||
74 | 74 | ||
75 | 75 | func keyReservationByAssetIdx (assetIdx) = keyReservationByAssetStr(ASSETS[assetIdx]) | |
76 | 76 | ||
77 | 77 | ||
78 | 78 | let MINFEEWAVES = ((5 * WAVESD) / 1000) | |
79 | 79 | ||
80 | 80 | let idxAssets = 0 | |
81 | 81 | ||
82 | 82 | let idxDecimals = 1 | |
83 | 83 | ||
84 | 84 | let idxDividers = 2 | |
85 | 85 | ||
86 | 86 | let BET1 = 1 | |
87 | 87 | ||
88 | 88 | let BET2 = 2 | |
89 | 89 | ||
90 | 90 | let BET4 = 4 | |
91 | 91 | ||
92 | 92 | let BET8 = 8 | |
93 | 93 | ||
94 | 94 | let BET14 = 14 | |
95 | 95 | ||
96 | 96 | let RATEMULT = 10000 | |
97 | 97 | ||
98 | 98 | let RATE = 30000 | |
99 | 99 | ||
100 | 100 | let BETS = [BET2] | |
101 | 101 | ||
102 | 102 | let IdxGameState = 0 | |
103 | 103 | ||
104 | 104 | let IdxPlayerChoice = 1 | |
105 | 105 | ||
106 | 106 | let IdxPlayerPubKey58 = 2 | |
107 | 107 | ||
108 | 108 | let IdxStartedHeight = 3 | |
109 | 109 | ||
110 | 110 | let IdxWinAmount = 4 | |
111 | 111 | ||
112 | 112 | let IdxAssetId = 5 | |
113 | 113 | ||
114 | 114 | let STATESUBMITTED = "SUBMITTED" | |
115 | 115 | ||
116 | 116 | let STATEWON = "WON" | |
117 | 117 | ||
118 | 118 | let STATELOST = "LOST" | |
119 | 119 | ||
120 | 120 | func getStringOrFail (key) = valueOrErrorMessage(getString(this, key), (key + " key is not specified in this.state")) | |
121 | 121 | ||
122 | 122 | ||
123 | 123 | let RSAPUBLIC = fromBase64String(getStringOrFail(RSAPUBLIC64KEY)) | |
124 | 124 | ||
125 | 125 | let SERVER = addressFromStringValue(getStringOrFail(SERVERADDRESSKEY)) | |
126 | 126 | ||
127 | 127 | let RANDORACLETIMEFRAME = valueOrElse(getInteger(this, RANDTIMEFRAMEKEY), 7200) | |
128 | 128 | ||
129 | 129 | func getIntOr (key,default) = if (isDefined(getInteger(key))) | |
130 | 130 | then getIntegerValue(key) | |
131 | 131 | else default | |
132 | 132 | ||
133 | 133 | ||
134 | 134 | func setInt (key,value) = IntegerEntry(key, value) | |
135 | 135 | ||
136 | 136 | ||
137 | 137 | func incrementInt (key) = setInt(key, (getIntOr(key, -1) + 1)) | |
138 | 138 | ||
139 | 139 | ||
140 | 140 | func changeInt (key,by) = setInt(key, (getIntOr(key, 0) + by)) | |
141 | 141 | ||
142 | 142 | ||
143 | 143 | func assetIdToStr (assetIdOrUnit) = match assetIdOrUnit { | |
144 | 144 | case b: ByteVector => | |
145 | 145 | toBase58String(b) | |
146 | 146 | case _ => | |
147 | 147 | "WAVES" | |
148 | 148 | } | |
149 | 149 | ||
150 | 150 | ||
151 | 151 | func assetIdFromStr (assetIdStr) = if ((assetIdStr == "WAVES")) | |
152 | 152 | then unit | |
153 | 153 | else fromBase58String(assetIdStr) | |
154 | 154 | ||
155 | 155 | ||
156 | 156 | func getAssetBalance (assetIdOrUnit) = match assetIdOrUnit { | |
157 | 157 | case assetId: ByteVector => | |
158 | 158 | assetBalance(this, assetId) | |
159 | 159 | case _ => | |
160 | 160 | wavesBalance(this).available | |
161 | 161 | } | |
162 | 162 | ||
163 | 163 | ||
164 | 164 | func increaseReserveAmount (winAmount,assetIdx) = { | |
165 | 165 | let assetIdStr = ASSETS[assetIdx] | |
166 | 166 | let newReservedAmount = (getIntOr(keyReservationByAssetIdx(assetIdx), 0) + winAmount) | |
167 | 167 | if ((newReservedAmount > getAssetBalance(assetIdFromStr(assetIdStr)))) | |
168 | 168 | then throw((("Insufficient funds on " + GAME_NAME) + " account. Transaction was rejected for your safety.")) | |
169 | 169 | else newReservedAmount | |
170 | 170 | } | |
171 | 171 | ||
172 | 172 | ||
173 | 173 | func decreaseReservedAmount (gameId,assetIdx,winAmount) = if ((0 > (getIntOr(keyReservationByAssetIdx(assetIdx), 0) - winAmount))) | |
174 | 174 | then throw((("Invalid " + GAME_NAME) + " account state - reserved amount is less than 0")) | |
175 | 175 | else changeInt(keyReservationByAssetIdx(assetIdx), -(winAmount)) | |
176 | 176 | ||
177 | 177 | ||
178 | 178 | func validateAndGetAssetIdx (assetIdStr) = { | |
179 | 179 | let idx = indexOf(ASSETS, assetIdStr) | |
180 | 180 | if (!(isDefined(idx))) | |
181 | 181 | then throw("Invalid payment asset") | |
182 | 182 | else value(idx) | |
183 | 183 | } | |
184 | 184 | ||
185 | 185 | ||
186 | 186 | func validateBetAndGetWinAmount (bet,internalAssetIdx,playerChoice) = { | |
187 | 187 | let dicesCount = size(playerChoice) | |
188 | 188 | func checkAmount (a,x) = if (a) | |
189 | 189 | then true | |
190 | 190 | else (bet == ((x * DECIMALS[internalAssetIdx]) / BETDIVIDERS[internalAssetIdx])) | |
191 | 191 | ||
192 | 192 | if (!({ | |
193 | 193 | let $l = BETS | |
194 | 194 | let $s = size($l) | |
195 | 195 | let $acc0 = false | |
196 | 196 | func $f0_1 ($a,$i) = if (($i >= $s)) | |
197 | 197 | then $a | |
198 | 198 | else checkAmount($a, $l[$i]) | |
199 | 199 | ||
200 | 200 | func $f0_2 ($a,$i) = if (($i >= $s)) | |
201 | 201 | then $a | |
202 | 202 | else throw("List size exceeds 5") | |
203 | 203 | ||
204 | 204 | $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5) | |
205 | 205 | })) | |
206 | 206 | then throw("Bet amount is not valid") | |
207 | 207 | else if ((parseInt(playerChoice) == unit)) | |
208 | 208 | then throw("Invalid player's choice") | |
209 | 209 | else if ((dicesCount != NUM_BETS)) | |
210 | 210 | then throw("Invalid length of player's choice") | |
211 | 211 | else fraction(bet, RATE, RATEMULT) | |
212 | 212 | } | |
213 | 213 | ||
214 | 214 | ||
215 | 215 | let HOR_LINES = [[491, 506, 44], [455, 542, 120], [404, 596, 166], [441, 556, 177], [387, 620, 232], [423, 620, 232], [410, 592, 244], [329, 665, 321], [370, 666, 337], [355, 645, 349], [313, 692, 384], [289, 682, 405], [324, 657, 461], [450, 575, 525], [505, 505, 532]] | |
216 | 216 | ||
217 | 217 | let HALF = 5000 | |
218 | 218 | ||
219 | 219 | let M4 = 10000 | |
220 | 220 | ||
221 | 221 | func getCoords (gameId,rsaSign) = { | |
222 | 222 | func calcAreas (acc,ignored) = { | |
223 | 223 | let i = acc._3 | |
224 | 224 | if ((i == 14)) | |
225 | 225 | then acc | |
226 | 226 | else { | |
227 | 227 | let top = HOR_LINES[i] | |
228 | 228 | let bottom = HOR_LINES[(i + 1)] | |
229 | 229 | let area4 = (((((top[1] - top[0]) + bottom[1]) - bottom[0]) * (bottom[2] - top[2])) * 5000) | |
230 | 230 | $Tuple3((acc._1 :+ area4), (acc._2 + area4), (acc._3 + 1)) | |
231 | 231 | } | |
232 | 232 | } | |
233 | 233 | ||
234 | 234 | let $t080588125 = { | |
235 | 235 | let $l = HOR_LINES | |
236 | 236 | let $s = size($l) | |
237 | 237 | let $acc0 = $Tuple3(nil, 0, 0) | |
238 | 238 | func $f0_1 ($a,$i) = if (($i >= $s)) | |
239 | 239 | then $a | |
240 | 240 | else calcAreas($a, $l[$i]) | |
241 | 241 | ||
242 | 242 | func $f0_2 ($a,$i) = if (($i >= $s)) | |
243 | 243 | then $a | |
244 | 244 | else throw("List size exceeds 15") | |
245 | 245 | ||
246 | 246 | $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5), 6), 7), 8), 9), 10), 11), 12), 13), 14), 15) | |
247 | 247 | } | |
248 | 248 | let areas = $t080588125._1 | |
249 | 249 | let totalArea = $t080588125._2 | |
250 | 250 | let rand = (toInt(sha256((rsaSign + toBytes(gameId)))) % totalArea) | |
251 | 251 | func check (acc,area) = { | |
252 | 252 | let i = acc._1 | |
253 | 253 | let newArea = (acc._2 + area) | |
254 | 254 | $Tuple3((i + 1), newArea, if (if ((0 > acc._3)) | |
255 | 255 | then (newArea > rand) | |
256 | 256 | else false) | |
257 | 257 | then i | |
258 | 258 | else acc._3) | |
259 | 259 | } | |
260 | 260 | ||
261 | 261 | let j = ( let $l = areas | |
262 | 262 | let $s = size($l) | |
263 | 263 | let $acc0 = $Tuple3(0, 0, -1) | |
264 | 264 | func $f1_1 ($a,$i) = if (($i >= $s)) | |
265 | 265 | then $a | |
266 | 266 | else check($a, $l[$i]) | |
267 | 267 | ||
268 | 268 | func $f1_2 ($a,$i) = if (($i >= $s)) | |
269 | 269 | then $a | |
270 | 270 | else throw("List size exceeds 14") | |
271 | 271 | ||
272 | 272 | $f1_2($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($acc0, 0), 1), 2), 3), 4), 5), 6), 7), 8), 9), 10), 11), 12), 13), 14))._3 | |
273 | 273 | let top = HOR_LINES[j] | |
274 | 274 | let bottom = HOR_LINES[(j + 1)] | |
275 | 275 | let mx04 = ((top[0] + bottom[0]) * HALF) | |
276 | 276 | let mx14 = ((top[1] + bottom[1]) * HALF) | |
277 | 277 | let h4 = ((bottom[2] - top[2]) * M4) | |
278 | 278 | let my4 = ((top[2] + bottom[2]) * HALF) | |
279 | 279 | let randX4 = (mx04 + (toInt(sha256((rsaSign + toBytes(j)))) % (mx14 - mx04))) | |
280 | 280 | let randY4 = ((top[2] * M4) + (toInt(sha256((rsaSign + toBytes(randX4)))) % h4)) | |
281 | 281 | let a4 = ((top[2] * M4) - randY4) | |
282 | 282 | let b4 = ((bottom[2] * M4) - randY4) | |
283 | 283 | let x04 = fraction(((top[0] * b4) - (bottom[0] * a4)), M4, h4) | |
284 | 284 | let x14 = fraction(((top[1] * b4) - (bottom[1] * a4)), M4, h4) | |
285 | 285 | if ((x04 > randX4)) | |
286 | 286 | then [((2 * mx04) - randX4), ((2 * my4) - randY4)] | |
287 | 287 | else if ((randX4 > x14)) | |
288 | 288 | then [((2 * mx14) - randX4), ((2 * my4) - randY4)] | |
289 | 289 | else [randX4, randY4] | |
290 | 290 | } | |
291 | 291 | ||
292 | 292 | ||
293 | 293 | func getDecorationIndex (gameId,rsaSign) = (toInt(sha256((toBytes(gameId) + rsaSign))) % MAX_DECORATIONS) | |
294 | 294 | ||
295 | 295 | ||
296 | 296 | func generateRandChoice (gameId,rsaSign) = { | |
297 | 297 | let rsaSigValid = rsaVerify_16Kb(SHA256, toBytes(gameId), rsaSign, RSAPUBLIC) | |
298 | 298 | if (!(rsaSigValid)) | |
299 | 299 | then throw("Invalid RSA signature") | |
300 | 300 | else { | |
301 | 301 | let rand = (toInt(sha256(rsaSign)) % RANDOM_RANGE) | |
302 | 302 | toString((rand + 1)) | |
303 | 303 | } | |
304 | 304 | } | |
305 | 305 | ||
306 | 306 | ||
307 | 307 | func isPlayerWin (playerChoice,randChoise) = { | |
308 | 308 | let s = size(playerChoice) | |
309 | 309 | func check (a,x) = if (a) | |
310 | 310 | then true | |
311 | 311 | else if ((s >= x)) | |
312 | 312 | then (take(drop(playerChoice, (x - 1)), 1) == randChoise) | |
313 | 313 | else false | |
314 | 314 | ||
315 | 315 | let $l = [1, 2, 3, 4, 5] | |
316 | 316 | let $s = size($l) | |
317 | 317 | let $acc0 = false | |
318 | 318 | func $f0_1 ($a,$i) = if (($i >= $s)) | |
319 | 319 | then $a | |
320 | 320 | else check($a, $l[$i]) | |
321 | 321 | ||
322 | 322 | func $f0_2 ($a,$i) = if (($i >= $s)) | |
323 | 323 | then $a | |
324 | 324 | else throw("List size exceeds 5") | |
325 | 325 | ||
326 | 326 | $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5) | |
327 | 327 | } | |
328 | 328 | ||
329 | 329 | ||
330 | 330 | func formatGameDataS (gameStatus,playerChoice,playerPubKey58,startedHeight,winAmount,assetIdx,randOrEmpty,xCoord,yCoord,prizeIndex) = makeString([gameStatus, playerChoice, playerPubKey58, startedHeight, winAmount, assetIdx, if ((randOrEmpty == "")) | |
331 | 331 | then "" | |
332 | 332 | else randOrEmpty, xCoord, yCoord, prizeIndex], "_") | |
333 | 333 | ||
334 | 334 | ||
335 | 335 | func formatGameData (gameStatus,playerChoice,playerPubKey58,startedHeight,winAmount,assetIdx,randOrEmpty,xCoord,yCoord,prizeIndex) = formatGameDataS(gameStatus, playerChoice, playerPubKey58, toString(startedHeight), toString(winAmount), toString(assetIdx), randOrEmpty, toString(xCoord), toString(yCoord), toString(prizeIndex)) | |
336 | 336 | ||
337 | 337 | ||
338 | 338 | func finishGameData (origGameData,gameStatus,rand,winByTimeout,xCoord,yCoord,prizeIndex) = { | |
339 | 339 | let finishGameData = formatGameDataS(gameStatus, origGameData[IdxPlayerChoice], origGameData[IdxPlayerPubKey58], origGameData[IdxStartedHeight], origGameData[IdxWinAmount], origGameData[IdxAssetId], rand, toString(xCoord), toString(yCoord), toString(prizeIndex)) | |
340 | 340 | if (winByTimeout) | |
341 | 341 | then (finishGameData + "_TIMEOUT") | |
342 | 342 | else finishGameData | |
343 | 343 | } | |
344 | 344 | ||
345 | 345 | ||
346 | 346 | func extractGameData (gameId) = split(match getString(this, gameId) { | |
347 | 347 | case str: String => | |
348 | 348 | str | |
349 | 349 | case _ => | |
350 | 350 | throw((("Game: " + gameId) + " not found.")) | |
351 | 351 | }, "_") | |
352 | 352 | ||
353 | 353 | ||
354 | 354 | @Callable(i) | |
355 | 355 | func constructorV1 (rsaPublic64,benzAddress,randOracleTimeFrame,tokensDescriptor) = if ((i.caller != this)) | |
356 | 356 | then throw("not authorized") | |
357 | 357 | else { | |
358 | 358 | func splitter (acc,elem) = { | |
359 | 359 | let tokList = split(elem, ":") | |
360 | 360 | if ((size(tokList) != 3)) | |
361 | 361 | then throw("Invalid asset record") | |
362 | 362 | else $Tuple3((acc._1 :+ tokList[idxAssets]), (acc._2 :+ tokList[idxDecimals]), (acc._3 :+ tokList[idxDividers])) | |
363 | 363 | } | |
364 | 364 | ||
365 | 365 | let r = { | |
366 | 366 | let $l = split_4C(tokensDescriptor, "_") | |
367 | 367 | let $s = size($l) | |
368 | 368 | let $acc0 = $Tuple3(nil, nil, nil) | |
369 | 369 | func $f0_1 ($a,$i) = if (($i >= $s)) | |
370 | 370 | then $a | |
371 | 371 | else splitter($a, $l[$i]) | |
372 | 372 | ||
373 | 373 | func $f0_2 ($a,$i) = if (($i >= $s)) | |
374 | 374 | then $a | |
375 | 375 | else throw("List size exceeds 10") | |
376 | 376 | ||
377 | 377 | $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5), 6), 7), 8), 9), 10) | |
378 | 378 | } | |
379 | 379 | [StringEntry(RSAPUBLIC64KEY, rsaPublic64), StringEntry(SERVERADDRESSKEY, benzAddress), IntegerEntry(RANDTIMEFRAMEKEY, randOracleTimeFrame), StringEntry(allowedAssetsKey, makeString_2C(r._1, SEP)), StringEntry(assetsDecimalsKey, makeString(r._2, SEP)), StringEntry(betDividersKey, makeString(r._3, SEP))] | |
380 | 380 | } | |
381 | 381 | ||
382 | 382 | ||
383 | 383 | ||
384 | 384 | @Callable(i) | |
385 | 385 | func maintenance (blocked) = if ((i.caller != SERVER)) | |
386 | 386 | then throw("not authorized") | |
387 | 387 | else [BooleanEntry(blockedKey, blocked)] | |
388 | 388 | ||
389 | 389 | ||
390 | 390 | ||
391 | 391 | @Callable(i) | |
392 | 392 | func bet (playerChoice) = if (valueOrElse(getBoolean(blockedKey), false)) | |
393 | 393 | then throw("Game is stopped for maintenence") | |
394 | 394 | else { | |
395 | 395 | let gameId = toBase58String(i.transactionId) | |
396 | 396 | if ((1 >= size(i.payments))) | |
397 | 397 | then throw("2 payments must be attached") | |
398 | 398 | else if (isDefined(getString(this, gameId))) | |
399 | 399 | then throw((("Bet for: " + gameId) + " was already made.")) | |
400 | 400 | else { | |
401 | 401 | let betPmt = value(i.payments[0]) | |
402 | 402 | let feePmt = value(i.payments[1]) | |
403 | 403 | if (isDefined(feePmt.assetId)) | |
404 | 404 | then throw("feePmt (2nd payment) assetId must be in Waves") | |
405 | 405 | else if ((MINFEEWAVES > feePmt.amount)) | |
406 | 406 | then throw("feePmt (2nd payment) must be >= 0.005 Waves") | |
407 | 407 | else { | |
408 | 408 | let assetIdStr = assetIdToStr(betPmt.assetId) | |
409 | 409 | let internalAssetIdx = validateAndGetAssetIdx(assetIdStr) | |
410 | 410 | let commission = feePmt.amount | |
411 | 411 | let winAmount = validateBetAndGetWinAmount(betPmt.amount, internalAssetIdx, playerChoice) | |
412 | 412 | let playerPubKey58 = toBase58String(i.callerPublicKey) | |
413 | 413 | let gameData = formatGameData(STATESUBMITTED, playerChoice, playerPubKey58, height, winAmount, internalAssetIdx, "", -1, -1, -1) | |
414 | 414 | [IntegerEntry(keyReservationByAssetIdx(internalAssetIdx), increaseReserveAmount(winAmount, internalAssetIdx)), incrementInt(GAMESCOUNTERKEY), StringEntry(gameId, gameData), ScriptTransfer(SERVER, commission, feePmt.assetId)] | |
415 | 415 | } | |
416 | 416 | } | |
417 | 417 | } | |
418 | 418 | ||
419 | 419 | ||
420 | 420 | ||
421 | 421 | @Callable(i) | |
422 | 422 | func withdraw (gameId,rsaSign) = { | |
423 | 423 | let gameData = extractGameData(gameId) | |
424 | 424 | let gameState = gameData[IdxGameState] | |
425 | 425 | let playerChoice = gameData[IdxPlayerChoice] | |
426 | 426 | let startedHeight = parseIntValue(gameData[IdxStartedHeight]) | |
427 | 427 | let winAmount = parseIntValue(gameData[IdxWinAmount]) | |
428 | 428 | let assetIdx = parseIntValue(gameData[IdxAssetId]) | |
429 | 429 | let playerPubKey58 = gameData[IdxPlayerPubKey58] | |
430 | 430 | let playerAddress = addressFromPublicKey(fromBase58String(playerPubKey58)) | |
431 | 431 | if ((gameState != STATESUBMITTED)) | |
432 | 432 | then throw("Invalid game state for passed gameId") | |
433 | 433 | else if ((i.caller != SERVER)) | |
434 | 434 | then throw("Regular withdraw can be done by server only") | |
435 | 435 | else { | |
436 | 436 | let winByTimeout = ((height - startedHeight) > RANDORACLETIMEFRAME) | |
437 | 437 | let randChoice = if (winByTimeout) | |
438 | 438 | then take(playerChoice, 1) | |
439 | 439 | else generateRandChoice(gameId, rsaSign) | |
440 | 440 | let playerWin = isPlayerWin(playerChoice, randChoice) | |
441 | 441 | let newGameStatus = if (playerWin) | |
442 | 442 | then STATEWON | |
443 | 443 | else STATELOST | |
444 | 444 | let coords = if (playerWin) | |
445 | 445 | then [-(M4), -(M4)] | |
446 | 446 | else getCoords(gameId, rsaSign) | |
447 | 447 | let prizeIndex = if (playerWin) | |
448 | 448 | then -1 | |
449 | 449 | else getDecorationIndex(gameId, rsaSign) | |
450 | 450 | let x = (coords[0] / M4) | |
451 | 451 | let y = (coords[1] / M4) | |
452 | 452 | let newGameData = finishGameData(gameData, newGameStatus, randChoice, winByTimeout, x, y, prizeIndex) | |
453 | 453 | let oldHistory = valueOrElse(getString(historyKey), "") | |
454 | 454 | let newHistory = ((if ((oldHistory == "")) | |
455 | 455 | then "" | |
456 | 456 | else (oldHistory + "_")) + makeString([toString(x), toString(y), toString(prizeIndex)], ":")) | |
457 | 457 | ([StringEntry(gameId, newGameData), decreaseReservedAmount(gameId, assetIdx, winAmount), StringEntry(historyKey, "")] ++ (if (playerWin) | |
458 | 458 | then [ScriptTransfer(playerAddress, winAmount, assetIdFromStr(ASSETS[assetIdx]))] | |
459 | 459 | else nil)) | |
460 | 460 | } | |
461 | 461 | } | |
462 | 462 | ||
463 | 463 | ||
464 | 464 | @Verifier(tx) | |
465 | 465 | func verify () = if (sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey)) | |
466 | 466 | then match tx { | |
467 | 467 | case ttx: TransferTransaction => | |
468 | 468 | let assetIdx = validateAndGetAssetIdx(assetIdToStr(ttx.assetId)) | |
469 | 469 | ((getAssetBalance(ttx.assetId) - ttx.amount) >= getIntOr(keyReservationByAssetIdx(assetIdx), 0)) | |
470 | 470 | case stx: SetScriptTransaction => | |
471 | 471 | func checker (acc,asset) = if (acc) | |
472 | 472 | then (getIntOr(keyReservationByAssetStr(asset), 0) == 0) | |
473 | 473 | else false | |
474 | 474 | ||
475 | 475 | let $l = ASSETS | |
476 | 476 | let $s = size($l) | |
477 | 477 | let $acc0 = true | |
478 | 478 | func $f0_1 ($a,$i) = if (($i >= $s)) | |
479 | 479 | then $a | |
480 | 480 | else checker($a, $l[$i]) | |
481 | 481 | ||
482 | 482 | func $f0_2 ($a,$i) = if (($i >= $s)) | |
483 | 483 | then $a | |
484 | 484 | else throw("List size exceeds 10") | |
485 | 485 | ||
486 | 486 | $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5), 6), 7), 8), 9), 10) | |
487 | 487 | case itx: InvokeScriptTransaction => | |
488 | 488 | if ((itx.dApp == this)) | |
489 | 489 | then (itx.function == "constructorV1") | |
490 | 490 | else false | |
491 | 491 | case _ => | |
492 | 492 | false | |
493 | 493 | } | |
494 | 494 | else false | |
495 | 495 |
github/deemru/w8io/026f985 66.19 ms ◑