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