tx · CLkt2Pv4NSBZtBj5TdfVXrZ6em71oni56eEGXRCsV8Hc

3Mungn3ygy3DzpbDUKPbJQaeNKfQHu9fkK8:  -0.11200000 Waves

2022.11.16 13:00 [2319520] smart account 3Mungn3ygy3DzpbDUKPbJQaeNKfQHu9fkK8 > SELF 0.00000000 Waves

{ "type": 13, "id": "CLkt2Pv4NSBZtBj5TdfVXrZ6em71oni56eEGXRCsV8Hc", "fee": 11200000, "feeAssetId": null, "timestamp": 1668592824469, "version": 2, "chainId": 84, "sender": "3Mungn3ygy3DzpbDUKPbJQaeNKfQHu9fkK8", "senderPublicKey": "6L7iBerXuPa5E74WCM6fLSB2VM1bMG9jgASH8tu9orHN", "proofs": [ "4vog1zUZtq8YxFPcizTCi1UYT1ykhcmZTwfLTnPManWxnzRZ2k2hXhXX82yM4pvTna8pooWmFoFuBXjpEfXbhwwJ" ], "script": "base64:BgIoCAISBwoFAQgBAQgSBgoEAQEICBIDCgEBEgQKAgEIEgQKAhEYEgASACsAD0dBTUVfVFlQRV9HUk9VUAIFR3JvdXAAEUdBTUVfVFlQRV9QTEFUT0ZGAghQbGF5LW9mZgAKR0FNRV9UWVBFUwkAzAgCBQ9HQU1FX1RZUEVfR1JPVVAJAMwIAgURR0FNRV9UWVBFX1BMQVRPRkYFA25pbAAEVVNEVAEgbySjyqsw3FIpmOgsYVruWn8jTcItdbvpnapU4NLQB8EAB01JTl9CRVQAwIQ9AAhPTkVfSE9VUgkAaAIJAGgCAAUAPADoBwARTU9ORVlfQk9YX0FERFJFRVMJAQdBZGRyZXNzAQEaAVSxYgy7BRV2F+zuKtUZtXyHmoiep9yqU84AB0JFVF9GRUUA9AMACUZFRV9TQ0FMRQCQTgAHa0FjdGl2ZQIGYWN0aXZlAAtrQWN0aXZlR2xvYgIUYWN0aXZlX2FsbF9jb250cmFjdHMABmtDYXVzZQIOc2h1dGRvd25fY2F1c2UADWtHYW1lU3RyYVRpbWUCDl9zdGFydEdhbWVUaW1lAAlrR2FtZVR5c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kAzQgCBQxnYW1lc0VudHJpZXMJAQxJbnRlZ2VyRW50cnkCBQtrTGFzdEdhbWVJZAUHbmV3TEdJZAFpAQhzaHV0ZG93bgADCQEBIQEFBmFjdGl2ZQkAAgEJAKwCAgIiREFwcCBpcyBhbHJlYWR5IHN1c3BlbmRlZC4gQ2F1c2U6IAkBC3ZhbHVlT3JFbHNlAgkAnQgCBQR0aGlzBQZrQ2F1c2UCGnRoZSBjYXVzZSB3YXNuJ3Qgc3BlY2lmaWVkAwkBASEBCQEPY29udGFpbnNFbGVtZW50AgkAzAgCBQxhZG1pblB1YktleTEJAMwIAgUMYWRtaW5QdWJLZXkyCQDMCAIFDGFkbWluUHViS2V5MwUDbmlsCAUBaQ9jYWxsZXJQdWJsaWNLZXkJAAIBAiFPbmx5IGFkbWluIGNhbiBjYWxsIHRoaXMgZnVuY3Rpb24JAQdzdXNwZW5kAQIPUGF1c2VkIGJ5IGFkbWluAWkBCGFjdGl2YXRlAAMFBmFjdGl2ZQkAAgECFkRBcHAgaXMgYWxyZWFkeSBhY3RpdmUDCQEBIQEJAQ9jb250YWluc0VsZW1lbnQCCQDMCAIFDGFkbWluUHViS2V5MQkAzAgCBQxhZG1pblB1YktleTIJAMwIAgUMYWRtaW5QdWJLZXkzBQNuaWwIBQFpD2NhbGxlclB1YmxpY0tleQkAAgECIU9ubHkgYWRtaW4gY2FuIGNhbGwgdGhpcyBmdW5jdGlvbgkAzAgCCQEMQm9vbGVhbkVudHJ5AgUHa0FjdGl2ZQYJAMwIAgkBC0RlbGV0ZUVudHJ5AQUGa0NhdXNlBQNuaWwAxmce5Q==", "height": 2319520, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 2BsK41cRUTmGFMd2P2aPTgKX8didF1h9uQtL5GDYh78G Next: none Full:
OldNewDifferences
11 {-# STDLIB_VERSION 6 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
44 let GAME_TYPE_GROUP = "Group"
55
66 let GAME_TYPE_PLATOFF = "Play-off"
77
88 let GAME_TYPES = [GAME_TYPE_GROUP, GAME_TYPE_PLATOFF]
99
1010 let USDT = base58'8UrfDVd5GreeUwm7uPk7eYz1eMv376kzR52C6sANPkwS'
1111
1212 let MIN_BET = 1000000
1313
1414 let ONE_HOUR = ((5 * 60) * 1000)
1515
1616 let MONEY_BOX_ADDREES = Address(base58'3N65zqVKchaFdW4gS7FxCRibjfkVgJvo7PT')
1717
1818 let BET_FEE = 500
1919
2020 let FEE_SCALE = 10000
2121
2222 let kActive = "active"
2323
2424 let kActiveGlob = "active_all_contracts"
2525
2626 let kCause = "shutdown_cause"
2727
2828 let kGameStraTime = "_startGameTime"
2929
3030 let kGameType = "_GameType"
3131
3232 let kLastGameId = "last_game_id"
3333
3434 let kTotalBets = "_totalBets"
3535
3636 let kToWinA = "_toWinA"
3737
3838 let kToWinB = "_toWinB"
3939
4040 let kOnDraw = "_onDraw"
4141
4242 let kGameResult = "_result"
4343
4444 let kBank = "_bank"
4545
4646 let kFinalTime = "_finalTime"
4747
4848 let kTotalBetsForType = "_totalBetsForType"
4949
5050 let kUserBet = "_userBet"
5151
5252 let kUserRefId = "_refId"
5353
5454 let kUserClaimed = "_claimed"
5555
5656 let kAdminPubKey1 = "admin_pub_1"
5757
5858 let kAdminPubKey2 = "admin_pub_2"
5959
6060 let kAdminPubKey3 = "admin_pub_3"
6161
6262 let oracle = Address(base58'3PEbqViERCoKnmcSULh6n2aiMvUdSQdCsom')
6363
6464 func getBase58FromOracle (key) = match getString(oracle, key) {
6565 case string: String =>
6666 fromBase58String(string)
6767 case nothing =>
6868 throw((key + "is empty"))
6969 }
7070
7171
7272 let adminPubKey1 = getBase58FromOracle(kAdminPubKey1)
7373
7474 let adminPubKey2 = getBase58FromOracle(kAdminPubKey2)
7575
7676 let adminPubKey3 = getBase58FromOracle(kAdminPubKey3)
7777
7878 let active = valueOrElse(getBoolean(this, kActive), true)
7979
8080 let activeGlob = valueOrElse(getBoolean(oracle, kActiveGlob), true)
8181
8282 func isActive () = if (if (active)
8383 then activeGlob
8484 else false)
8585 then unit
8686 else throw("DApp is inactive at this moment")
8787
8888
8989 func isAdminCall (i) = if (containsElement([adminPubKey1, adminPubKey2, adminPubKey3], i.callerPublicKey))
9090 then unit
9191 else throw("Only admin can call this function")
9292
9393
9494 func suspend (cause) = [BooleanEntry(kActive, false), StringEntry(kCause, cause)]
9595
9696
9797 func getUserBetKey (user,gameId,type,result) = (((((((user + "_") + toString(gameId)) + "_") + toString(type)) + "_") + result) + kUserBet)
9898
9999
100100 func getTotalBetsForTypeKey (gameId,type,result) = (((((toString(gameId) + "_") + toString(type)) + "_") + result) + kTotalBetsForType)
101101
102102
103103 func validateBet (gameType,type,result) = if ((type == 1))
104104 then if ((size(result) != 1))
105105 then throw("Game result must contain only one letter: A,B,D")
106106 else if (!(contains("ABD", result)))
107107 then throw("Game result must contain only one letter: A,B,D")
108108 else if (if ((gameType == GAME_TYPE_PLATOFF))
109109 then !(contains("AB", result))
110110 else false)
111111 then throw("Game result must contain only one letter: A,B")
112112 else true
113113 else if ((type == 2))
114114 then {
115115 let splited = split(result, "_")
116116 if ((size(splited) != 2))
117117 then throw("Inncorrect game result")
118118 else {
119119 let ballsA = valueOrErrorMessage(parseInt(splited[0]), "Inncorrect game result")
120120 let ballsB = valueOrErrorMessage(parseInt(splited[1]), "Inncorrect game result")
121121 if ((ballsA == ballsB))
122122 then throw("Inncorrect game result. A and B cannot be equal")
123123 else true
124124 }
125125 }
126126 else if ((type == 3))
127127 then {
128128 let splited = split(result, "_")
129129 if ((size(splited) != 2))
130130 then throw("Inncorrect game result")
131131 else {
132132 let team = splited[0]
133133 let ballsAmount = valueOrErrorMessage(parseInt(splited[1]), "Inncorrect game result")
134134 if ((0 >= ballsAmount))
135135 then throw("Inncorrect game result, balls amount must be greater then 0")
136136 else if (if ((size(team) != 1))
137137 then true
138138 else !(contains("AB", team)))
139139 then throw("Game result must contain only one letter: A,B")
140140 else true
141141 }
142142 }
143143 else false
144144
145145
146146 func calcClaim (gameId,userAddress,result,type,amount) = {
147147 let spldRes = split(result, "_")
148148 let $t039684494 = if ((type == 1))
149149 then if ((result == "A"))
150150 then $Tuple3("1_0", 1, 0)
151151 else if ((result == "B"))
152152 then $Tuple3("0_1", 0, 1)
153153 else $Tuple3("1_1", 1, 1)
154154 else if ((type == 2))
155155 then $Tuple3(result, parseIntValue(spldRes[0]), parseIntValue(spldRes[1]))
156156 else if ((type == 3))
157157 then if ((spldRes[0] == "A"))
158158 then $Tuple3((spldRes[1] + "_0"), parseIntValue(spldRes[1]), 0)
159159 else $Tuple3(("0_" + spldRes[1]), 0, parseIntValue(spldRes[1]))
160160 else $Tuple3(result, parseIntValue(spldRes[0]), parseIntValue(spldRes[1]))
161161 let gameResult = $t039684494._1
162162 let ballsA = $t039684494._2
163163 let ballsB = $t039684494._3
164164 let diff = if ((ballsA > ballsB))
165165 then (ballsA - ballsB)
166166 else (ballsB - ballsA)
167167 let winner = if ((ballsA > ballsB))
168168 then "A"
169169 else if ((ballsB > ballsA))
170170 then "B"
171171 else "D"
172172 let G1 = (valueOrElse(getInteger(this, getTotalBetsForTypeKey(gameId, 1, winner)), 0) + (if ((type == 1))
173173 then amount
174174 else 0))
175175 let G2 = (valueOrElse(getInteger(this, getTotalBetsForTypeKey(gameId, 2, gameResult)), 0) + (if ((type == 2))
176176 then amount
177177 else 0))
178178 let G3 = (valueOrElse(getInteger(this, getTotalBetsForTypeKey(gameId, 3, ((winner + "_") + toString(diff)))), 0) + (if ((type == 3))
179179 then amount
180180 else 0))
181181 let totalWinValue = ((G1 + G2) + G3)
182182 let totalBets = (valueOrElse(getInteger(this, (toString(gameId) + kTotalBets)), 0) + amount)
183183 let bankWithFee = (totalBets - totalWinValue)
184184 let fee = fraction(bankWithFee, BET_FEE, FEE_SCALE)
185185 let B = (bankWithFee - fee)
186186 let UB1 = (valueOrElse(getInteger(this, getUserBetKey(userAddress, gameId, 1, winner)), 0) + (if ((type == 1))
187187 then amount
188188 else 0))
189189 let UB2 = (valueOrElse(getInteger(this, getUserBetKey(userAddress, gameId, 2, gameResult)), 0) + (if ((type == 2))
190190 then amount
191191 else 0))
192192 let UB3 = (valueOrElse(getInteger(this, getUserBetKey(userAddress, gameId, 3, ((winner + "_") + toString(diff)))), 0) + (if ((type == 3))
193193 then amount
194194 else 0))
195195 let totalWinValueMax = ((G1 + (G2 * 3)) + (G3 * 2))
196196 let D1 = if ((G1 == 0))
197197 then 0
198198 else fraction((G1 + fraction((G1 * B), 1, totalWinValueMax)), UB1, G1)
199199 let D2 = if ((G2 == 0))
200200 then 0
201201 else fraction((G2 + fraction((G2 * B), 3, totalWinValueMax)), UB2, G2)
202202 let D3 = if ((G3 == 0))
203203 then 0
204204 else fraction((G3 + fraction((G3 * B), 2, totalWinValueMax)), UB3, G3)
205205 let claimAmount = if ((B == 0))
206206 then ((UB1 + UB2) + UB3)
207207 else ((D1 + D2) + D3)
208208 claimAmount
209209 }
210210
211211
212212 @Callable(i)
213213 func potentialWinnings (gameId,userAddress,amount,type,result) = {
214214 let claimAmount = calcClaim(gameId, userAddress, result, type, amount)
215215 $Tuple2(nil, claimAmount)
216216 }
217217
218218
219219
220220 @Callable(i)
221221 func bet (gameId,type,result,refId) = valueOrElse(isActive(), {
222222 let user = toString(i.caller)
223223 let gIdStr = toString(gameId)
224224 let $t065166591 = $Tuple2(i.payments[0].amount, i.payments[0].assetId)
225225 let pmtAmount = $t065166591._1
226226 let pmtAssetId = $t065166591._2
227227 let gameStartTime = valueOrElse(getInteger(this, (toString(gameId) + kGameStraTime)), 0)
228228 let gameType = getStringValue(this, (toString(gameId) + kGameType))
229229 if ((pmtAssetId != USDT))
230230 then throw("Pamyment must be In USDT asset")
231231 else if ((MIN_BET > pmtAmount))
232232 then throw((("Min bet " + toString((MIN_BET / 1000000))) + "USDT"))
233233 else if ((gameStartTime == 0))
234234 then throw(("There is no game with id" + toString(gameId)))
235235 else if (((lastBlock.timestamp + ONE_HOUR) >= gameStartTime))
236236 then throw("Bets on this game are no longer accepted")
237237 else if (!(validateBet(gameType, type, result)))
238238 then throw("Incorrect bet type")
239239 else {
240240 let spldRes = split(result, "_")
241241 let userBetKey = getUserBetKey(user, gameId, type, result)
242242 let totalBetsForTypeBetKey = getTotalBetsForTypeKey(gameId, type, result)
243243 let userBet = (valueOrElse(getInteger(this, userBetKey), 0) + pmtAmount)
244244 let totalBetsForTypeBet = (valueOrElse(getInteger(this, totalBetsForTypeBetKey), 0) + pmtAmount)
245245 let totalBets = (valueOrElse(getInteger(this, (gIdStr + kTotalBets)), 0) + pmtAmount)
246246 let toWinA = (valueOrElse(getInteger(this, (gIdStr + kToWinA)), 0) + (if (if ((type == 1))
247247 then (result == "A")
248248 else false)
249249 then pmtAmount
250250 else if (if ((type == 2))
251251 then (parseIntValue(spldRes[0]) > parseIntValue(spldRes[1]))
252252 else false)
253253 then pmtAmount
254254 else if (if ((type == 3))
255255 then (spldRes[0] == "A")
256256 else false)
257257 then pmtAmount
258258 else 0))
259259 let toWinB = (valueOrElse(getInteger(this, (gIdStr + kToWinB)), 0) + (if (if ((type == 1))
260260 then (result == "B")
261261 else false)
262262 then pmtAmount
263263 else if (if ((type == 2))
264264 then (parseIntValue(spldRes[1]) > parseIntValue(spldRes[0]))
265265 else false)
266266 then pmtAmount
267267 else if (if ((type == 3))
268268 then (spldRes[0] == "B")
269269 else false)
270270 then pmtAmount
271271 else 0))
272272 let onDraw = (valueOrElse(getInteger(this, (gIdStr + kOnDraw)), 0) + (if (if ((type == 1))
273273 then (result == "D")
274274 else false)
275275 then pmtAmount
276276 else 0))
277277 ([IntegerEntry(userBetKey, userBet), IntegerEntry(totalBetsForTypeBetKey, totalBetsForTypeBet), IntegerEntry((gIdStr + kTotalBets), totalBets), IntegerEntry((gIdStr + kToWinA), toWinA), IntegerEntry((gIdStr + kToWinB), toWinB), IntegerEntry((gIdStr + kOnDraw), onDraw)] ++ (if (!(isDefined(getString(this, (user + kUserRefId)))))
278278 then [StringEntry((user + kUserRefId), refId)]
279279 else nil))
280280 }
281281 })
282282
283283
284284
285285 @Callable(i)
286286 func claim (gameId) = valueOrElse(isActive(), {
287287 let user = toString(i.caller)
288288 let gIdStr = toString(gameId)
289289 let finalTime = valueOrErrorMessage(getInteger(this, (gIdStr + kFinalTime)), "You can claim only after game finish")
290290 if (((finalTime + ONE_HOUR) > lastBlock.timestamp))
291291 then throw("You can claim only after one hour pass after final time")
292292 else if (isDefined(getBoolean(this, (((user + "_") + gIdStr) + kUserClaimed))))
293293 then throw("You are alredy claimed")
294294 else {
295295 let gameResult = getStringValue(this, (gIdStr + kGameResult))
296296 let claimAmount = calcClaim(gameId, user, gameResult, 0, 0)
297297 if ((claimAmount == 0))
298298 then throw("Nothing to claim")
299299 else $Tuple2([BooleanEntry((((user + "_") + gIdStr) + kUserClaimed), true), ScriptTransfer(i.caller, claimAmount, USDT)], claimAmount)
300300 }
301301 })
302302
303303
304304
305305 @Callable(i)
306306 func gameSummary (gameId,result) = {
307307 let gIdStr = toString(gameId)
308308 let gameStartTime = valueOrElse(getInteger(this, (toString(gameId) + kGameStraTime)), 0)
309309 if ((gameStartTime == 0))
310310 then throw(("There is no game with id" + toString(gameId)))
311311 else {
312312 let spldRes = split(result, "_")
313313 let ballsA = valueOrErrorMessage(parseInt(spldRes[0]), "Inncorrect game result")
314314 let ballsB = valueOrErrorMessage(parseInt(spldRes[1]), "Inncorrect game result")
315315 let diff = if ((ballsA > ballsB))
316316 then (ballsA - ballsB)
317317 else (ballsB - ballsA)
318318 let winner = if ((ballsA > ballsB))
319319 then "A"
320320 else if ((ballsB > ballsA))
321321 then "B"
322322 else "D"
323323 let totalWinType1 = valueOrElse(getInteger(this, getTotalBetsForTypeKey(gameId, 1, winner)), 0)
324324 let totalWinType2 = valueOrElse(getInteger(this, getTotalBetsForTypeKey(gameId, 2, result)), 0)
325325 let totalWinType3 = valueOrElse(getInteger(this, getTotalBetsForTypeKey(gameId, 3, ((winner + "_") + toString(diff)))), 0)
326326 let totalWinValue = ((totalWinType1 + totalWinType2) + totalWinType3)
327327 let totalBets = valueOrElse(getInteger(this, (toString(gameId) + kTotalBets)), 0)
328328 let bankWithFee = (totalBets - totalWinValue)
329329 let $t01065310811 = if ((totalWinValue == 0))
330330 then $Tuple2(bankWithFee, 0)
331331 else {
332332 let f = fraction(bankWithFee, BET_FEE, FEE_SCALE)
333333 $Tuple2(f, (bankWithFee - f))
334334 }
335335 let fee = $t01065310811._1
336336 let bank = $t01065310811._2
337337 [StringEntry((gIdStr + kGameResult), result), IntegerEntry((gIdStr + kBank), bank), IntegerEntry((gIdStr + kFinalTime), lastBlock.timestamp), ScriptTransfer(MONEY_BOX_ADDREES, fee, USDT)]
338338 }
339339 }
340340
341341
342342
343343 @Callable(i)
344344 func initGames (startGameTimes,types) = {
345345 func initGame (acc,startGameTime) = {
346346 let $t01119511229 = acc
347347 let entries = $t01119511229._1
348348 let lastGameId = $t01119511229._2
349349 let j = $t01119511229._3
350350 let newGameId = (lastGameId + 1)
351351 if ((lastBlock.timestamp > startGameTime))
352352 then throw("startGameTime must be in the future")
353353 else if (!(containsElement(GAME_TYPES, types[j])))
354354 then throw(("type must contain one of values: " + makeString(GAME_TYPES, ",")))
355355 else {
356356 let gameEntries = [IntegerEntry((toString(newGameId) + kGameStraTime), startGameTime), StringEntry((toString(newGameId) + kGameType), types[j])]
357357 $Tuple3((entries ++ gameEntries), newGameId, (j + 1))
358358 }
359359 }
360360
361361 let lastGameId = valueOrElse(getInteger(this, kLastGameId), 0)
362362 let $t01177211857 = {
363363 let $l = startGameTimes
364364 let $s = size($l)
365365 let $acc0 = $Tuple3(nil, lastGameId, 0)
366366 func $f0_1 ($a,$i) = if (($i >= $s))
367367 then $a
368368 else initGame($a, $l[$i])
369369
370370 func $f0_2 ($a,$i) = if (($i >= $s))
371371 then $a
372372 else throw("List size exceeds 50")
373373
374374 $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($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($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($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), 16), 17), 18), 19), 20), 21), 22), 23), 24), 25), 26), 27), 28), 29), 30), 31), 32), 33), 34), 35), 36), 37), 38), 39), 40), 41), 42), 43), 44), 45), 46), 47), 48), 49), 50)
375375 }
376376 let gamesEntries = $t01177211857._1
377377 let newLGId = $t01177211857._2
378378 (gamesEntries :+ IntegerEntry(kLastGameId, newLGId))
379379 }
380380
381381
382382
383383 @Callable(i)
384384 func shutdown () = if (!(active))
385385 then throw(("DApp is already suspended. Cause: " + valueOrElse(getString(this, kCause), "the cause wasn't specified")))
386386 else if (!(containsElement([adminPubKey1, adminPubKey2, adminPubKey3], i.callerPublicKey)))
387387 then throw("Only admin can call this function")
388388 else suspend("Paused by admin")
389389
390390
391391
392392 @Callable(i)
393393 func activate () = if (active)
394394 then throw("DApp is already active")
395395 else if (!(containsElement([adminPubKey1, adminPubKey2, adminPubKey3], i.callerPublicKey)))
396396 then throw("Only admin can call this function")
397397 else [BooleanEntry(kActive, true), DeleteEntry(kCause)]
398398
399399

github/deemru/w8io/026f985 
50.13 ms