tx · A1ck512fybHMZivTSc3Jj7dqSnekfMcVsQkHubqCM1Yj

3Mwuu6do9zBghKKVshUFferCwepiQYcAeVE:  -0.01500000 Waves

2019.07.12 13:19 [582377] smart account 3Mwuu6do9zBghKKVshUFferCwepiQYcAeVE > SELF 0.00000000 Waves

{ "type": 13, "id": "A1ck512fybHMZivTSc3Jj7dqSnekfMcVsQkHubqCM1Yj", "fee": 1500000, "feeAssetId": null, "timestamp": 1562926772098, "version": 1, "sender": "3Mwuu6do9zBghKKVshUFferCwepiQYcAeVE", "senderPublicKey": "8fdATo5z3B5EweA3kKoRgbJZhGa4JicyHHMkhBZTvNSf", "proofs": [ "2nsDdmeA6DSgLNMkiNLGU9vm6TBug2iBCCG4PvprZRjVTVbqg2PE8jikm5ZcFxDH4oL3RfFZA5Z8GtcEAUr78VwC" ], "script": "base64:AAIDAAAAAAAAAAAAAAANAAAAAAVXYXZlcwAAAAAABfXhAAAAAAAEYmV0MQkAAGgAAAACAAAAAAAAAAABBQAAAAVXYXZlcwAAAAAEYmV0NQkAAGgAAAACAAAAAAAAAAAFBQAAAAVXYXZlcwAAAAAFYmV0MTAJAABoAAAAAgAAAAAAAAAACgUAAAAFV2F2ZXMAAAAABWJldDI1CQAAaAAAAAIAAAAAAAAAABkFAAAABVdhdmVzAAAAAAZiZXQxMDAJAABoAAAAAgAAAAAAAAAAZAUAAAAFV2F2ZXMAAAAACWNvbWlzc2lvbgAAAAAAAExLQAAAAAAPb3JhY2xlUHVibGljS2V5CQACWwAAAAECAAAAh2Jhc2U2NDpNRnd3RFFZSktvWklodmNOQVFFQkJRQURTd0F3U0FKQkFNWnVMb0xIVjVmY3VxUC9LakhvUTZWc1pTa1NXRjJBd1JBTHJMZ1RVZlhZc2RKdzF6djB0OXY3SUhSNjNnN1lyb0N2VUZTWG0xUm1PaFMxWGpyNXlJRUNBd0VBQVE9PQAAAAANZ2FtZVRpbWVGcmFtZQAAAAAAAAAFoAAAAAAIc3RhdGVBY2MCAAAACEFjY2V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BAAAAA9yZXNlcnZlZEJhbGFuY2UEAAAAByRtYXRjaDEFAAAAFHZhbHVlUmVzZXJ2ZWRCYWxhbmNlAwkAAAEAAAACBQAAAAckbWF0Y2gxAgAAAANJbnQEAAAAAWEFAAAAByRtYXRjaDEFAAAAAWEAAAAAAAAAAAAEAAAAEGF2YWlsYWJsZUJhbGFuY2UJAABlAAAAAgkBAAAADHdhdmVzQmFsYW5jZQAAAAEFAAAABHRoaXMFAAAAD3Jlc2VydmVkQmFsYW5jZQQAAAAPYXZhaWxpYmxlQW1vdW50CQAAZwAAAAIFAAAAEGF2YWlsYWJsZUJhbGFuY2UIBQAAAAN0dHgAAAAGYW1vdW50BAAAAAlzaWduYXR1cmUJAAH0AAAAAwgFAAAAA3R0eAAAAAlib2R5Qnl0ZXMJAAGRAAAAAggFAAAAA3R0eAAAAAZwcm9vZnMAAAAAAAAAAAAIBQAAAAN0dHgAAAAPc2VuZGVyUHVibGljS2V5AwUAAAAPYXZhaWxpYmxlQW1vdW50BQAAAAlzaWduYXR1cmUHAwkAAAEAAAACBQAAAAckbWF0Y2gwAgAAABRTZXRTY3JpcHRUcmFuc2FjdGlvbgQAAAAEc3N0eAUAAAAHJG1hdGNoMAkAAfQAAAADCAUAAAAEc3N0eAAAAAlib2R5Qnl0ZXMJAAGRAAAAAggFAAAABHNzdHgAAAAGcHJvb2ZzAAAAAAAAAAAACAUAAAAEc3N0eAAAAA9zZW5kZXJQdWJsaWNLZXkDCQAAAQAAAAIFAAAAByRtYXRjaDACAAAAF0ludm9rZVNjcmlwdFRyYW5zYWN0aW9uBAAAAARpc3R4BQAAAAckbWF0Y2gwBgcg9rWN", "chainId": 84, "height": 582377, "spentComplexity": 0 } View: original | compacted Prev: 583C6WgyP1ukKL5QdAq4fLCkqMohvska3AjfMLeKw6YX Next: 27VSNnKyqfrNh4wCV1WFYtNqzJmPVGMxgG6S87qCmpr5 Diff:
OldNewDifferences
1515
1616 let comission = 5000000
1717
18-let oraclePublicKey = "base64:MFwwDQYJKoZIhvcNAQEBBQADSwAwSAJBAMZuLoLHV5fcuqP/KjHoQ6VsZSkSWF2A
19-wRALrLgTUfXYsdJw1zv0t9v7IHR63g7YroCvUFSXm1RmOhS1Xjr5yIECAwEAAQ=="
18+let oraclePublicKey = fromBase64String("base64:MFwwDQYJKoZIhvcNAQEBBQADSwAwSAJBAMZuLoLHV5fcuqP/KjHoQ6VsZSkSWF2AwRALrLgTUfXYsdJw1zv0t9v7IHR63g7YroCvUFSXm1RmOhS1Xjr5yIECAwEAAQ==")
2019
2120 let gameTimeFrame = 1440
2221
113112 }
114113 let playerChoice = dataList[2]
115114 let rsaToInt = {
116- let rsaCheck = rsaVerify(SHA256, toBytes(gameId), rsaSign, toBytes(oraclePublicKey))
115+ let rsaCheck = rsaVerify(SHA256, toBytes(gameId), rsaSign, oraclePublicKey)
117116 if (rsaCheck)
118117 then {
119118 let rsaInt = ((toInt(sha256(rsaSign)) % 99) + 1)
Full:
OldNewDifferences
11 {-# STDLIB_VERSION 3 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
44 let Waves = 100000000
55
66 let bet1 = (1 * Waves)
77
88 let bet5 = (5 * Waves)
99
1010 let bet10 = (10 * Waves)
1111
1212 let bet25 = (25 * Waves)
1313
1414 let bet100 = (100 * Waves)
1515
1616 let comission = 5000000
1717
18-let oraclePublicKey = "base64:MFwwDQYJKoZIhvcNAQEBBQADSwAwSAJBAMZuLoLHV5fcuqP/KjHoQ6VsZSkSWF2A
19-wRALrLgTUfXYsdJw1zv0t9v7IHR63g7YroCvUFSXm1RmOhS1Xjr5yIECAwEAAQ=="
18+let oraclePublicKey = fromBase64String("base64:MFwwDQYJKoZIhvcNAQEBBQADSwAwSAJBAMZuLoLHV5fcuqP/KjHoQ6VsZSkSWF2AwRALrLgTUfXYsdJw1zv0t9v7IHR63g7YroCvUFSXm1RmOhS1Xjr5yIECAwEAAQ==")
2019
2120 let gameTimeFrame = 1440
2221
2322 let stateAcc = "Accepted"
2423
2524 let stateWin = "Win"
2625
2726 let stateTimeout = "WinByTimeout"
2827
2928 let stateLose = "Lose"
3029
3130 @Callable(i)
3231 func bet (choice) = {
3332 let pmnt = extract(i.payment)
3433 let gameId = toBase58String(i.transactionId)
3534 let gameStart = height
3635 let gameCounter = {
3736 let gameNumber = {
3837 let counterValue = getInteger(this, "GamesCounter")
3938 match counterValue {
4039 case p: Int =>
4140 p
4241 case _ =>
4342 0
4443 }
4544 }
4645 (gameNumber + 1)
4746 }
4847 let betAssetIdCheck = isDefined(pmnt.assetId)
4948 let playerPublicKey = toBase58String(i.callerPublicKey)
5049 let playerChoice = if (if ((choice == "1"))
5150 then true
5251 else (choice == "2"))
5352 then choice
5453 else throw("Player's choice is incorrect")
5554 let playerPrize = {
5655 let bet = (pmnt.amount - comission)
5756 if (if (if (if (if ((bet == bet1))
5857 then true
5958 else (bet == bet5))
6059 then true
6160 else (bet == bet10))
6261 then true
6362 else (bet == bet25))
6463 then true
6564 else (bet == bet100))
6665 then (bet * 2)
6766 else throw("Payment amount is incorrect")
6867 }
6968 let reservedBalance = {
7069 let currentReservedBalance = {
7170 let valueReservedBalance = getInteger(this, "Reserved")
7271 match valueReservedBalance {
7372 case a: Int =>
7473 a
7574 case _ =>
7675 0
7776 }
7877 }
7978 let newReservedBalance = (currentReservedBalance + playerPrize)
8079 if ((wavesBalance(this) >= newReservedBalance))
8180 then {
8281 let increaseReservedBalance = newReservedBalance
8382 increaseReservedBalance
8483 }
8584 else throw("Bet was rejected. Insufficient funds on game account.")
8685 }
8786 if (betAssetIdCheck)
8887 then throw("You can make bet in Waves only")
8988 else {
9089 let dataString = ((((((((stateAcc + "_") + playerPublicKey) + "_") + playerChoice) + "_") + toString(playerPrize)) + "_") + toString(gameStart))
9190 WriteSet([DataEntry("Reserved", reservedBalance), DataEntry(gameId, dataString)])
9291 }
9392 }
9493
9594
9695
9796 @Callable(i)
9897 func withdraw (gameId,rsaSign) = {
9998 let dataList = {
10099 let getDataString = getString(this, gameId)
101100 let a = match getDataString {
102101 case a: String =>
103102 a
104103 case _ =>
105104 throw("GameId was not found")
106105 }
107106 split(a, "_")
108107 }
109108 let gameState = dataList[0]
110109 let playerAddress = {
111110 let a = dataList[1]
112111 addressFromPublicKey(fromBase58String(a))
113112 }
114113 let playerChoice = dataList[2]
115114 let rsaToInt = {
116- let rsaCheck = rsaVerify(SHA256, toBytes(gameId), rsaSign, toBytes(oraclePublicKey))
115+ let rsaCheck = rsaVerify(SHA256, toBytes(gameId), rsaSign, oraclePublicKey)
117116 if (rsaCheck)
118117 then {
119118 let rsaInt = ((toInt(sha256(rsaSign)) % 99) + 1)
120119 if (if ((rsaInt > 0))
121120 then (100 >= rsaInt)
122121 else false)
123122 then rsaInt
124123 else throw("Rsa integer is not in range")
125124 }
126125 else throw("Rsa Signature is invalid")
127126 }
128127 let gameStart = {
129128 let a = dataList[4]
130129 parseIntValue(a)
131130 }
132131 let playerPrize = {
133132 let a = dataList[3]
134133 parseIntValue(a)
135134 }
136135 let newReservedBalance = {
137136 let valueReservedBalance = getInteger(this, "Reserved")
138137 let extractReservedBalance = match valueReservedBalance {
139138 case a: Int =>
140139 a
141140 case _ =>
142141 0
143142 }
144143 let decreaseReservedBalance = (extractReservedBalance - playerPrize)
145144 if ((decreaseReservedBalance > 0))
146145 then decreaseReservedBalance
147146 else throw("Reserved balance couldn't be less than 0")
148147 }
149148 let stringForNewData = ((((((dataList[1] + "_") + dataList[2]) + "_") + dataList[3]) + "_") + dataList[4])
150149 let gameTime = (gameTimeFrame > (height - gameStart))
151150 let stateCheck = (gameState == stateAcc)
152151 if (stateCheck)
153152 then if (gameTime)
154153 then {
155154 let playerWin = {
156155 let rsaToState = if ((48 > rsaToInt))
157156 then "1"
158157 else if ((rsaToInt > 52))
159158 then "2"
160159 else "3"
161160 (rsaToState == playerChoice)
162161 }
163162 if (playerWin)
164163 then ScriptResult(WriteSet([DataEntry(gameId, ((((stateWin + "_") + stringForNewData) + "_") + toString(rsaToInt))), DataEntry("Reserved", newReservedBalance)]), TransferSet([ScriptTransfer(playerAddress, playerPrize, unit)]))
165164 else WriteSet([DataEntry(gameId, ((((stateLose + "_") + stringForNewData) + "_") + toString(rsaToInt))), DataEntry("Reserved", newReservedBalance)])
166165 }
167166 else throw("Game state is invalid")
168167 else ScriptResult(WriteSet([DataEntry(gameId, ((((stateTimeout + "_") + stringForNewData) + "_") + "00")), DataEntry("Reserved", newReservedBalance)]), TransferSet([ScriptTransfer(playerAddress, playerPrize, unit)]))
169168 }
170169
171170
172171 @Verifier(tx)
173172 func verify () = match tx {
174173 case ttx: TransferTransaction =>
175174 let valueReservedBalance = getInteger(this, "Reserved")
176175 let reservedBalance = match valueReservedBalance {
177176 case a: Int =>
178177 a
179178 case _ =>
180179 0
181180 }
182181 let availableBalance = (wavesBalance(this) - reservedBalance)
183182 let availibleAmount = (availableBalance >= ttx.amount)
184183 let signature = sigVerify(ttx.bodyBytes, ttx.proofs[0], ttx.senderPublicKey)
185184 if (availibleAmount)
186185 then signature
187186 else false
188187 case sstx: SetScriptTransaction =>
189188 sigVerify(sstx.bodyBytes, sstx.proofs[0], sstx.senderPublicKey)
190189 case istx: InvokeScriptTransaction =>
191190 true
192191 case _ =>
193192 false
194193 }
195194

github/deemru/w8io/169f3d6 
43.43 ms