tx · FgmELiD9KD7JgNjQNkfjA4S77Ng9obN8tRKcmgywuVpy

3N2u2njp9aqxBqJPtEYDfmoW7vu5vtjqn9A:  -0.01500000 Waves

2019.07.11 12:05 [580828] smart account 3N2u2njp9aqxBqJPtEYDfmoW7vu5vtjqn9A > SELF 0.00000000 Waves

{ "type": 13, "id": "FgmELiD9KD7JgNjQNkfjA4S77Ng9obN8tRKcmgywuVpy", "fee": 1500000, "feeAssetId": null, "timestamp": 1562835995898, "version": 1, "sender": "3N2u2njp9aqxBqJPtEYDfmoW7vu5vtjqn9A", "senderPublicKey": "9PgwurhsEwWCkXp5Seqm2HwWBGaSL3Dj1HJvXqWx6MYg", "proofs": [ "4qprHtooJME5h3Su9Cc2i6qcZ9KRUSfhez75DfHUFQW3nocYpaAXfyuVG6nrWVo3GvaV5syDsEPjDzGDcty4oz4t" ], "script": "base64:AAIDAAAAAAAAAAAAAAAvAAAAAAdXQVZFTEVUCQAAaAAAAAIJAABoAAAAAgAAAAAAAAAAZAAAAAAAAAAD6AAAAAAAAAAD6AAAAAAKQ09NTUlTU0lPTgkAAGkAAAACCQAAaAAAAAIAAAAAAAAAAAUFAAAAB1dBVkVMRVQAAAAAAAAAA+gAAAAACVJTQVBVQkxJQwkAAlsAAAABAgAAAY9iYXNlNjQ6TUlJQklqQU5CZ2txaGtpRzl3MEJBUUVGQUFPQ0FROEFNSUlCQ2dLQ0FRRUFxbEFpQU5TbUJwREhZS1A5c0tnZU4vbDFiQWIyOGcvdEdsZ0Rrd1Q1RmlNTjRYM3B3ZHZkeEU3bXZTUjgvNDFkVTlyeDRqRys2dFpwYjFVTFZEUHM0MzF0UjJJUmFUWHc1Q2orQWMydmhMKzVKYW1DZXJHRDFVVytiaC9FR1F0eG84VzNZTERyb2ZYQjVRSEp4NFBrejJLZ2Yrb1MvQzhoSHVCL1U0a3JPNzZVMDUwN0dUalpQUDlrUlEwdUxTTWVxUVh0OHdYUytuTXA1d2FqcXhQcERMTWFTUkVnc0t3di9BRWt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QAAAAAAwkAAAEAAAACBQAAAAckbWF0Y2gwAgAAABRTZXRTY3JpcHRUcmFuc2FjdGlvbgQAAAADc3R4BQAAAAckbWF0Y2gwAwkAAAAAAAACCQEAAAAISXNEQXBwVXAAAAAABwkAAAAAAAACCQEAAAASRXh0cmFjdFJlc2VydmVkQW10AAAAAAAAAAAAAAAAAAcHByraX3Q=", "chainId": 84, "height": 580828, "spentComplexity": 0 } View: original | compacted Prev: EBCWccZKYwchPyws5Z1Z9Kp2H2CUaduw9nA4VZ6XW9Vq Next: none Diff:
OldNewDifferences
99
1010 let SERVER = addressFromStringValue("3NCiG28LmWyTigWG13E5QnvdHBsZFYXSS2j")
1111
12-let RANDORACLETIMEFRAME = 1
12+let RANDORACLETIMEFRAME = 2880
1313
1414 let MAXBALANCEDIFF = (70 * WAVELET)
1515
Full:
OldNewDifferences
11 {-# STDLIB_VERSION 3 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
44 let WAVELET = ((100 * 1000) * 1000)
55
66 let COMMISSION = ((5 * WAVELET) / 1000)
77
88 let RSAPUBLIC = fromBase64String("base64:MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAqlAiANSmBpDHYKP9sKgeN/l1bAb28g/tGlgDkwT5FiMN4X3pwdvdxE7mvSR8/41dU9rx4jG+6tZpb1ULVDPs431tR2IRaTXw5Cj+Ac2vhL+5JamCerGD1UW+bh/EGQtxo8W3YLDrofXB5QHJx4Pkz2Kgf+oS/C8hHuB/U4krO76U0507GTjZPP9kRQ0uLSMeqQXt8wXS+nMp5wajqxPpDLMaSREgsKwv/AEkP4dzpTYbikLBYl4qtdJsD84HLFSkiwd3BhcOrPjoIYmLxQuBD5TIMKTKD3sdZgaY9rsyqx3A00innyxD6zp3b4gFpUOX8JxKZdEC2myEqleNgg7GzwIDAQAB")
99
1010 let SERVER = addressFromStringValue("3NCiG28LmWyTigWG13E5QnvdHBsZFYXSS2j")
1111
12-let RANDORACLETIMEFRAME = 1
12+let RANDORACLETIMEFRAME = 2880
1313
1414 let MAXBALANCEDIFF = (70 * WAVELET)
1515
1616 let BET1 = (1 * WAVELET)
1717
1818 let BET2 = (2 * WAVELET)
1919
2020 let BET4 = (4 * WAVELET)
2121
2222 let BET8 = (8 * WAVELET)
2323
2424 let BET14 = (14 * WAVELET)
2525
2626 let RATEMULT = 10000
2727
2828 let RATE1 = 39655
2929
3030 let RATE2 = 24600
3131
3232 let RATE3 = 19000
3333
3434 let RATE4 = 14200
3535
3636 let RATE5 = 11400
3737
3838 let IdxGameState = 0
3939
4040 let IdxPlayerChoice = 1
4141
4242 let IdxPlayerPubKey58 = 2
4343
4444 let IdxStartedHeight = 3
4545
4646 let IdxWinAmt = 4
4747
4848 let IdxRandOrEmpty = 5
4949
5050 let RESERVATIONKEY = "$RESERVED_AMOUNT"
5151
5252 let GAMESCOUNTERKEY = "$GAME_NUM"
5353
5454 let DAPPUPKEY = "$DAPP_UP"
5555
5656 let MAXBALANCEKEY = "$MAX_BALANCE"
5757
5858 let STATESUBMITTED = "SUBMITTED"
5959
6060 let STATEWON = "WON"
6161
6262 let STATELOST = "LOST"
6363
6464 func IncrementGameNum () = {
6565 let gameNum = match getInteger(this, GAMESCOUNTERKEY) {
6666 case num: Int =>
6767 num
6868 case _ =>
6969 0
7070 }
7171 (gameNum + 1)
7272 }
7373
7474
7575 func ExtractReservedAmt () = match getInteger(this, RESERVATIONKEY) {
7676 case a: Int =>
7777 a
7878 case _ =>
7979 0
8080 }
8181
8282
8383 func ValidateAndIncreaseReservedAmt (winAmt) = {
8484 let newReservedAmount = (ExtractReservedAmt() + winAmt)
8585 let balance = wavesBalance(this)
8686 if ((newReservedAmount > balance))
8787 then throw("Insufficient funds on Dice Roller account. Transaction was rejected for your safety.")
8888 else newReservedAmount
8989 }
9090
9191
9292 func DecreaseReservedAmt (gameId,winAmt) = {
9393 let newReservedAmount = (ExtractReservedAmt() - winAmt)
9494 if ((0 > newReservedAmount))
9595 then throw("Invalid Dice Roller account state - reserved amount is less than 0")
9696 else DataEntry(RESERVATIONKEY, newReservedAmount)
9797 }
9898
9999
100100 func ValidateBetAndDefineWinAmt (betAmt,playerChoice) = {
101101 let betAmtValid = if (if (if (if ((betAmt == (BET1 + COMMISSION)))
102102 then true
103103 else (betAmt == (BET2 + COMMISSION)))
104104 then true
105105 else (betAmt == (BET4 + COMMISSION)))
106106 then true
107107 else (betAmt == (BET8 + COMMISSION)))
108108 then true
109109 else (betAmt == (BET14 + COMMISSION))
110110 if (betAmtValid)
111111 then {
112112 let dicesCount = size(playerChoice)
113113 let bet = (betAmt - COMMISSION)
114114 if ((dicesCount == 1))
115115 then ((bet * RATE1) / RATEMULT)
116116 else if ((dicesCount == 2))
117117 then ((bet * RATE2) / RATEMULT)
118118 else if ((dicesCount == 3))
119119 then ((bet * RATE3) / RATEMULT)
120120 else if ((dicesCount == 4))
121121 then ((bet * RATE4) / RATEMULT)
122122 else if ((dicesCount == 5))
123123 then ((bet * RATE5) / RATEMULT)
124124 else throw("Invalid dices count in player's choice")
125125 }
126126 else throw("Bet amount is not in range")
127127 }
128128
129129
130130 func RandToStr (r) = if ((r == 0))
131131 then "1"
132132 else if ((r == 1))
133133 then "2"
134134 else if ((r == 2))
135135 then "3"
136136 else if ((r == 3))
137137 then "4"
138138 else if ((r == 4))
139139 then "5"
140140 else if ((r == 5))
141141 then "6"
142142 else throw(("Unsupported r parameter passed: expected=[0,...,5] actual=" + toString(r)))
143143
144144
145145 func GenerateRandInt (gameId,rsaSign) = {
146146 let rsaSigValid = rsaVerify(SHA256, toBytes(gameId), rsaSign, RSAPUBLIC)
147147 if (rsaSigValid)
148148 then {
149149 let rand = (toInt(sha256(rsaSign)) % 6)
150150 if ((0 > rand))
151151 then (-1 * rand)
152152 else rand
153153 }
154154 else throw("Invalid RSA signature")
155155 }
156156
157157
158158 func IsPlayerWin (playerChoice,randStr) = {
159159 let s = size(playerChoice)
160160 if (if (if (if (if ((s >= 1))
161161 then (take(drop(playerChoice, 0), 1) == randStr)
162162 else false)
163163 then true
164164 else if ((s >= 2))
165165 then (take(drop(playerChoice, 1), 1) == randStr)
166166 else false)
167167 then true
168168 else if ((s >= 3))
169169 then (take(drop(playerChoice, 2), 1) == randStr)
170170 else false)
171171 then true
172172 else if ((s >= 4))
173173 then (take(drop(playerChoice, 3), 1) == randStr)
174174 else false)
175175 then true
176176 else if ((s == 5))
177177 then (take(drop(playerChoice, 4), 1) == randStr)
178178 else false
179179 }
180180
181181
182182 func FormatGameDataParam (p) = {
183183 let s = size(p)
184184 if ((s == 0))
185185 then throw("Parameter size must be greater then 0")
186186 else if ((s > 99))
187187 then throw("Parameter size must be less then 100")
188188 else if ((10 > s))
189189 then (("0" + toString(s)) + p)
190190 else (toString(s) + p)
191191 }
192192
193193
194194 func FormatGameDataStr (gameState,playerChoice,playerPubKey58,startedHeight,winAmt,randOrEmpty) = {
195195 let fullStateStr = ((((((((FormatGameDataParam(gameState) + "_") + FormatGameDataParam(playerChoice)) + "_") + FormatGameDataParam(playerPubKey58)) + "_") + FormatGameDataParam(toString(startedHeight))) + "_") + FormatGameDataParam(toString(winAmt)))
196196 if ((randOrEmpty == ""))
197197 then fullStateStr
198198 else ((fullStateStr + "_") + FormatGameDataParam(randOrEmpty))
199199 }
200200
201201
202202 func RemoveUnderscoreIfPresent (remaining) = if ((size(remaining) > 0))
203203 then drop(remaining, 1)
204204 else remaining
205205
206206
207207 func ParseNextAttribute (remaining) = {
208208 let s = size(remaining)
209209 if ((s > 0))
210210 then {
211211 let nn = parseIntValue(take(remaining, 2))
212212 let v = take(drop(remaining, 2), nn)
213213 let tmpRemaining = drop(remaining, (nn + 2))
214214 let remainingState = RemoveUnderscoreIfPresent(tmpRemaining)
215215 [v, remainingState]
216216 }
217217 else throw("Empty string was passed into parseNextAttribute func")
218218 }
219219
220220
221221 func ParseGameRawDataStr (rawStateStr) = {
222222 let gameState = ParseNextAttribute(rawStateStr)
223223 let playerChoice = ParseNextAttribute(gameState[1])
224224 let playerPubKey58 = ParseNextAttribute(playerChoice[1])
225225 let startedHeight = ParseNextAttribute(playerPubKey58[1])
226226 let winAmt = ParseNextAttribute(startedHeight[1])
227227 [gameState[0], playerChoice[0], playerPubKey58[0], startedHeight[0], winAmt[0]]
228228 }
229229
230230
231231 func ExtractGameDataList (gameId) = {
232232 let rawDataStr = match getString(this, gameId) {
233233 case str: String =>
234234 str
235235 case _ =>
236236 throw(("Couldn't find game by " + gameId))
237237 }
238238 ParseGameRawDataStr(rawDataStr)
239239 }
240240
241241
242242 func WinScriptSet (gameId,playerAddress,winAmt,newGameDataStr,winByTimeout,decreasedReserves) = {
243243 let wSetCommonData = [decreasedReserves]
244244 let tSetCommonData = [ScriptTransfer(playerAddress, winAmt, unit)]
245245 if (winByTimeout)
246246 then {
247247 let newGameDataStrAdjusted = ((newGameDataStr + "_") + FormatGameDataParam("TIMEOUT"))
248248 let gameData = DataEntry(gameId, newGameDataStrAdjusted)
249249 ScriptResult(WriteSet(gameData :: wSetCommonData), TransferSet(tSetCommonData))
250250 }
251251 else {
252252 let gameData = DataEntry(gameId, newGameDataStr)
253253 ScriptResult(WriteSet(gameData :: wSetCommonData), TransferSet(tSetCommonData))
254254 }
255255 }
256256
257257
258258 func IsDAppUp () = {
259259 let dAppUpOpt = getBoolean(this, DAPPUPKEY)
260260 if (isDefined(dAppUpOpt))
261261 then extract(dAppUpOpt)
262262 else false
263263 }
264264
265265
266266 func monitorMaxBalance () = {
267267 let maxBalanceOpt = getInteger(this, MAXBALANCEKEY)
268268 let maxBalance = if (isDefined(maxBalanceOpt))
269269 then extract(maxBalanceOpt)
270270 else 0
271271 let currBalance = wavesBalance(this)
272272 if ((currBalance > maxBalance))
273273 then currBalance
274274 else {
275275 let diff = (maxBalance - currBalance)
276276 if ((diff > MAXBALANCEDIFF))
277277 then throw("dApp is temporary disabled")
278278 else maxBalance
279279 }
280280 }
281281
282282
283283 @Callable(i)
284284 func dAppUp (dAppUp) = if ((i.caller != SERVER))
285285 then throw("Only Server can manage dAppUp attribute")
286286 else if ((IsDAppUp() == dAppUp))
287287 then throw("dAppUp must be different with actual value")
288288 else WriteSet([DataEntry(DAPPUPKEY, dAppUp)])
289289
290290
291291
292292 @Callable(i)
293293 func bet (playerChoice) = {
294294 let newGameNum = IncrementGameNum()
295295 let gameId = toBase58String(i.transactionId)
296296 let pmt = extract(i.payment)
297297 let betNotInWaves = isDefined(pmt.assetId)
298298 let winAmt = ValidateBetAndDefineWinAmt(pmt.amount, playerChoice)
299299 let txIdUsed = isDefined(getString(this, gameId))
300300 if (!(IsDAppUp()))
301301 then throw("DApp is under maintenance")
302302 else if (betNotInWaves)
303303 then throw("Bet amount must be in Waves")
304304 else if (txIdUsed)
305305 then throw("Passed txId had been used before. Game aborted.")
306306 else {
307307 let playerPubKey58 = toBase58String(i.callerPublicKey)
308308 let gameDataStr = FormatGameDataStr(STATESUBMITTED, playerChoice, playerPubKey58, height, winAmt, "")
309309 ScriptResult(WriteSet([DataEntry(RESERVATIONKEY, ValidateAndIncreaseReservedAmt(winAmt)), DataEntry(GAMESCOUNTERKEY, newGameNum), DataEntry(MAXBALANCEKEY, monitorMaxBalance()), DataEntry(gameId, gameDataStr)]), TransferSet([ScriptTransfer(SERVER, COMMISSION, unit)]))
310310 }
311311 }
312312
313313
314314
315315 @Callable(i)
316316 func withdraw (gameId,rsaSign) = {
317317 let gameDataList = ExtractGameDataList(gameId)
318318 let gameState = gameDataList[IdxGameState]
319319 let playerChoice = gameDataList[IdxPlayerChoice]
320320 let startedHeight = parseIntValue(gameDataList[IdxStartedHeight])
321321 let winAmt = parseIntValue(gameDataList[IdxWinAmt])
322322 let playerPubKey58 = gameDataList[IdxPlayerPubKey58]
323323 let playerAddress = addressFromPublicKey(fromBase58String(playerPubKey58))
324324 let winByTimeout = ((height - startedHeight) > RANDORACLETIMEFRAME)
325325 let decreasedReserves = DecreaseReservedAmt(gameId, winAmt)
326326 if ((gameState != STATESUBMITTED))
327327 then throw("Invalid game state for passed gameId")
328328 else if (winByTimeout)
329329 then {
330330 let randStr = take(playerChoice, 1)
331331 let newGameDataStr = FormatGameDataStr(STATEWON, playerChoice, playerPubKey58, startedHeight, winAmt, randStr)
332332 WinScriptSet(gameId, playerAddress, winAmt, newGameDataStr, winByTimeout, decreasedReserves)
333333 }
334334 else {
335335 let randStr = RandToStr(GenerateRandInt(gameId, rsaSign))
336336 if ((i.caller != SERVER))
337337 then throw("Regular withdraw can be done by server only")
338338 else if (IsPlayerWin(playerChoice, randStr))
339339 then {
340340 let newGameDataStr = FormatGameDataStr(STATEWON, playerChoice, playerPubKey58, startedHeight, winAmt, randStr)
341341 WinScriptSet(gameId, playerAddress, winAmt, newGameDataStr, winByTimeout, decreasedReserves)
342342 }
343343 else {
344344 let newGameDataStr = FormatGameDataStr(STATELOST, playerChoice, playerPubKey58, startedHeight, winAmt, randStr)
345345 WriteSet([DataEntry(gameId, newGameDataStr), decreasedReserves])
346346 }
347347 }
348348 }
349349
350350
351351 @Verifier(tx)
352352 func verify () = if (sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey))
353353 then match tx {
354354 case ttx: TransferTransaction =>
355355 ((wavesBalance(this) - ttx.amount) >= ExtractReservedAmt())
356356 case stx: SetScriptTransaction =>
357357 if ((IsDAppUp() == false))
358358 then (ExtractReservedAmt() == 0)
359359 else false
360360 case _ =>
361361 false
362362 }
363363 else false
364364

github/deemru/w8io/026f985 
50.00 ms