tx · FHPVvmewUmrBzp43sA9LoBCAVr6sCF7fE8UUxyum8qS3

3NBWVfQbLU9yqYFNpGUMtmURyrH7bYq1XHz:  -0.01500000 Waves

2019.07.11 11:59 [580823] smart account 3NBWVfQbLU9yqYFNpGUMtmURyrH7bYq1XHz > SELF 0.00000000 Waves

{ "type": 13, "id": "FHPVvmewUmrBzp43sA9LoBCAVr6sCF7fE8UUxyum8qS3", "fee": 1500000, "feeAssetId": null, "timestamp": 1562835590097, "version": 1, "sender": "3NBWVfQbLU9yqYFNpGUMtmURyrH7bYq1XHz", "senderPublicKey": "4Fo9f1CzjjVp3zkua3g1NBYdWmSEdxLKTkoC663PvJYG", "proofs": [ "3LZP1YBWCd5FfJ4KKqiWFXsxaM5yRD5G4dusT9RupNio8R7ENh2P9HpcZZdpaUXmMitCCQTit6hEeDiF84EVSuF4" ], "script": "base64:AAIDAAAAAAAAAAAAAAAvAAAAAAdXQVZFTEVUCQAAaAAAAAIJAABoAAAAAgAAAAAAAAAAZAAAAAAAAAAD6AAAAAAAAAAD6AAAAAAKQ09NTUlTU0lPTgkAAGkAAAACCQAAaAAAAAIAAAAAAAAAAAUFAAAAB1dBVkVMRVQAAAAAAAAAA+gAAAAACVJTQVBVQkxJQwkAAlsAAAABAgAAAY9iYXNlNjQ6TUlJQklqQU5CZ2txaGtpRzl3MEJBUUVGQUFPQ0FROEFNSUlCQ2dLQ0FRRUFxbEFpQU5TbUJwREhZS1A5c0tnZU4vbDFiQWIyOGcvdEdsZ0Rrd1Q1RmlNTjRYM3B3ZHZkeEU3bXZTUjgvNDFkVTlyeDRqRys2dFpwYjFVTFZEUHM0MzF0UjJJUmFUWHc1Q2orQWMydmhMKzVKYW1DZXJHRDFVVytiaC9FR1F0eG84VzNZTERyb2ZYQjVRSEp4NFBrejJLZ2Yrb1MvQzhoSHVCL1U0a3JPNzZVMDUwN0dUalpQUDlrUlEwdUxTTWVxUVh0OHdYUytuTXA1d2FqcXhQcERMTWFTUkVnc0t3di9BRWtQ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AAAAUU2V0U2NyaXB0VHJhbnNhY3Rpb24EAAAAA3N0eAUAAAAHJG1hdGNoMAMJAAAAAAAAAgkBAAAACElzREFwcFVwAAAAAAcJAAAAAAAAAgkBAAAAEkV4dHJhY3RSZXNlcnZlZEFtdAAAAAAAAAAAAAAAAAAHBwe/r0gf", "chainId": 84, "height": 580823, "spentComplexity": 0 } View: original | compacted Prev: 93d1rQxcimJXjBmYkdDV9RGXBpBBDiTkiR57WgjnzrHM Next: none Diff:
OldNewDifferences
99
1010 let SERVER = addressFromStringValue("3NCiG28LmWyTigWG13E5QnvdHBsZFYXSS2j")
1111
12-let RANDORACLETIMEFRAME = 1
12+let RANDORACLETIMEFRAME = 2880
1313
1414 let MAXDIFF = (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 MAXDIFF = (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 > MAXDIFF))
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/fabc49c 
42.97 ms