tx · CRdoQEkbM84J9ppPCpRrj3q2B2Wv9nxhNrx2aapU8FKc

3MsGBnTzBhrNe6w1KpLYPkzdDdxWudm4U89:  -0.01400000 Waves

2019.08.21 13:08 [640746] smart account 3MsGBnTzBhrNe6w1KpLYPkzdDdxWudm4U89 > SELF 0.00000000 Waves

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

github/deemru/w8io/026f985 
55.68 ms