tx · 9fSDAxX9uypZWBcdkeJiMqx9H49oNpTh6qKtpk91ZN3F

3MsGBnTzBhrNe6w1KpLYPkzdDdxWudm4U89:  -0.01400000 Waves

2019.08.21 10:04 [640555] smart account 3MsGBnTzBhrNe6w1KpLYPkzdDdxWudm4U89 > SELF 0.00000000 Waves

{ "type": 13, "id": "9fSDAxX9uypZWBcdkeJiMqx9H49oNpTh6qKtpk91ZN3F", "fee": 1400000, "feeAssetId": null, "timestamp": 1566371046971, "version": 1, "sender": "3MsGBnTzBhrNe6w1KpLYPkzdDdxWudm4U89", "senderPublicKey": "FgbqvGasMMrXxbhwrsgEiCgJLjXPjgn8kHxsZiVmLrkb", "proofs": [ "4RbPrLM1EAo9b2VPFpB67FDv24pfRfNnLgEdTAV1Yzauyrz4dNgpeAxS8uY8KehV2uPEk22rTvoQbJ3hE5eRbAkN" ], "script": "base64:AAIDAAAAAAAAAAAAAAAgAAAAAAlSU0FQVUJMSUMJAAJbAAAAAQIAAAGPYmFzZTY0Ok1JSUJJakFOQmdrcWhraUc5dzBCQVFFRkFBT0NBUThBTUlJQkNnS0NBUUVBbGVtcjk1SjFqWlVzN2NKbXJtbWxONHpvN1lWc0JKekllSmRrOExERkdoVUtTSTZ5ZnMyMFp5SmUyMSs2R0p3Tm5LVVUxVXlvYzE3d1NXTUtrclowTU12WUUrWjVBaWlqdkJLNHNTSjNJZ0dqZFU4L05oSThDQkR1MEYreFJNOXEzVEIzTExiRHk1c0JkdWRZZkhmc1VPYytNVHZBRDY5bjI3ZGIyUmg4K3laUU10dWJrdVRRTnA4OXNwaEhRYUxHeVFGYU5sSy9OYTNsRng2b21xemFhMWdqb3BsVXI2cnZZS2dmQUlDVUIzelZtSlNoaUVpN3c3UjBoV2xOUkQzcWNaakNVT05TcEZvNFdiemtuR09henc4NEIrSU1JRm5JcFhXelFMOFJYMHZOY2ZzQnZMRGZNNmsyWmFjcXd5TUthTExxaWdkQmlHZEo3VyswbE9TdE9RSURBUUFCAAAAABNSQU5ET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XRhRW50cnkAAAACBQAAAA5SRVNFUlZBVElPTktFWQkBAAAAHlZhbGlkYXRlQW5kSW5jcmVhc2VSZXNlcnZlZEFtdAAAAAEFAAAABndpbkFtdAkABEwAAAACCQEAAAAJRGF0YUVudHJ5AAAAAgUAAAAPR0FNRVNDT1VOVEVSS0VZBQAAAApuZXdHYW1lTnVtCQAETAAAAAIJAQAAAAlEYXRhRW50cnkAAAACBQAAAAZnYW1lSWQFAAAAC2dhbWVEYXRhU3RyBQAAAANuaWwJAQAAAAxTY3JpcHRSZXN1bHQAAAACCQEAAAAIV3JpdGVTZXQAAAABBQAAAAdiZXREYXRhCQEAAAALVHJhbnNmZXJTZXQAAAABBQAAAA5zZXJ2ZXJUcmFuc2ZlcgAAAAC7IgHd", "chainId": 84, "height": 640555, "spentComplexity": 0 } View: original | compacted Prev: FZaVVwuudjyPinYPnh2twVyVoL6EezfDWF72xkYXN69a Next: 8AxSmR2Z9mNtWDTiBxyVrgiuhWMgzRKE6qducZbTjJmx Diff:
OldNewDifferences
161161 then {
162162 let bulletsCount = size(playerChoice)
163163 let bet = (betAmt - COMMISSION)
164- if ((bulletsCount == 5))
164+ let b1 = parseIntValue(take(playerChoice, 1))
165+ let forB2 = drop(playerChoice, 1)
166+ let b2 = parseIntValue(take(forB2, 1))
167+ let forB3 = drop(playerChoice, 1)
168+ let b3 = parseIntValue(take(forB3, 1))
169+ let forB4 = drop(playerChoice, 1)
170+ let b4 = parseIntValue(take(forB4, 1))
171+ let forB5 = drop(playerChoice, 1)
172+ let b5 = parseIntValue(take(forB5, 1))
173+ let activeBullets = ((((b1 + b2) + b3) + b4) + b5)
174+ if ((activeBullets == 5))
165175 then ((bet * RATE1) / RATEMULT)
166- else if ((bulletsCount == 4))
176+ else if ((activeBullets == 4))
167177 then ((bet * RATE2) / RATEMULT)
168- else if ((bulletsCount == 3))
178+ else if ((activeBullets == 3))
169179 then ((bet * RATE3) / RATEMULT)
170- else if ((bulletsCount == 2))
180+ else if ((activeBullets == 2))
171181 then ((bet * RATE4) / RATEMULT)
172- else if ((bulletsCount == 1))
182+ else if ((activeBullets == 1))
173183 then ((bet * RATE5) / RATEMULT)
174- else throw("Invalid bullets in player's choice")
184+ else throw("Invalid player's choice")
175185 }
176186 else throw("Bet amount is not in range")
177187 }
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 GAMESCOUNTERKEY = "$GAME_NUM"
3535
3636 let RESERVATIONKEY = "$RESERVED_AMOUNT"
3737
3838 let STATESUBMITTED = "SUBMITTED"
3939
4040 let STATEWON = "WON"
4141
4242 let STATELOST = "LOST"
4343
4444 func getAnswer (playerChoice) = BET14
4545
4646
4747 func GenerateRandInt (gameId,rsaSign) = {
4848 let rsaSigValid = rsaVerify(SHA256, toBytes(gameId), rsaSign, RSAPUBLIC)
4949 if (rsaSigValid)
5050 then {
5151 let rand = (toInt(sha256(rsaSign)) % 6)
5252 if ((0 > rand))
5353 then (-1 * rand)
5454 else rand
5555 }
5656 else throw("Invalid RSA signature")
5757 }
5858
5959
6060 func RemoveUnderscoreIfPresent (remaining) = if ((size(remaining) > 0))
6161 then drop(remaining, 1)
6262 else remaining
6363
6464
6565 func ParseNextAttribute (remaining) = {
6666 let s = size(remaining)
6767 if ((s > 0))
6868 then {
6969 let nn = parseIntValue(take(remaining, 2))
7070 let v = take(drop(remaining, 2), nn)
7171 let tmpRemaining = drop(remaining, (nn + 2))
7272 let remainingState = RemoveUnderscoreIfPresent(tmpRemaining)
7373 [v, remainingState]
7474 }
7575 else throw("Empty string was passed into parseNextAttribute func")
7676 }
7777
7878
7979 func ParseGameRawDataStr (rawStateStr) = {
8080 let gameState = ParseNextAttribute(rawStateStr)
8181 let playerChoice = ParseNextAttribute(gameState[1])
8282 let playerPubKey58 = ParseNextAttribute(playerChoice[1])
8383 let startedHeight = ParseNextAttribute(playerPubKey58[1])
8484 let winAmt = ParseNextAttribute(startedHeight[1])
8585 [gameState[0], playerChoice[0], playerPubKey58[0], startedHeight[0], winAmt[0]]
8686 }
8787
8888
8989 func ExtractGameDataList (gameId) = {
9090 let rawDataStr = match getString(this, gameId) {
9191 case str: String =>
9292 str
9393 case _ =>
9494 throw(("Couldn't find game by " + gameId))
9595 }
9696 ParseGameRawDataStr(rawDataStr)
9797 }
9898
9999
100100 func ExtractReservedAmt () = match getInteger(this, RESERVATIONKEY) {
101101 case a: Int =>
102102 a
103103 case _ =>
104104 0
105105 }
106106
107107
108108 func ValidateAndIncreaseReservedAmt (winAmt) = {
109109 let newReservedAmount = (ExtractReservedAmt() + winAmt)
110110 let balance = wavesBalance(this)
111111 if ((newReservedAmount > balance))
112112 then throw("Insufficient funds on Russian Roulette account. Transaction was rejected for your safety.")
113113 else newReservedAmount
114114 }
115115
116116
117117 func IncrementGameNum () = {
118118 let gameNum = match getInteger(this, GAMESCOUNTERKEY) {
119119 case num: Int =>
120120 num
121121 case _ =>
122122 0
123123 }
124124 (gameNum + 1)
125125 }
126126
127127
128128 func FormatGameDataParam (p) = {
129129 let s = size(p)
130130 if ((s == 0))
131131 then throw("Parameter size must be greater then 0")
132132 else if ((s > 99))
133133 then throw("Parameter size must be less then 100")
134134 else if ((10 > s))
135135 then (("0" + toString(s)) + p)
136136 else (toString(s) + p)
137137 }
138138
139139
140140 func FormatGameDataStr (gameState,playerChoice,playerPubKey58,startedHeight,winAmt,randOrEmpty) = {
141141 let fullStateStr = ((((((((FormatGameDataParam(gameState) + "_") + FormatGameDataParam(playerChoice)) + "_") + FormatGameDataParam(playerPubKey58)) + "_") + FormatGameDataParam(toString(startedHeight))) + "_") + FormatGameDataParam(toString(winAmt)))
142142 if ((randOrEmpty == ""))
143143 then fullStateStr
144144 else ((fullStateStr + "_") + FormatGameDataParam(randOrEmpty))
145145 }
146146
147147
148148 func ValidateBetAndDefineWinAmt (betAmt,playerChoice) = {
149149 let betAmtValid = if (if (if (if (if ((betAmt == (BET1 + COMMISSION)))
150150 then true
151151 else (betAmt == (BET2 + COMMISSION)))
152152 then true
153153 else (betAmt == (BET4 + COMMISSION)))
154154 then true
155155 else (betAmt == (BET8 + COMMISSION)))
156156 then true
157157 else (betAmt == (BET14 + COMMISSION)))
158158 then true
159159 else false
160160 if (betAmtValid)
161161 then {
162162 let bulletsCount = size(playerChoice)
163163 let bet = (betAmt - COMMISSION)
164- if ((bulletsCount == 5))
164+ let b1 = parseIntValue(take(playerChoice, 1))
165+ let forB2 = drop(playerChoice, 1)
166+ let b2 = parseIntValue(take(forB2, 1))
167+ let forB3 = drop(playerChoice, 1)
168+ let b3 = parseIntValue(take(forB3, 1))
169+ let forB4 = drop(playerChoice, 1)
170+ let b4 = parseIntValue(take(forB4, 1))
171+ let forB5 = drop(playerChoice, 1)
172+ let b5 = parseIntValue(take(forB5, 1))
173+ let activeBullets = ((((b1 + b2) + b3) + b4) + b5)
174+ if ((activeBullets == 5))
165175 then ((bet * RATE1) / RATEMULT)
166- else if ((bulletsCount == 4))
176+ else if ((activeBullets == 4))
167177 then ((bet * RATE2) / RATEMULT)
168- else if ((bulletsCount == 3))
178+ else if ((activeBullets == 3))
169179 then ((bet * RATE3) / RATEMULT)
170- else if ((bulletsCount == 2))
180+ else if ((activeBullets == 2))
171181 then ((bet * RATE4) / RATEMULT)
172- else if ((bulletsCount == 1))
182+ else if ((activeBullets == 1))
173183 then ((bet * RATE5) / RATEMULT)
174- else throw("Invalid bullets in player's choice")
184+ else throw("Invalid player's choice")
175185 }
176186 else throw("Bet amount is not in range")
177187 }
178188
179189
180190 @Callable(i)
181191 func bet (playerChoice) = {
182192 let newGameNum = IncrementGameNum()
183193 let gameId = toBase58String(i.transactionId)
184194 let pmt = extract(i.payment)
185195 let betNotInWaves = isDefined(pmt.assetId)
186196 let feeNotInWaves = isDefined(pmt.assetId)
187197 let winAmt = ValidateBetAndDefineWinAmt(pmt.amount, playerChoice)
188198 let txIdUsed = isDefined(getString(this, gameId))
189199 if (betNotInWaves)
190200 then throw("Bet amount must be in Waves")
191201 else if (feeNotInWaves)
192202 then throw("Transaction's fee must be in Waves")
193203 else if (txIdUsed)
194204 then throw("Passed txId had been used before. Game aborted.")
195205 else {
196206 let playerPubKey58 = toBase58String(i.callerPublicKey)
197207 let gameDataStr = FormatGameDataStr(STATESUBMITTED, playerChoice, playerPubKey58, height, winAmt, "")
198208 let SERVER = addressFromPublicKey(i.callerPublicKey)
199209 let serverTransfer = [ScriptTransfer(SERVER, COMMISSION, unit)]
200210 let betData = [DataEntry(RESERVATIONKEY, ValidateAndIncreaseReservedAmt(winAmt)), DataEntry(GAMESCOUNTERKEY, newGameNum), DataEntry(gameId, gameDataStr)]
201211 ScriptResult(WriteSet(betData), TransferSet(serverTransfer))
202212 }
203213 }
204214
205215

github/deemru/w8io/026f985 
54.77 ms